www.gusucode.com > phased 案例源码 matlab代码程序 > phased/PowerDirectivityPatternsCustomAntennaExample.m
%% Power and Directivity Patterns of Custom Antenna % Create a custom antenna with a cosine pattern. Show the response at % boresight. Then, plot the antenna's field and directivity patterns. % 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. pattern(sCust,fc,0,[-90:90],... 'CoordinateSystem','rectangular',... 'Type','efield') %% % Plot an elevation cut of the directivity as a line plot, showing that the maximum directivity % is approximately 2 dB. pattern(sCust,fc,0,[-90:90],... 'CoordinateSystem','rectangular',... 'Type','directivity')