close all;clear all;
M=10;%接收器个数
DOA=[0 20 40];%信号角度
snr=10;
SNR=10^(snr/20);
K=length(DOA);%信源个数
N=500;%快拍数
A=exp(1j*pi*(0:(M-1))'*sin(DOA*pi/180));%M*K
S1=(randn(K,N)+j*randn(K,N))/sqrt(2);%K*N
nt=(randn(M,N)+j*randn(M,N))/sqrt(2);%M*N
n=linspace(SNR,SNR,K);
S=diag(n,0)*S1;
X=A*S+nt;%M*N
R=X*X'*1/N;%M*M
th1=[-90:1:90];
l=length(th1);
P1=10*log(Beaformer(R,M,l));
P2=10*log(MVDR_1(R,l,M));
P3=10*log(MUSIC_1(R,K,M,l));
theta=ESPRIT_1(R,M,K)
DOA=root_1(R,K,M)
theta1=eee(R,S,A)
P1=P1-min(real(P1));
P2=P2-min(real(P2));
P3=P3-min(real(P3));
plot(th1,real(P1),'-r',th1,real(P2),'b-',th1,real(P3),'m-')
h=legend('P_Beamformer','P_MVDR','P_MUSIC');
legend('Location','NorthWestOutside');
xlabel('DOA');
ylabel('Spectrum(dB)');
评论2