


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



function [temp,press,rho,Hgeopvector]=atmosphere4(Hvector,GeometricFlag) %function [temp,press,rho,Hgeopvector]=atmosphere4(Hvector,GeometricFlag) % Standard Atmospheric data based on the 1976 NASA Standard Atmoshere. % Hvector is a vector of altitudes. % If Hvector is Geometric altitude set GeometricFlag=1. % If Hvector is Geopotential altitude set GeometricFlag=0. % Temp, press, and rho are temperature, pressure and density % output vectors the same size as Hgeomvector. % Output vector Hgeopvector is a vector of corresponding geopotential altitudes (ft). % This atmospheric model is good for altitudes up to 295, geopotential ft. % Ref: Intoduction to Flight Test Engineering by Donald T. Ward and Thomas W. Strganac
% index Lapse rate Base Temp Base Geopo Alt Base Pressure Base Density % i Ki(degR/ft) Ti(degR) Hi(ft) P, lbf/ft^ RHO, slug/ft^ format long g D= [1 -.00356616 518.67 0 2116.22 0. 2 0 389.97 36089. 472.675801650081 0. 3 .00054864 389.97 65616. 114.343050672041 0. 4 .00153619 411.57 104986. 18.1283133205764 2.56600341257735e- 5 0 487.17 154199. 2.31620845720195 2.76975106424479e- 6 -.00109728 487.17 170603. 1.23219156244977 1.47347009326248e- 7 -.00219456 454.17 200131. 0.38030066501701 4.87168173794687e- 8 0 325.17 259186. 0.0215739175227548 3.86714900013768e-08];
R=1716.55; %ft^2/(sec^2degR) gamma=1.4; g0=32.17405; %ft/sec^ RE=20926476; % Radius of the Earth, ft K=D(:,2); %degR/ft T=D(:,3); %degR H=D(:,4); %ft P=D(:,5); %lbf/ft^ RHO=D(:,6); %slug/ft^ temp=zeros(size(Hvector)); press=zeros(size(Hvector)); rho=zeros(size(Hvector)); Hgeopvector=zeros(size(Hvector));
% Convert from geometric altitude to geopotental altitude, if necessary. if GeometricFlag Hgeopvector=(RE*Hvector)./(RE+Hvector);
h=Hgeopvector(n4); TonTi=1+K(i)(h-H(i))/T(i); temp(n4)=TonTiT(i); PonPi=TonTi.^(-g0/(K(i)R)); press(n4)=P(i)PonPi; RonRi=TonTi.^(-g0/(K(i)R)-1); rho(n4)=RHO(i)RonRi; end % Index 5, K5= 0 if length(n5)> i=5; h=Hgeopvector(n5); temp(n5)=T(i); PonPi=exp(-g0(h-H(i))/(T(i)R)); press(n5)=P(i)PonPi; RonRi=PonPi; rho(n5)=RHO(i)RonRi; end % Index 6, K6= -. if length(n6)> i=6; h=Hgeopvector(n6); TonTi=1+K(i)(h-H(i))/T(i); temp(n6)=TonTiT(i); PonPi=TonTi.^(-g0/(K(i)R)); press(n6)=P(i)PonPi; RonRi=TonTi.^(-g0/(K(i)R)-1); rho(n6)=RHO(i)RonRi; end % Index 7, K7= -. if length(n7)> i=7; h=Hgeopvector(n7); TonTi=1+K(i)(h-H(i))/T(i); temp(n7)=TonTiT(i); PonPi=TonTi.^(-g0/(K(i)R)); press(n7)=P(i)PonPi; RonRi=TonTi.^(-g0/(K(i)R)-1); rho(n7)=RHO(i)RonRi; end % Index 8, K8= 0 if length(n8)> i=8; h=Hgeopvector(n8); temp(n8)=T(i); PonPi=exp(-g0(h-H(i))/(T(i)R)); press(n8)=P(i)PonPi; RonRi=PonPi; rho(n8)=RHO(i)RonRi; end