# how to plot radiation pattern in matlab

Status
Not open for further replies.

#### doooo

##### Newbie level 5 hi everybody,
can anybody expalin how to make 3D polar radiation pattern in matlab?
I am using UV plot where with mesh(x,y,z) command
x=sin(theta)cos(phi)
y=sin(theta)sin(phi)
ans
z=calculated gain
all are NxN square matrix
But I want to plot in polar form
Thanks

Hi, mns. This is my m-file for 3D radiation pattern in linear scale.
First, I get radiation pattern information in spherical coordinate from HFSS.
Then I need to extract directivities depends on phi, theta.
Anyway, the important thing is that you know values in spherical coordinates then should transfer to rectangular coordinates.
You also consider meshgrid depends on your simulation settings(phi, theta steps).

One thing I want to do is, wanna plot my directivity in dB scale. I'm in trouble.

Thanks.

--------------------------------------------------------------------------------------

Code dot - [expand]1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Directivity=c.data(:,3); %where my directivity values

r = zeros(19,37); % theta, phi, 10 degree step

n=0;
for i=1:size(r,1)
for j=1:size(r,2)
r(i,j) = Directivity(n+j);
end
n = size(r,2)*i;
end;

[phi,theta] = meshgrid(linspace(0,360,37), linspace(0,180,19)); % 10 degree step

x = r.*sin(theta*pi/180).*cos(phi*pi/180);
y = r.*sin(theta*pi/180).*sin(phi*pi/180);
z = r.*cos(theta*pi/180);
figure
surf(x,y,z,r);
shading interp;

---------------------------------------------------------------------------------

Last edited by a moderator:

Status
Not open for further replies.