how to create a loop function
Show older comments
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 Comment
David Young
on 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?
Answers (2)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!