clear all
close all
clc
M = 16;
N = 1024;
n = 0:(N-1);
f0 = 77E9;
c = 3E8;
lambda = c/f0;
d = lambda/2;
SignalIn = zeros(M,N);
%% 构造噪声
noise = ((randn(M,N) + 1i*randn(M,N)))/sqrt(2);
R_noise = noise*(noise')/N;
%% 构造非相干信号
Theta_u = [10 20];
SNR_u = [0,0];
w_u = [0 0];
Amp_u = 10.^(SNR_u / 20);
R_u = zeros(M,M);
for ii = 1:length(Theta_u)
a = exp(1j*2*pi*d/lambda*(0:M-1).'*sind(Theta_u(ii)));
s = exp(1j*w_u(ii)*(0:N-1))*exp(1j*2*pi*rand);
x = a*s;
R_u = R_u + x*(x')/N;
end
%% 构造相干信号
Theta_c = [10 20];
rou = [1 1]; %相干度
SNR_c = [10 10];
w_c = 0; % 信号相干,假定信号频率是相同的
Amp_u = 10.^(SNR_c / 20);
x_c = zeros(M,N);
for ii = 1:length(Theta_c)
a_c = rou(ii) * exp(1j*2*pi*d/lambda*(0:M-1).'*sind(Theta_c(ii)));
s_c = exp(1j*w_c*(0:N-1))*exp(1j*2*pi*rand);
x_c = x_c + a_c*s_c;
end
R_c = x_c*(x_c')/N;
%% 加噪声
R = R_u + R_noise;
%% FFTEst_Func(SignalRe,ThetaSet,d,lambda)
ThetaSet = -90:1:90;
SignalRe = x_c(:,20);
ObjEst_FFT_u = FFTEst_Func(SignalRe,ThetaSet,d,lambda);
%% MVDR_R_Func(R,ThetaSet,d,lambda)
ThetaSet = -90:1:90;
ObjEst_MVDR_u = MVDR_R_Func(R_u+R_noise,ThetaSet,d,lambda);
ObjEst_MVDR_c = MVDR_R_Func(R_c+R_noise,ThetaSet,d,lambda);
figure
plot(ObjEst_MVDR_u.Theta,ObjEst_MVDR_u.Amp,'color','r','linewidth',1.5,'linestyle','-');
grid on;title('非相干信号 MVDR DOA估计');
xlabel('\theta '); ylabel('P_{MVDR}(\theta)');
figure
plot(ObjEst_MVDR_c.Theta,ObjEst_MVDR_c.Amp,'color','k','linewidth',1.5,'linestyle','-');
grid on;title('相干信号 MVDR DOA估计');xlabel('\theta '); ylabel('P_{MVDR}(\theta)');
figure
plot(ObjEst_FFT_u.Theta,ObjEst_FFT_u.Amp,'color','b','linewidth',1.5,'linestyle','-');
title('空间FFT DOA估计 ');grid on
xlabel('\theta '); ylabel('P_{FFT}(\theta)');