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

    %% Directivity of Replicated Subarray
% Compute the directivity of an array
% built up from ULA subarrays. Determine the directivity of
% the replicated subarray when the array is steered to towards
% 30 degrees azimuth.

% Copyright 2015 The MathWorks, Inc.


%%
% Set the signal propagation speed to the speed of light. Set the signal
% frequency to 300 MHz.
c = physconst('LightSpeed');
fc = 3e8;
lambda = c/fc;
%%
% Create a 4-element ULA of isotropic antenna elements spaced
% 0.4-wavelength apart.
myArray = phased.ULA;
myArray.NumElements = 4;
myArray.ElementSpacing = 0.4*lambda;

%%
% Construct a 2-by-1 replicated subarray.
myRepArray = phased.ReplicatedSubarray;
myRepArray.Subarray = myArray;
myRepArray.Layout = 'Rectangular';
myRepArray.GridSize = [2 1];
myRepArray.GridSpacing = 'Auto';
myRepArray.SubarraySteering = 'Time';

%%
% Steer the array to 30 degrees azimuth and zero degrees elevation.
ang = [30;0];
mySV = phased.SteeringVector;
mySV.SensorArray = myRepArray;
mySV.PropagationSpeed = c;

%%
% Find the directivity at 30 degrees azimuth.
d = directivity(myRepArray,fc,ang,...
    'PropagationSpeed',c,...
    'Weights',step(mySV,fc,ang),...
    'SteerAngle',ang)