www.gusucode.com > phased 案例源码 matlab代码程序 > phased/PlotResponseCustomAntennaExample.m

    %% Plot Response and Directivity of Custom Antenna  
% Create a custom antenna with a cosine pattern. Then, plot the antenna's
% response.   

% Copyright 2015 The MathWorks, Inc.


%% 
% Create the antenna and calculate the response. The user-defined pattern
% is omnidirectional in the azimuth direction and has a cosine pattern in
% the elevation direction. Assume the antenna works at 1 GHz. 
fc = 1e9;
sCust = phased.CustomAntennaElement;
sCust.AzimuthAngles = -180:180;
sCust.ElevationAngles = -90:90;
sCust.RadiationPattern = mag2db(repmat(cosd(sCust.ElevationAngles)',...
    1,numel(sCust.AzimuthAngles)));
resp = step(sCust,fc,[0;0]);
%% 
% Plot an elevation cut of the magnitude response as a line plot.
plotResponse(sCust,fc,'RespCut','El','Format','Line','Unit','mag');
%% 
% Plot an elevation cut of the directivity as a line plot, showing that the maximum directivity
% is approximately 2 dB.
plotResponse(sCust,fc,'RespCut','El','Format','Line','Unit','dbi');