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

    %% Received Signal and Direction-of-Arrival Estimation 
% Simulate the received signal at an array, and use the data to estimate
% the arrival directions.   
%%
% *Note:* This example runs only in R2016b or later. If you are using an earlier
% release, replace each call to the function with the equivalent |step|
% syntax. For example, replace |myObject(x)| with |step(myObject,x)|.
%% 
% Create an 8-element uniform linear array whose elements are spaced half
% a wavelength apart. 
fc = 3e8;
c = 3e8;
lambda = c/fc;
array = phased.ULA(8,lambda/2);  

%% 
% Simulate 100 snapshots of the received signal at the array. Assume there
% are two signals, coming from azimuth 30° and 60°, respectively.
% The noise is white across all array elements, and the SNR is 10 dB. 
x = sensorsig(getElementPosition(array)/lambda,...
   100,[30 60],db2pow(-10));  

%% 
% Use a beamscan spatial spectrum estimator to estimate the arrival directions,
% based on the simulated data. 
estimator = phased.BeamscanEstimator('SensorArray',array,...
   'PropagationSpeed',c,'OperatingFrequency',fc,...
   'DOAOutputPort',true,'NumSignals',2);
[~,ang_est] = estimator(x);  

%% 
% Plot the spatial spectrum resulting from the estimation process. 
plotSpectrum(estimator)

%%
% The plot shows peaks at 30° and 60°.