clc;
clear all;
close all;
%% ture DOD and DOA
DOD = [-40 -20 20 20];
DOA = [ 30 -50 40 -50];
% DOD = [-40 30 20];
% DOA = [ 30 30 50];
DOD_DOA = DOD + 1i * DOA; % the ture location
%% parameters
SNR = 0;
Mt = 3; % transmitting array
Mr = 3; % recieving array
K = length(DOA); % mumber of targets
Num_of_pulse = 100; % the number of independent pulses
T = 512; % the code length per pulse
%% randomly generating the reflection coefficient of each target
Beta = zeros(Num_of_pulse,K); % the RCS of targets in different pulses
std_beta = sqrt(0.5 + 0.5 * rand(1,K)); % the standard deviation of RCS
for k = 1 : K
Beta(:,k) = std_beta(k) * (randn(Num_of_pulse,1) + 1i * randn(Num_of_pulse,1)) / sqrt(2); % the RCS of the targets (maybe complex valued)
end
%% the transmitted waveforms
H = hadamard(T);
S = (1 + 1i)/sqrt(2) * H(1:Mt,:); % orthogonal transmiting signals
%% the recieved data and matched filtering
theta = DOD * pi / 180; % converting to radians
A_theta = exp(1i * pi * [0:1:Mt-1]' * sin(theta)); % half wavelength is assumed
phi = DOA * pi / 180; % converting to radians
B_phi = exp(1i * pi * [0:1:Mr-1]' * sin(phi)); % half wavelength is assumed
R = zeros(Mr,Mt,Num_of_pulse);
for n = 1 : Num_of_pulse
beta = Beta(n,:);
Xn = B_phi * diag(beta) * conj(A_theta') * S;
% --------------- Receiver Noise Mode----------------
% sigma = sqrt(mean(var(Xn.'))) * 10^(-SNR/20); % std of the noise
% Noise = sigma * (randn(size(Xn)) + 1i * randn(size(Xn))) / sqrt(2); % sensor noise
% Yn = Xn + Noise;
% R(:,:,n) = Yn * S'/T; % matched data
% ---------------------------------------------------
% --------------- Matched Noise Mode-----------------
sigma = sqrt(mean(std_beta.^2)) * 10^(-SNR / 20); % std of the noise
Noise = sigma * (randn(Mr,Mt)+1i*randn(Mr,Mt)) / sqrt(2); % matched noise
R(:,:,n) = Xn * S'/T + Noise; % noisy matched data
% ---------------------------------------------------
end
%% Localization
DOD_DOA_init = DOD_DOA + 20 * (randn(size(DOD_DOA)) + 1i * randn(size(DOD_DOA)));
[DOD_DOA_est] = xiugai_AAJD(R,DOD_DOA_init);
DOD_est = real(DOD_DOA_est);
DOA_est = imag(DOD_DOA_est);
%% sort the estimated targets for comparison with the true targets
% note that the true DOD of target are sorted in ascending order
[ig, index_order] = sort(DOD_est(end,:),'ascend');
DOD_est = DOD_est(:,index_order);
DOA_est = DOA_est(:,index_order);
% Plot the trajectory of each target
figure(1);
for k = 1 : K
plot(DOD_est(1,k),DOA_est(1,k),'ko',DOD_est(end,k),DOA_est(end,k),'k*',DOD(k),DOA(k),'ks',DOD_est(:,k),DOA_est(:,k),'k:','LineWidth',2,'MarkerSize',10);
hold on;
end
legend('初始角度','估计角度','真实角度','估计轨迹');
xlabel('DOD (°)');
ylabel('DOA (°)');
set(1,'position',[100 300 560 420]);
h1=xlabel('DOD (°)');
h2=ylabel('DOA (°)');
h3=legend('初始角度','估计角度','真实角度','估计轨迹');
set(h1,'FontSize',14)
set(h2,'FontSize',14)
set(h3,'FontSize',14)
% grid on;
%% plot the transient behavior of angle estimation for each target
% t = [1 : Num_of_pulse]';
% for k = 1 : K
% figure(k+1);
% [hAx,hLine1,hLine2] = plotyy([t t],[DOD_est(:,k) DOD(k)*ones(size(t))],[t t],[DOA_est(:,k) DOA(k)*ones(size(t))]);
% xlabel('transmitted pulses');
% ylabel(hAx(1),'DOD (degree)') % left y-axis
% ylabel(hAx(2),'DOA (degree)') % right y-axis
% legend('estimated DOD','true DOD','estimated DOA','true DOA');
% %set(k+1,'position',[300 300 640 480]);
% end
- 1
- 2
前往页