Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Help me plot 3d polar antenna pattern in Matlab

Status
Not open for further replies.

grendhell

Member level 1
Joined
May 26, 2007
Messages
40
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,288
Activity points
1,608
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
 

grendhell

Member level 1
Joined
May 26, 2007
Messages
40
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,288
Activity points
1,608
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.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top