www.gusucode.com > phased 案例源码 matlab代码程序 > phased/DirectivityHeterogeneousULAExample.m
%% Directivity of Heterogeneous Uniform Linear Array % Compute the directivity of a 10-element heterogeneous ULA consisting of % cosine antenna elements with different power factors. The two elements at % each end have power values of 1.5 while the inner elements have power % values of 1.8. % Copyright 2015 The MathWorks, Inc. %% % Construct the heterogeneous array. Set the signal frequency to 1 GHz. c = physconst('LightSpeed'); freq = 1e9; ang = [30;0]; lambda = c/freq; %% % Create the cosine antenna elements. myElement1 = phased.CosineAntennaElement; myElement1.CosinePower = 1.5; myElement2 = phased.CosineAntennaElement; myElement2.CosinePower = 1.8; %% % Create the Heterogeneous ULA. myArray = phased.HeterogeneousULA; myArray.ElementSet = {myElement1,myElement2}; myArray.ElementIndices = [1 1 2 2 2 2 2 2 1 1 ]; myArray.ElementSpacing = 0.5*lambda; %% % Create the steering vector and compute the directivity in the % same direction as the steering vector. w = steervec(getElementPosition(myArray)/lambda,ang); d = directivity(myArray,freq,ang,'PropagationSpeed',c,... 'Weights',w)