music.m

来自「经典MUSIC算法谱峰搜索程序」· M 代码 · 共 39 行

M
39
字号
function P = music(Y,M,D,Lambda,Angles,Num)
%MUSIC     Multiple Signal Classification Method for direction finding.
%
%          Usage: P = MUSIC(Y,M,D,Lambda,Angles,Num)
%
%Input parameters:
%
%  Y - M x N matrix, the array output data
%  M - the number of linear array
%  N - the snapshots used in estimation
%  D - the space of each two sensors ( Same as Lambda )
%  Lambda - the wavelength of source signal ( Same as D )
%  Angles - the searching range in degree, For example, 
%           [-20:0.1:20] means search the angle from -20 deg. to 
%           20 deg. with step 0.1
%  Num - the number of sources
%
%Output parameter:
%
%  P - the spatial unified spectrum according to Angles.
%
%Also See : RTMUSIC, BMMUSIC, RBMUSIC
%
%Copyright (c) 1999-2019 by Chen Jianfeng
%         

error(nargchk(nargin,6,6));
R=Y*Y';        %covariance matrix
[V S]=eig(R); 
En=V(:,Num+1:M);  % En is called noise subspace
i=0;
P=zeros(size(Angles));
for ang=Angles
   a=exp(j*2*pi*D/Lambda*sin(ang*pi/180)*[0:M-1]');  
   i=i+1;  
   P(i)=1/abs(a'*En*En'*a); 
end
P=10*log10(P/max(P));
return

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?