Using patternCustom to plot antenna Radiation Pattern in one figure

13 views (last 30 days)
I'm using MATALAB R2020A with the Antenna toolbox to generate 2-D Plots of the measured Radiation Pattern (power in dBi) of an antenna, saved in an excel file. I wish to plot the Z-X Plane, and Z-Y Plane slice of the RP, but can't seem to understand how to combine the "right side" and "left side" pattern to create one plot. As I understand it has to do with using the polarpattern class, but I cant seem to use it correctly. It would also be great to know how to fix the legend, and add a plot title.
clearvars; %clear all worskspace variables
close all; %Close all figures
%% ------Get data from excel sheet---------
% %Get Anttena Powerb(dBi) data 13x17array
% filename='RawAntennaData.xlsx';
% H = table2array(readtable(filename,'Sheet','Horizontal','Range','B2:R14'));%
% %Get Theta (Elevation) and Phi (Azimuth) data, respectively a 13x1 and 1x17 array
% El= table2array(readtable(filename,'Sheet','Sheet1','Range','A2:A14'));%Elevation, "Vertical" Angle from 0 to pi
% Az = table2array(readtable(filename,'Sheet','Sheet1','Range','B1:R1'));%Azismuth, "Horizontal" angle -pi to pi
%% --- Get data for Helix type antenna Radiation pattern----
h = helix;
[H,Az,El] = pattern(h,2e9);
theta = El;
phi = Az';
MagE = H';
%% 3-D Plot of Antenna Radiation pattern
figure;
patternCustom(MAgE, theta, phi);% 3D plot in Polar cordinates
%% ----- 2-D Plot of Z-X Plane (Theta) Cut with phi/Azimuth=90, in Polar coordinates -------
figure; % Plot Z-X RP data points (for Y=0, phi=0°) at +X axis (right side)
A= patternCustom(MagE, theta, phi,'CoordinateSystem','polar','Slice','phi','SliceValue',0);
%p = polarpattern('gco');
%P = polarpattern(p,'TitleTop','Polar Pattern of Monopole');
hold on
%figure; % Plot Z-X RP data points (for Y=0, phi=180°) at -X axis (left side)
B=patternCustom(MagE, theta, phi,'CoordinateSystem','polar','Slice','phi','SliceValue',180);
hold off
legend('A', 'B');

Answers (2)

Sharath Maadam
Sharath Maadam on 17 Jun 2021
Code requires a bit of modifications that could serve as a work around for the issue. Modifications include using a property of TitleTop of patternCustom and creating a new legend for the both data labels of the legend.
Here is the code snippet below:
%% --- Get data for Helix type antenna Radiation pattern----
h = helix;
[H,Az,El] = pattern(h,2e9);
theta = 90-El;
phi = Az';
MagE = H';
% Slice for 0 phi
A = patternCustom(MagE, theta, phi,'CoordinateSystem','polar','Slice','phi','SliceValue',0);
hold on;
% Slice for 180 phi
B = patternCustom(MagE, theta, phi,'CoordinateSystem','polar','Slice','phi','SliceValue',180);
% Sets the title
B.TitleTop='Figure for two plots';
hold off
l=legend(gca);l.delete;
% Sets the legend names
legend(gca,'phi=0','phi=180')
Hope this helps

Sharath Maadam
Sharath Maadam on 5 Jun 2024
Updating the answer to work on latest matlab releases.
%% --- Get data for Helix type antenna Radiation pattern----
h = helix;
[H,Az,El] = pattern(h,2e9);
theta = 90-El;
phi = Az';
MagE = H';
% Slice for 0,180 phi
B = patternCustom(MagE, theta, phi,'CoordinateSystem','polar','Slice','phi','SliceValue',[0 180]);
% Sets the title
B.TitleTop='Figure for two plots';
l=legend(gca);l.delete;
% Sets the legend names
legend(gca,'phi=0','phi=180')

Categories

Find more on Pattern Data Integration and Visualization in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!