how to create a loop function
Afficher commentaires plus anciens
first of all I am new in matlab. And I have a code like this:
k=1.4; z=200
for i=330:-1:6;
for j=330:-1:6;
x(i)=i;
y(j)=(x(i-1)/x(i))^((k-1)/k)*z;
%now I want to repeat this such as
y(j-1)=(x(i-2)/x(i-1))^((k-1)/k)*y(j);
end
end
can anyone tell me how to correct this?? thx a lot
[EDITED, Jan, Please apply code formatting - Thanks]
1 commentaire
David Young
le 6 Mar 2015
Please use the "{} Code" button to format your code. It's then much easier to read.
Please also can you say what is wrong - an error message, or an incorrect result?
Réponses (2)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!