Based on the atmospheric temperature data of the U.S. Standard Atmosphere (shown
ID: 3749924 • Letter: B
Question
Based on the atmospheric temperature data of the U.S. Standard Atmosphere (shown below), compute and plot the pressure variation with elevation (km), using MATLAB. Please note that for some segments of the graph (e.g., when the elevation is between 0-11 km), temperature linearly changes with elevation (with a negative or positive slope, ), while for some other segments (e.g when the elevation is between 11-20.1 km), the temperature is constant (isothermal). Remember to convert all temperatures from °C to K. Given information: patm-101 kPa; R-286.9 J/kg.K:- 999 kg/m 90 80.0 km 80 70 61.6 km 60 52.4 km 47.3 km 50 a 40 2.2 km 30 20 20.1 km 11.0 km 10 -120-100 -80-60-40-20 20 Temperature (°C)Explanation / Answer
Ans:
Script.m
h = 0:100:90*1000;
for i=1:size(h,2)
TT(i) = air_pressure(h(i));
end
plot(TT,h)
Constants.m
a1=(-56.5-15.0)/(11000-0);
a2=(-44.5+56.5)/(32.2*1000-20.1*1000);
a3 = (-2.5+44.5)/(47.3*1000-32.2*1000);
a4 = (-20.5+2.5)/(61.6*1000-52.4*1000);
a5 = (-92.5+20.5)/(80*1000-61.6*1000);
g0=9.81;
T_air_seaLevel=288.16;
rho_air_seaLevel=1.225;
P_seaLevel=101000;
R=286.9;
R_earth=6378*1000;
air_temp.m
function [ T ] = air_temp( h1 )
Constants
if h1<=11000 && h1>=0
T=T_air_seaLevel+a1*(h1);
elseif h1>11000 && h1<=20.1*1000
T=air_temp(11000);
return
elseif h1>20.1*1000 && h1<=32.2*1000
T=air_temp(20.1*1000)+a2*(h1-20.1*1000);
return
elseif h1>32.2*1000 && h1<=47.3*1000
T=air_temp(32.2*1000)+a3*(h1-32.2*1000);
return
elseif h1>47.3*1000 && h1<=52.4*1000
T=air_temp(47.3*1000);
return
elseif h1>52.4*1000 && h1<=61.6*1000
T=air_temp(52.4*1000)+a4*(h1-52.4*1000);
return
elseif h1>61.6*1000 && h1<=80.0*1000
T=air_temp(61.6*1000)+a5*(h1-61.6*1000);
return
elseif h1>80.0*1000 && h1<=90*1000
T=air_temp(80.0*1000);
return
else
fprintf("out range ");
T= air_temp(90000);
end
end
air_pressure.m
function [ P ] = air_pressure( h1 )
Constants;
T = air_temp(h1);
rho = air_density(h1);
P=rho*T*R;
end
air_density.m
function [ rho_air ] = air_density( h)
Constants
Ttemp=0;
if h==0
rho_air = rho_air_seaLevel;
return;
elseif h<=11000 && h>0
T = air_temp(h);
rho_air = rho_air_seaLevel*(T/T_air_seaLevel)^(-1*((g0/(a1*R))+1));
return
elseif h>11000 && h<=20.1*1000
Ttemp=air_temp(11000);
rho_air = air_density(11000)*exp((-g0/(R*Ttemp))*(h-11000));
return
elseif h>20.1*1000 && h<=32.2*1000
T = air_temp(h);
Ttemp=air_temp(20.1*1000);
rho_air = air_density(20.1*1000)*(T/Ttemp)^(-1*(g0/(a2*R))+1);
return
elseif h>32.2*1000 && h<=47.3*1000
T = air_temp(h);
Ttemp=air_temp(32.2*1000);
rho_air = air_density(32.2*1000)*(T/Ttemp)^(-1*(g0/(a3*R))+1);
return
elseif h>47.3*1000 && h<=52.4*1000
Ttemp = air_temp(47.3*1000);
rho_air = air_density(47.3*1000)*exp((-g0/(R*Ttemp))*(h-47.3*1000));
elseif h>52.4*1000 && h<=61.6*1000
Ttemp=air_temp(52.4*1000);
T = air_temp(h);
rho_air = air_density(52.4*1000)*(T/Ttemp)^(-1*((g0/(a4*R))+1));
return
elseif h>61.6*1000 && h<=80*1000
Ttemp=air_temp(61.6*1000);
T = air_temp(h);
rho_air = air_density(61.6*1000)*(T/Ttemp)^(-1*((g0/(a5*R))+1));
return
elseif h>80*1000 && h<=90*1000
Ttemp=air_temp(80*1000);
rho_air = air_density(80*1000)*exp((-g0/(R*Ttemp))*(h-80*1000));
return
else
rho_air = 10^-12;
fprintf("out of range ");
end
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.