How do I plot values taken from a for loop function?
3 ビュー (過去 30 日間)
古いコメントを表示
Hi, I want to plot altitude (a) vs Temperature (T) but the Temperature is a function of altitude. Please find conditions below:
clear
clc
B0=-0.00356616 %Lapse Rate
T0=518.67
B1=0
T1=389.97
B2=0.00054864
T2=389.97
for a=0 %Altutude in ft
B=B0 %Lapse Rate
T=T0 %Temperature in Rankine
for a=0.1:36089.2 %Altutude in ft
B=B0 %Lapse Rate
T=T0*(1+(B0/T0)*a) %Temperature in Rankine
for a=36089.2:65616.8 %Altutude in ft
B=B1 %Lapse Rate
T=T1*(1+(B1/T1)*a) %Temperature in Rankine
for a=65616.8:104987 %Altutude in ft
B=B2 %Lapse Rate
T=T2+((a-a2)*B2) %Temperature in Rankine
end
end
end
end
plot(T,a)
Essentially I am trying to create a plot for altitude (a) is on the y-axis and Temperature (T) is on the x-axis. The value of T will change as altitude increases all the way to the maximum altitude value of 36089.2. Please advice how I am supposed to write the code.
0 件のコメント
回答 (1 件)
KSSV
2023 年 1 月 29 日
clc
B0=-0.00356616 ; %Lapse Rate
T0=518.67 ;
B=B0 ; %Lapse Rate
a=0.1:36089.2 ; %Altutude in ft
T=T0*(1+(B0/T0)*a) ; %Temperature in Rankine
plot(T,a)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!