How to do polar plot correctly?

조회 수: 3 (최근 30일)
John
John 2014년 6월 24일
댓글: John 2014년 6월 25일
The task is to plot each group in different symbol and color and show them at their "angle" location in polar plot. This script was used:
factor = 1.2 * 1e-3;
n = 7;
f = [400 200 -10 -200 -300];
symb = ['ro' 'bd' 'gs' 'm^' 'cv' 'r+' 'bx'];
figure('color','white')
hold on
for nn=1:n
t = (nn-1)*factor;
A = exp(-1i*2*pi*t*f);
[THETA,RHO] = cart2pol(real(A), imag(A));
polar(THETA,RHO,symb(nn))
end
hold off
However this was what it output. Obviously this is not correct, no polar graph and no color symbol. Something must be wrong.
Above, if no color used by using the script below, it plot as the second graph below:
symb = ['o' 'd' 's' '^' 'v' '+' 'x'];
Thank you for pointing out the mistake.

채택된 답변

Dishant Arora
Dishant Arora 2014년 6월 24일
편집: Dishant Arora 2014년 6월 24일
Define your symb a cell array that is
symb = {'ro' 'bd' 'gs' 'm^' 'cv' 'r+' 'bx'}
To know where you went wrong, check out the echo of following command at command window:
symb = ['ro' 'bd' 'gs' 'm^' 'cv' 'r+' 'bx']
  댓글 수: 2
John
John 2014년 6월 24일
편집: John 2014년 6월 24일
Hi, Dishant:
Thanks! How to plot it as desired "POLAR" plot like Matlat doc example?
John
John 2014년 6월 25일
I found out that the polar plot doesn't accept 'hold on' command. The script below plots perfect polar chart. But as soon as a 'hold on' is added, it became a non-polar plot.
Hope Mathworks can fix this and make it a real polar plot.
factor = 1.2 * 1e-3;
f = [400 200 -10 -200 -300];
figure('color','white')
t = 2*factor;
A = exp(-1i*2*pi*t*f);
[THETA,RHO] = cart2pol(real(A), imag(A));
polar(THETA,RHO,'ro')

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by