replotting radiation pattern from its txt form

Hello ,I have as simple patch antenna with a radiation pattern shown in the attached photo.
i have its TXT form in the attached txt file called "data_rad.txt"
how can i recreate this plot from the TXT file in matlab.
Thanks

2 commentaires

ali
ali le 8 Déc 2017
hi did you find the solution ?? I need help too :)
Try the patternCustom function in Antenna Toolbox
https://in.mathworks.com/help/antenna/ref/patterncustom.html

Connectez-vous pour commenter.

Réponses (1)

hello
maybe this ? nothing fancy but I just figure out your reference image and the usual elevation angle convention (which is the one used in matlab function sph2cart) differs by a shift of pi/2.
the sphere radius is supposed to be 1 (no data found on this matter).
if you want a smooth sphere plot without the edges see fig 3
filename = "data_rad.txt ";
data = readmatrix(filename,'NumHeaderLines',2); % or readtable or whatever you prefer
% Theta [deg.] Phi [deg.] Abs(Dir.)[dBi ] Abs(Theta)[dBi ] Phase(Theta)[deg.] Abs(Phi )[dBi ] Phase(Phi )[deg.] Ax.Ratio[dB ]
theta = data(:,1)*pi/180; % elevation in radians
theta = pi/2-theta; % /!\ onvention change (from image convention to usual elevation angle convention ,also as per matlab fn)
phi = data(:,2)*pi/180; % azimuth in radians
Ad = data(:,3); % Abs(Dir.)[dBi]
% Convert to Cartesian coordinates
[x, y, z] = sph2cart(phi, theta, 1); % (azimuth TH, elevation PHI, radius R)
figure(1)
scatter3(x,y,z,20,Ad,'filled');
xlabel('X')
ylabel('Y')
zlabel('Z')
axis equal
colormap('jet');
colorbar
figure(2)
tri = convhull([x y z]); % triangle connectivity matrix (could be also
% obtained with delaunay) - but since it's a sphere, I think convhull is better suited.
% tri = delaunay([x y z]); % triangle connectivity matrix (could be also obtained with delaunay)
trisurf(tri,x,y,z,Ad,'facecolor','interp');
xlabel('X')
ylabel('Y')
zlabel('Z')
axis equal
colormap('jet');
colorbar
figure(3)
trisurf(tri,x,y,z,Ad,'facecolor','interp','edgecolor','none');
xlabel('X')
ylabel('Y')
zlabel('Z')
axis equal
colormap('jet');
colorbar

Catégories

En savoir plus sur Beamforming and Direction of Arrival Estimation dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by