Hi, I am using Matlab to generate symmetric polar plots on the lower half of the circle (i.e. 0-83 degrees and 277-360 degrees).
h = polar(phi,rho)
where phi and rho are input text files.
In this case, Matlab connect the point of (phi_83,rho_83) to (phi_277,rho_277) with one straight line. How can I modify it so that they don't get connected?
Thanks a lot, Bahar

 채택된 답변

Star Strider
Star Strider 2015년 8월 20일

1 개 추천

You have to break them up into two separate plot calls, and use the hold function:
phi = [linspace(0, 83) linspace(277, 360)]*pi/180; % Create Data
rho = abs(sin(6.5*phi)); % Create Data
figure(1)
polar(phi(1:100), rho(1:100))
hold on
polar(phi(101:200), rho(101:200))
hold off
The linspace function creates a 100-element vector by default. You can change that with a third argument, but you would have to change the subscripts in the polar calls to match the new vector lengths.

댓글 수: 2

Bahar
Bahar 2015년 8월 20일
Thanks a lot. This is a great solution :)
Bahar
My pleasure! Thank you for the compliment!
Another possibility (but probably not always applicable) is to insert NaN values in both vectors. (Here, ‘rho’ will include them automatically, because it’s calculated from ‘phi’.)
For example:
phi = [linspace(0, 83) NaN linspace(277, 360) NaN]*pi/180; % Create Data
rho = abs(sin(6.5*phi)); % Create Data
figure(1)
polar(phi, rho)

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Polar Plots에 대해 자세히 알아보기

질문:

2015년 8월 19일

댓글:

2015년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by