Plot earth atmospheric model

7 ビュー (過去 30 日間)
Spyros T
Spyros T 2019 年 4 月 30 日
コメント済み: Spyros T 2019 年 5 月 7 日
Hello! Relatively new user here, im trying to plot the model of the atmosphere (density,temperature,speed of sound, vs altitude) as found here:
and here:
but im having trouble with the code, I dont really know what to do, that's why I am asking for a little help.The script runs but its not correct. I guess it is some kind of wrong usage of the if ifelse statements or even the way I created the height vector.
Any help would be appreciated. Thank you.

採用された回答

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2019 年 5 月 6 日
Hi,
Note how to use conditional operators [if... elseif.. else..end] within [for ... end] loop. The equations you have taken are corrected w.r.t nasa.gov info. T used in formulation of the speed of sound has to be absolute tempreature and thus: T = temp + 273.1
Here is the complete answer code:
h=linspace(0,100000);
temp=zeros(size(h)); % Memory allocation
pressure=zeros(size(h)); % Memory allocation
for ii = 1:numel(h)
if h(ii)<11000
temp(ii)=15.04-0.00649*h(ii);
pressure(ii)=101.29*((temp(ii)+273.1)/288.08)^5.256;
elseif h(ii)>11000 && h(ii)<25000
temp(ii)=-56.46;
pressure(ii)=22.65.*exp(1.73-0.000157*h(ii));
else
temp(ii)=-131.21+0.00299*h(ii);
pressure(ii)=2.488*((temp(ii)+273.1)/216.6)^(-11.388);
end
end
dens=pressure./(0.2869*(temp+273.1));
T = temp+273.1;
speedofsound = sqrt(1.4*286*T);
figure(1);plot(h,temp, 'r-*'); grid on, title('temp')
figure(2);plot(h,dens, 'b-o'); grid on, title('dens')
figure(3);plot(h, speedofsound, 'g-.x'); grid on, title('speed of sound')
  1 件のコメント
Spyros T
Spyros T 2019 年 5 月 7 日
Thank you very much for your help.
Runs great now!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by