how can i write this in matlab ?

for i=x:-1:Q;
z=i-1;
A0=pi*(i/2)^2;
A1=pi*(z/2)^2;
Y=ln(A0/A1);
Fn=A0 . ( Y(n-1)+Y(n))
plot(i,F)

Answers (1)

John D'Errico
John D'Errico on 29 Dec 2016
Edited: John D'Errico on 29 Dec 2016
You already did write it. WTP?
for i=x:-1:Q
z=i-1;
A0=pi*(i/2)^2;
Ai=pi*(z/2)^2;
end
I added an end, and removed spurious semicolon. It does not do anything interesting. And the loop overwrites those variables, so odds are you really did not want to use a loop. But how can we know what you really wanted to do, only seeing what you did do not terribly well?

1 Comment

student  1727
student 1727 on 29 Dec 2016
Edited: student 1727 on 29 Dec 2016
for i=x:-1:Q; z=i-1; A0=pi*(i/2)^2; A1=pi*(z/2)^2; Y=ln(A0/A1); Fn=A0 . ( Y(n-1)+Y(n)) plot(i,F)

This question is closed.

Products

Asked:

on 29 Dec 2016

Closed:

on 29 Dec 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!