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

    %% Estimate DOAs of Two Signals
% Assume that two sinusoidal waves of frequencies 450 Hz and 600 Hz strike
% a URA from two different directions. Signals arrive from -37°
% azimuth, 0° elevation and 17° azimuth, 20° elevation. Use
% 2-D MUSIC to estimate the directions of arrival of the two signals. The array
% operating frequency is 150 MHz and the signal sampling frequency is 8
% kHz.

f1 = 450.0;
f2 = 600.0;
doa1 = [-37;0];
doa2 = [17;20];
fc = 150e6;
c = physconst('LightSpeed');
lam = c/fc;
fs = 8000;
%%
% Create the URA with default isotropic elements. Set the frequency
% response range of the elements.
array = phased.URA('Size',[11 11],'ElementSpacing',[lam/2 lam/2]);
array.Element.FrequencyRange = [50.0e6 500.0e6];
%%
% Create the two signals and add random noise.
t = (0:1/fs:1).';
x1 = cos(2*pi*t*f1);
x2 = cos(2*pi*t*f2);
x = collectPlaneWave(array,[x1 x2],[doa1,doa2],fc);
noise = 0.1*(randn(size(x))+1i*randn(size(x)));
%%
% Create and execute the 2-D MUSIC estimator to find the directions of
% arrival.
estimator = phased.MUSICEstimator2D('SensorArray',array,...
    'OperatingFrequency',fc,...
    'NumSignalsSource','Property',...
    'DOAOutputPort',true,'NumSignals',2,...
    'AzimuthScanAngles',-50:.5:50,...
    'ElevationScanAngles',-30:.5:30);
[~,doas] = estimator(x + noise)
%%
% The estimated DOAs exactly match the true DOAs.
%%
% Plot the 2-D spatial spectrum
plotSpectrum(estimator);