I am currently plotting a graph of a certain radiation pattern. I do not want any negative radius values to be plotted. To "recitfy" this situationl, I utilized rlim. However, Negative values are still appearing. Thanks in advance.
This is my code:
theta = linspace(-10*pi,10*pi,10000);
rho = 10.*log10((cos(theta)).^9) + 30;
polarplot(theta, rho);
rlim([0 30]);
This is the graph: I do not wish to see the top and bottom lobes.

 채택된 답변

Simon Chan
Simon Chan 2022년 2월 1일

0 개 추천

Determine the index for non-negative number of rho only.
Beware your data are complex number.
theta = linspace(-10*pi,10*pi,10000);
rho = 10.*log10((cos(theta)).^9) + 30;
idx.pos = rho>=0; % Determine non-negative rho
polarplot(theta(idx.pos), rho(idx.pos));

댓글 수: 4

Jon Ho
Jon Ho 2022년 2월 1일
Thank you for your help! Should I use polar pattern instead of polar plot for this kind of graph in the future?
Simon Chan
Simon Chan 2022년 2월 1일
편집: Simon Chan 2022년 2월 1일
It really depends on what you would like to present.
For polar pattern, complex number is not allowed, below shows the magnitude plot.
Edit for Correction:
For polarpattern, the angle is in degree instead of radian, so I correct for this as follows:
V = polarpattern(rad2deg(theta),abs(rho))
Jon Ho
Jon Ho 2022년 2월 1일
I see, this is the same shape as the polar plot that is not db scale and is not corrected to remove the negative values.
Simon Chan
Simon Chan 2022년 2월 1일
Yes, the shape is the same.
Function polarpattern provides interactive data visualization and measurement.

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

추가 답변 (0개)

카테고리

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

태그

질문:

2022년 2월 1일

댓글:

2022년 2월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by