stage1BurnTimeStart=0;
stage2BurnTimeStart=165;
stage3BurnTimeStart=360;
stage3BurnTimeEnd=500;
tv = 6.5:stage3BurnTimeEnd;
rocketSpeed = zeros(size(tv));
for k = 1:numel(tv)
t = tv(k);
if t >= stage1BurnTimeStart & t < stage2BurnTimeStart
specificImpulse(k) = 263;
grossMass(k) = 2290000;
remainingMass(k) = 13000;
BurnTime(k)=165;
elseif t >= stage2BurnTimeStart & t < stage3BurnTimeStart
specificImpulse(k) = 421;
grossMass(k) = 496200;
remainingMass(k) = 40100;
BurnTime(k)=360;
elseif t >= stage3BurnTimeStart & t <= stage3BurnTimeEnd
specificImpulse(k) = 421;
grossMass(k) = 123000;
remainingMass(k) = 13500;
BurnTime(k)=500;
end
currentMass(k) = (grossMass(k))-((grossMass(k))-(remainingMass(k))).*t./BurnTime(k);
rocketSpeed(k) = 9.81.*specificImpulse(k).*log(grossMass(k)./(currentMass(k)))-(t);
end
figure(1)
plot(tv,rocketSpeed)
Best Answer