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 CenterFile Exchange에서 Pie Charts에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by