Storing multiple different values from an equation in a for loop
Mostra commenti meno recenti
Hello,
do you have any advice to solve the following problem that I am facing?
The problem consists in the fact the using the following loop I get in each column of V the same value, while my intention is to give to each column the corresponding value of a mass' value calculated.
for k=1:-dm;
for m=MTOW:-1:MZFW
V(k)=sqrt((2*m*g)./(p1*S*Clmd));
end
end
Therefore, cheching all the values that fill the vector V,they are all the same number(222.1211,which should be the last result for the last time that the equation is computed).
The first number should be near 250 and it should slowly approach the last value 222.1211 hence all the columns of the vector should be filled with different and decreasing values.
This is the full MATLAB code:
g=9.81;
p1=0.4138
MTOW=93500;
MZFW=73800;
dm=MZFW-MTOW
S=122.6;
fj= 7.1824e-06;
CD0=0.0424;
k=0.1267;
Clmd= sqrt(CD0/k)
Cd= CD0+k*(Clmd^2);
for k=1:-dm;
for m=MTOW:-1:MZFW
V(k)=sqrt((2*m*g)./(p1*S*Clmd));
end
end
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Mathematics 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!