function P = pressure(h) % This is the pressure calculator as a function of height. It is based on the US % Standard Atmosphere of 1976. % Source: http://scipp.ucsc.edu/outreach/BALLOON/Atmosphere/1976%20Standard%20Atmosphere.htm % % This function is at least in the SECOND ORDER phase of development. % VARIABLES and UNITS % % conventions: Large arrays are in all caps % Vectors and other variables are in mixed case, as appropriate % % h :The height above sea level, in m. % P :Pressure of the atmosphere at height h, in N/m2. % P_o :Pressure of the atmosphere at sea level, in N/m2. global data; global index; % CONSTANTS P_o = data(1,91); % N/m2 % MAIN PROGRAM if (h <= 11000) P = P_o * (1 - h / 44329)^5.255876; elseif (h <= 20000) P = P_o * (0.223361)*exp((10999-h)/6341.4); elseif h <= 32000 P = P_o * (0.988626 + h/198903)^(-34.16319); elseif h <= 47000 P = P_o * (0.898309 + h/55280)^(-12.20114); elseif h <= 51000 P = P_o * (0.00109456)*exp((46998-h)/7922); elseif h <= 71000 P = P_o * (0.838263 - h/176142)^12.20114; else P = P_o * (0.838263 - h/176142)^12.20114; % same as <=71000 end data(index,91) = P;