Not displaying points on graph when

Hey all, I'm new here and currently programming aircraft performance in matlab. I have a atmos.m file made where the change of atmosphere (temperature, pressure and density) is coded.

Now I want to see where the excess power is max, i think i may have found this (this of course depends on the altitude and density). But where I'm having troubles with is: when the value of cl<1.91, the values should not be displayed in the graph (so basically they should be 0).
I did this with the if loop, but when I look at the graph i see a sudden 'knick' in it.

This is what i have now:

TA= 667233.2; %this is the thrust available
W=228000; %weight of the airplane at start of cruise
S=360; %wing surface
CDO=0,02;
b=60;
AR=10;
h=0;


v= [60:10:350]
hoogte= [0:1000:17000]

%TEST

for j=1:length(hoogte)
hoogte_temp = hoogte(j)
[rho c] = Atmos(hoogte_temp)
sigma= rho/1.225

for i= 1:length(v)
v_temp = v(i);
q= rho*v_temp*v_temp/2
cl(i,j) = W*9.81/S/q

if (cl<1.91)

cd(i,j) = 0.02 + cl(i,j)^2/(AR*3.14*0.8)/beta(i)
D(i,j)= cd(i,j)*q*S
PS(i,j)=(TA*sigma-D(i,j))*v_temp/(W*9.81)

else
cl(i,j)= 0
cd(i,j)=0
D(i,j)=0
PS(i,j)=0
end

if(v_temp/c<1)
beta(i)=sqrt(1-(v_temp/c)^2)

else
beta(i) = NaN
end

cd(i,j) = 0.02 + cl(i,j)^2/(AR*3.14*0.8)/beta(i)
D(i,j)= cd(i,j)*q*S
PS(i,j)=(TA*sigma-D(i,j))*v_temp/(W*9.81)

end

end
figure
contour(v,hoogte,PS')

C= max(PS)
if PS=D
x= max(h)
else
x=0

I'm quite sure the formulas used are correct, the thing i want to find out now is:
- Now the graph displays the value as 0, is it possible to just leave out the values which are less than 1,91 instead of making them 0?
- How do i find the value where PS=0, as this is the maximum cruising altitude of the aircraft. I found fzero, but that gave more errors than something else. If someone could give me a hint or tell me which functions i can use i would be very grateful!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories