TA= 667233.2;
W=228000;
S=360;
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)

else %als Cl kleiner is dan 1,91: niet weergeven, ook niet Cd, D en ook niet Ps
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')
%VANAF HIER POELAERT GEDAAN
c= contour(v,hoogte,PS')
max_c= max(c)
PS=n
if n:=0;
sigma=p
v_temp=a

%partial(PS)/partial(v_temp)=0
%partial(PS)/partial(sigma)=0

%[0, fval]= fsolve[PS,0]
%Zoeken van sigma waar PS=0

This is my code, what i want to do is the following
- The values of cl<1.91 should not be on the graph (now i made them 0), anyone know how i can make them not appear on the contour?
- I want to find the value where PS=0. Problem here: D is dependant on rho and v_temp, sigma is dependent on rho (so basically h, as its programmed to atmos.m, a file where the atmosphere is being written in).
How can i display the values of v_temp and sigma where PS becomes 0?

I would greatly appretiate it!

• : TA= 667233.2;
: W=228000;
: S=360;
: 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)
:
: else %als Cl kleiner is dan 1,91: niet weergeven, ook niet Cd,
: D en ook niet Ps
: 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')
: %VANAF HIER POELAERT GEDAAN
: c= contour(v,hoogte,PS')
: max_c= max(c)
: PS=n
: if n:=0;
: sigma=p
: v_temp=a
:
: %partial(PS)/partial(v_temp)=0
: %partial(PS)/partial(sigma)=0
:
: %[0, fval]= fsolve[PS,0]
: %Zoeken van sigma waar PS=0
:
:
:
:
: This is my code, what i want to do is the following
: - The values of cl<1.91 should not be on the graph (now i made them
: 0), anyone know how i can make them not appear on the contour?
: - I want to find the value where PS=0. Problem here: D is dependant
: on rho and v_temp, sigma is dependent on rho (so basically h, as its
: programmed to atmos.m, a file where the atmosphere is being written
: in).
: How can i display the values of v_temp and sigma where PS becomes 0?
:
: I would greatly appretiate it!
:
you had your "i" double nested so inside for inside for: a,b
just had a rough night i guess?
• What do you mean by double nested? I'm quite new in matlab and coding, everything you see here is done by looking on the internet and youtube.
• somewhere in your program you reset (like random reset switch; like taking a coffee break) the outer i value with the i that's nested inside the loop,

Loop in loop, needs two different variables unless you're delibirately doing it for something special I guess.

Again, I assume that you were very tired at the moment and had a tiny little epilleptical glitch (like with every mammal) in your main computer (in your head).