Borrar filtros
Borrar filtros

Polarplot all positive values of the angle theta

1 visualización (últimos 30 días)
KG573
KG573 el 13 de Mzo. de 2022
Respondida: Simon Chan el 13 de Mzo. de 2022
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])

Respuesta aceptada

Simon Chan
Simon Chan el 13 de Mzo. de 2022
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

Más respuestas (0)

Categorías

Más información sobre Polar Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by