How to plot a polar plot with theta limited to 180 degrees on both ways

58 views (last 30 days)
Hello everyone and thank you for your supportive community.
I have got one issue with polar plots: I am trying to draw a farfield pattern projected onto a "polar" plane (will explain why I put it into quotation marks later). The issue is, in Matlab, the angle θ goes from 0 to 360 degrees. While for the farfield plane cut, we are dealing with spherical coordinates where θ goes from 0 to 180 and ϕ from 0 to 360 (as per the definition of spherical coordinates). Because a cut, in this case, is made by fixing the angle ϕ at given angle (let it be 0 for instance), and then running the angle θ from 0 to 180, then taking the symmetrical ϕ (basically flipping around the axis, or adding 180 degrees), and running θ again from 0 to 180. Basically, the first run gives us half a circle, and the second the second symmetric half.
What I have found to be able to get in matlab is the following figure:
Whereas what I am looking for is something like this:
I realize that in matlab you can change the tick format to 180 which gives one half with θ goes from 0 to 180 and the other half with θ from 0 to -180. But that is not what is explicited in the second figure.
Thanks once again for anyone helping people figure things out.

Answers (1)

Adam Danz
Adam Danz on 20 Oct 2022
Set the ThetaLim and ThetaZeroLocation properties of polaraxes.
See polaraxes properties for more info.
If the negative theta tick values are not desired, you can set the ThetaTickLabels to the absolute value of the current ticks values.
theta = linspace(0,6*pi);
rho1 = theta/10;
ax = polaraxes();
polarplot(ax, -pi:pi/4:pi, 1:9)
ax.ThetaLim = [-180,180];
ax.ThetaZeroLocation = 'top';
  5 Comments
Abdennaser Hadab
Abdennaser Hadab on 20 Oct 2022
Thanks once again @Adam Danz.
Though, it does not seem to work with my data: instead of theta and rho1 as you have given them; I have two tables that are supposed to represent my radiation pattern. But when I plot them one versus the other I get the following figure:
when normally it should look like double the first image I posted. Any idea what I got wrong?
PS: what I did was the following in Matlab:
table=readtable('E:\Actual\Bruce array\Exported data\farfield2791.txt');
theta_table = table(:,1);
phi_table = table(:,2);
mag_table = table(:,3);
theta = table2array(theta_table);
phi = table2array(phi_table);
rho1 = table2array(mag_table);
%patternCustom(mag,theta,phi,'CoordinateSystem','polar','Slice','phi','SliceValue',0);
ax = polaraxes();
polarplot(ax, theta, rho1)
ax.ThetaLim = [-180,180];
ax.ThetaZeroLocation = 'top';
ax.ThetaTick = [-180:15:180];
ax.ThetaTickLabels = abs(ax.ThetaTick);
the table is made of 8 columns, the first is θ, the second is ϕ and the third is the amplitude I am trying to plot. Any ideas what I could have done wrong?

Sign in to comment.

Categories

Find more on Polar Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by