You need to modify your if else condition.....
Repalce:
with
actually when h=36152....value of rho is zero..so the problem. And also you have to initialize the values which you are filling in loop.
N = 65000 ;
rho = zeros(1,N) ;
for h =1:N
if h >= 36152
T=-70;
p=473.1 * exp(1.73 - .000048*h);
rho(h)=p/ (1718 * (T+459.7));
elseif h < 36152
T=59 - .00356*h;
p=2116* ( (T+459.7)/518.6 )^5.256;
rho(h)=p/ (1718 * (T+459.7));
end
end
sigma= rho./0.00237717;
RC= 300;
x_10= 16.789;
eta_p= .68;
wp = zeros(1,N) ;
for i = 1:length(sigma)
ws = linspace(1,4,length(sigma));
wp(i) = eta_p./((RC./33000)+(ws(i)^0.5./(19.*x_10.*sigma(i)^.5)));
end
figure,
plot(ws,wp,'r-')
xlabel('W/S')
ylabel('W/P')
Note that above code can be vctorised. As you are a beginner, it is better to start with loops first and then vectorise.
Best Answer