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
ali
2017년 12월 8일
hi did you find the solution ?? I need help too :)
Shashank Kulkarni
대략 5시간 전
Try the patternCustom function in Antenna Toolbox
https://in.mathworks.com/help/antenna/ref/patterncustom.html
답변 (1개)
Mathieu NOE
3분 전
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
카테고리
도움말 센터 및 File Exchange에서 Pattern Data Integration and Visualization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!