Continue to Site

# Help me plot 3d polar antenna pattern in Matlab

Status
Not open for further replies.

#### grendhell

##### Member level 1
Hi, I'm trying to plot 3d polar antenna pattern with matlab, but it doesn't work. The most I can do is to convert data to rectangular coordinates and then use mesh or surf. Obviously it's not the same.
Does anybody know how can I do it (commercial software or private code)?
thanks a lot

Grendhell

Re: 3d polar plot

There was a bug in my code, now it's working.
Here's the code:

for ii=1:Ntheta
for jj=1:Nphi
x(ii,jj) = D(ii,jj)*sin((ii-1)*dpi)*cos((jj-1)*dpi);
y(ii,jj) = D(ii,jj)*sin((ii-1)*dpi)*sin((jj-1)*dpi);
z(ii,jj) = D(ii,jj)*cos((ii-1)*dpi);
end
end

figure;
surf(x,y,z)
colormap([1 1 1]);
set(gca,'DataAspectRatio',[1 1 1]);
axis equal;

The angles are sampled with a spacing of dpi for a total number of Ntheta along the elevation θ and Nphi along the azimut φ.
Directivity in polar coordinates is stored in D(ii,jj) where rows represents different elevation angles (from 0 to π) and columns different azimuth angle (from 0 to 2π).
The nested for converts from polar to rectangular (there is a built-in function in Matlab, but the coordinates are different) and then the date are plotted via surf function (mesh and similar might be used as well).
Hope this will help.

Status
Not open for further replies.