how to plot radiation pattern in matlab

Status
Not open for further replies.

doooo

Newbie level 5
Joined
Apr 2, 2014
Messages
10
Helped
1
Reputation
2
Reaction score
1
Trophy points
3
Activity points
72

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
c=importdata('F:\2014_SPRC\Matlab\Prob1\5GHz_radiation pattern.xlsx');
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.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…