how to create a loop function
Mostrar comentarios más antiguos
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 comentario
David Young
el 6 de Mzo. de 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?
Respuestas (2)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!