table from the variable from the loop
Mostra commenti meno recenti
Hello everyone, could you please help me how to calculate the table from the generated variables from the loop
For example, from the second loop, the table with a colums of V, D, F, W, t
my code is :
clear all; close all
W_takeoff = 10000;
W_landing=6000;
S = 20;
AR = 5;
cd0 = 0.02;
k = 1/pi/AR;
RC=0.51;
clalpha = 2*pi;
amin=2;
astall=12;
rho=1;
ct=0.001;
figure(1);hold on; xlabel('V');ylabel('D')
figure(2);hold on; xlabel('V');ylabel('D')
figure(3);hold on; xlabel('V');ylabel('P')
figure(4);hold on; xlabel('V');ylabel('P')
figure(5);hold on; xlabel('\alpha');ylabel('c_l/c_d^2')
i=0;
for alpha = amin:0.25:astall
i=i+1;
cl(i) = clalpha * alpha * pi/180;
V_takeoff(i) = sqrt(2*W_takeoff/rho/S/cl(i));
V_landing(i) = sqrt(2*W_landing/rho/S/cl(i));
cd(i) = cd0 + k * cl(i) * cl(i);
D_takeoff(i) = 0.5 * rho * V_takeoff(i) * V_takeoff(i) * S * cd(i);
D_landing(i) = 0.5 * rho * V_landing(i) * V_landing(i) * S * cd(i);
p_takeoff(i) = D_takeoff(i)*V_takeoff(i);
p_landing(i) = D_landing(i)*V_landing(i);
P_takeoff(i)=20000+500*V_takeoff(i);
T_takeoff(i)=20000/V_takeoff(i)+500;
P_landing(i)=20000+500*V_landing(i);
T_landing(i)=20000/V_landing(i)+500;
cl_cd2(i)=cl(i)/(cd(i)*cd(i));
ang(i)=alpha;
end
figure(1); plot(V_takeoff,D_takeoff)
hold on
plot(V_takeoff,T_takeoff)
title(['Takeoff'])
figure(2); plot(V_landing,D_landing)
hold on
plot(V_landing,T_landing)
title(['Landing'])
figure(3); plot(V_takeoff,p_takeoff)
hold on
plot(V_takeoff,P_takeoff)
title(['Takeoff'])
figure(4); plot(V_landing,p_landing)
hold on
plot(V_landing,P_landing)
title(['Landing'])
figure(5); plot(ang,cl_cd2);
alpha_max=3;
cl_max=clalpha*alpha_max*pi/180;
cd_max = cd0 + k * cl_max * cl_max;
j=0;
for w=W_takeoff:-50:W_landing
j=j+1;
V(j) = sqrt(2*w/rho/S/cl_max);
D(j) = 0.5 * rho * V(j) * V(j) * S * cd_max;
T(j)=D(j); %for steady level flight condition
F(j)=ct*T(j); %fuel consumption
Weight(j)=w;
t(j)=abs((Weight(j)-10000))/F(j);
R(j)=V(j)*t(j);
end
[max_delta,idelta] = max(abs(D_takeoff-T_takeoff));
figure(6); plot(t,V)
figure(7); plot(t,F);
figure(8); plot(t,R);
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Manage Products in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!