MATLAB Answers

I cant figure out how to make the plot show up

2 ビュー (過去 30 日間)
Amanda Reed
Amanda Reed 2019 年 11 月 30 日
Edited: Amanda Reed 2019 年 11 月 30 日
Nevermind.

  0 件のコメント

サインイン to comment.

採用された回答

Star Strider
Star Strider 2019 年 11 月 30 日
Try this:
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)
I believe this is essentially what you intended. There are still problems that need to be addressed, however the code runs and the plot shows up!

  2 件のコメント

Amanda Reed
Amanda Reed 2019 年 11 月 30 日
Oh my gosh thank you so much!
Star Strider
Star Strider 2019 年 11 月 30 日
As always, my pleasure!

サインイン to comment.

More Answers (0)

サインイン してこの質問に回答します。

タグ


Translated by