フィルターのクリア

Polarplot all positive values of the angle theta

1 回表示 (過去 30 日間)
KG573
KG573 2022 年 3 月 13 日
回答済み: Simon Chan 2022 年 3 月 13 日
Hello, i'm trying to get my plot to look like this:
It currently looks like this:
Here is my Code for the plot above:
theta = linspace(-pi,pi,1000);
theta_deg = rad2deg(theta);
EF = cos(theta);
y = polarplot(theta,10*log10(EF),'linewidth',3);
title('E Field (dB)');
legend('\theta = \pi/4');
set(gca,'fontsize',12);
ax = ancestor(y,'polaraxes');
ax.ThetaZeroLocation = 'top';
ax.ThetaDir = 'clockwise';
ax.ThetaLim = [-180 180];
rlim([-40 0])

採用された回答

Simon Chan
Simon Chan 2022 年 3 月 13 日
Workaround by modifying the TickLabel as follows:
theta = linspace(-pi,pi,1000);
theta_deg = rad2deg(theta);
EF = cos(theta);
y = polarplot(theta,real(10*log10(EF)),'linewidth',3); % Plot the real part only, prevent warning pop-up
title('E Field (dB)');
legend('\theta = \pi/4');
set(gca,'fontsize',12);
ax = ancestor(y,'polaraxes');
ax.ThetaZeroLocation = 'top';
ax.ThetaDir = 'clockwise';
ax.ThetaLim = [-180 180];
rlim([-40 0]);
ax.ThetaTickLabel = string(abs(ax.ThetaTick)); %% <-- Add this line

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by