Info

This question is closed. Reopen it to edit or answer.

Why I can't get a line plot from this code? Moreover how can I get different color for different "q" values here?

1 view (last 30 days)
clear all;
p=100;
for q=0:0.2:1
for r=0:pi/6:4*pi
s=(((1-q^2)^2)/(1+q^4-2*(q^2)*(cos(r))))*p;
plot(r,s,'b-o','-','LineWidth',2)
hold all;
end
end

Answers (1)

KSSV
KSSV on 13 Apr 2017
Edited: KSSV on 13 Apr 2017
q = 0:0.2:1 ;
r=0:pi/6:4*pi ;
s = zeros(length(q),length(r)) ;
for i = 1:length(q)
s(i,:)=(((1-q(i)^2)^2)./(1+q(i)^4-2*(q(i)^2)*(cos(r))))*p;
end
plot(r,s)

Tags

Community Treasure Hunt

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

Start Hunting!