Change in velocity equation with explicit method
Show older comments
Hello Everyone, I am new to MatLab, and looking for some help.
I have a code where I have 3600 time steps.
I am calculating change in mass of a rocket every step which is assumed to be constant (5000kg/s)
with this bit of a code
for n=2:length(t)
if M(n-1) >= mass_r;
M(n)=M(n-1)-dm*dt;
else
M(n)=mass_r-1;
end
end
I would like someone to help me to implement this equation in MatLab form

I tried using an explicit method but alot of errors just rainfalls on me.
Would appreciate any help.

2 Comments
darova
on 29 Mar 2020
Can you explain more? You have
constant. What are you trying to calculate? What is V?

Accepted Answer
More Answers (1)
darova
on 29 Mar 2020
Here is what i think about this question
for n = 2:length(t)
if m(n-1) > me % if rocket has fuel
dm = 5000;
else
dm = 0; % no fuel, mass change=0
end
dV = (ve*dm - ...)/m % longformula for acceleration
m(n) = m(n) - dm*dt; % mass change
V(n) = V(n-1) + dV*dt;
end
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


