Only saving last run for loop

1 回表示 (過去 30 日間)
Alexander Garber
Alexander Garber 2021 年 4 月 11 日
コメント済み: Alexander Garber 2021 年 4 月 12 日
This is my code
for i=1: 560;
z=z+dz;
pie=pie-((g/(cp*thetav(z)))*z);
end
I need pie for later calculations. The problem is that it only saves the last value of pie, and forgets all the rest. Is there a way to fix this?
Thanks
  3 件のコメント
Stephen23
Stephen23 2021 年 4 月 12 日
編集済み: Stephen23 2021 年 4 月 12 日
Alexander Garber
Alexander Garber 2021 年 4 月 12 日
ok i will check it out, thanks!!

サインインしてコメントする。

採用された回答

David Hill
David Hill 2021 年 4 月 11 日
pie(1)=0;
for i=1: 560;
z=z+dz;
pie(i+1)=pie(i)-((g/(cp*thetav(z)))*z);
end
  1 件のコメント
Alexander Garber
Alexander Garber 2021 年 4 月 11 日
How would I plot that? My current plot just has many horizontal lines. Is there a way to assign a specific z value for each data point?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePie Charts についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by