📄 music.m
字号:
%MUSIC ALGORITHM DOA Estimation by ULA
function angle=music(x,d,M)
%%%
%clear all;
%M=11; % number of elements
%d=1; % number of signals
%angle=45;
%f=10e6;
%w=2*pi*f;
%nsample=1000;
%B=exp(j*w*[0:nsample-1]);
%m=-(M-1)/2:(M-1)/2; % the array is central symmetric
%u=exp(j*pi*sin(angle/180*pi)*m);
%x=u.'*B+0.1*(randn(size(u.'*B))+j*randn(size(u.'*B)));
%%%%%%%%%%%%%%%%%%%%%%%%%%
Ruu=x*x';
[U S V]=svd(Ruu);
UU=U(:,d+1:M);
theta=0.1:0.1:90; % the range of angle estimation for ULA
for i = 1:length(theta)
AA=[];
for m=1:M
AA=[AA exp(-j*pi*m*sin(theta(i)/180*pi))]; % steering vector
end
WW=AA*UU*UU'*AA';
Pmusic(i)=abs(1/WW);%角谱
end
Pmusic = 20*log10(Pmusic);
[cc dd]=max(Pmusic);
angle=dd*0.1;
%sita=0.1:0.1:90;
%figure(1)
%plot(sita,Pmusic);
%grid
%xlabel('rad')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -