Question: why isnt the variable pg 1 recognized in the lines below function [ T , P ] = stdatm _ MuetzelDonovan ( h ) %

why isnt the variable pg1 recognized in the lines below function [T, P]= stdatm_MuetzelDonovan(h)
% Define Constants
g=9.8;
R=287;
t=288.16;
p=101.325;
d=1.225;
e=exp(1);
%Calculate temp, pressure, and density of a given height
% calculate temprature first line, pressure second, density 3rd line
if h<11000%g1
T =288.16-(.0065*h);
P=(((T/t)^(-g/(-.0065*R))))*p;
pg1=((216.66/t)^(-g/(-.0065*R)))*p;
elseif (11000< h) && (h <25000)%i1
T=288.16-(.0065*11000);
P=e^(-((g*(h-11000))/(R*T)))*(pg1);
pi1=e^(-((g*(25000-11000))/(R*T)))*(pg1);
elseif (25000< h) && (h <47000)%g2
T=288.16-(.0065*11000)+(.003*(h-25000));
P=((T/t)^(g/(.003*R))*p)+pi1;
pg2=((291.6/t)^(-g/(.003*R))*p)+pi1;
elseif (47000< h) && (h <53000)%i2
T=288.16-(.0065*11000)+(.003*25000);
P=e^(-((g*(h-47000))/R*p))*pg2;
pi2=e^(-((g*(53000-47000))/R*T))*pg2;
elseif (53000< h) && (h <79000)%g3
T=288.16-(.0065*11000)+(.003*25000)-(.0045*(h-53000));
P=((T/t)^(g/(.003*R))*p)+pi2;
pg3=((179.16/t)^(-g/(.003*R))*p)+pi2;
elseif (79000< h) && (h <90000)%i3
T=288.16-(.0065*11000)+(.003*25000)-(.0045*53000);
P=e^(-((g*(h-79000))/R*p))*pg3;
pi3= e^(-((g*(90000-79000))/R*T))*pg3;
elseif (90000< h) && (h <100000)%g4
T=288.16-(.0065*11000)+(.003*25000)-(.0045*(53000))+(.004*(h-90000));
P=((T/t)^(g/(.003*R))*p)+pi3;
pg4=((53.16/t)^(-g/(.003*R))*p)+pi3;
end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!