⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 music.m

📁 matlab code to calculate the MUSIC algorithm(DOA algorithm)
💻 M
字号:
function MUSIC(sig,arrayele,direction,amp,rad,dcon)
M=sig;
L=arrayele;
dirtheta=direction;

%//  Calculating the distorted angle for each direction inputted by the user //

for ij=1:length(direction)
dirtheta1(ij)=prop1(rad,dirtheta(ij),dcon);
end

%//  If the number of source(s) is 1 then use the algorithm MMSE else MUSIC //

if (sig==1)
    MMSE(L,0.5,dirtheta1(ij),dirtheta1(ij)-10,dirtheta1(ij)+5);
else
s=amp;
dir=dirtheta1*pi./180;
s=s';
lam=5;
k=2*pi/lam;
d=lam/2;
A(L,M)=0;
ii=1;
    while ii<=M
         theta=dir(1,ii);
m=0:L-1;
a=exp(-j*k*d*m*sin(theta));
A(1:end,ii)=a';
ii=ii+1;
    end
PS=s*s';
jj=1;
while jj<=M
S(jj,jj)=PS(jj,jj);
jj=jj+1;
     end
sigma_n=1;
R=A*S*A'+sigma_n*eye(L,L);
[V,D]=eig(R);
Un=V(1:end,(M+1):end);
the=-pi/2;hh=1;
     while the<=pi/2
m=0:L-1;
aa=exp(-j*k*d*m*sin(the));
aa=aa';
P(1,hh)=1/(aa'*Un*Un'*aa);
hh=hh+1;
the=the+.01;
end
for i=1:length(direction)
    disp(strcat('The Virtual Direction of Source- ',i+48,' is' ));
    disp(dirtheta1(i));
end
the=(-pi/2:.01:pi/2)*180/pi;
figure(2);
plot(the,10*log(abs(P)));
grid on;
xlabel('angle(deg)');
ylabel('power(db)');
title('MUSIC METHOD');
return;
end

⌨️ 快捷键说明

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