Add Example

This commit is contained in:
Ksyer
2024-11-11 16:32:53 +08:00
parent a2cb6d1825
commit 29ae9585f9
56 changed files with 4029 additions and 0 deletions
@@ -0,0 +1,43 @@
% echo_r_mtx: range processing echo data
% target_list_RD: target list include range and doppler information
% d: antenna spacing
% fc: carrier frequency
% acc: angle estimation accuracy
% target_list_RDA: target list include range, doppler and angle information
% RA_map: range-angle map
% THETA: scale of angle
function [ target_list_RDA, RA_map, THETA ] = angle_est(echo_r_mtx, target_list_RD, d, fc, acc)
% parameters
if nargin < 5
acc = 181;
end
[lenA, lenR, lenP] = size(echo_r_mtx);
c = 3e8;
lambda = c / fc;
% initialization
echo_mtx = squeeze(echo_r_mtx(:, :, 1));
% CBF
THETA = linspace(-90, 90, round(acc));
RA_map = zeros(length(THETA), lenR);
for i = 1: length(THETA)
a = exp((0: lenA - 1)' * -1j * 2 * pi / lambda * d * sin(THETA(i) / 180 * pi));
RA_map(i, :) = a'* echo_mtx;
end
RA_map = transpose(RA_map);
% calculate angle
range_angle = zeros(1, lenR);
for j = 1: lenR
[v, num] = max(abs(RA_map(j, :)));
range_angle(j) = THETA(num);
end
targets_angle = range_angle(target_list_RD(:, 2));
target_list_RDA = [target_list_RD, transpose(targets_angle)];
end
@@ -0,0 +1,187 @@
% echo_r_mtx: range processing echo data
% sigma_n: input noise standard deviation
% lambda: LASSO weight
% gamma: compressed ratio
% delta: convergence normalized difference
% echo_rd_mtx: range-doppler processing echo data
% stat_RD: range-doppler statistics
function [ echo_rd_mtx, stat_RD ] = doppler_process_CS(echo_r_mtx, sigma_n, lambda, gamma, delta)
% parameters
if nargin < 5
delta = 1e-6;
end
if nargin < 4
gamma = 0.5;
end
[lenA, lenR, M] = size(echo_r_mtx);
N = round(M / gamma);
iter_max_VAMP = 1000;
lambda_v = zeros(N, 1) + lambda;
% generate mtx
F_ori = dftmtx(N);
F = F_ori(1:M,:);
F_inv = conj(F) / N;
% normalization
A = (sqrt(N) * eye(M)) * F_inv;
echo_r_mtx = sqrt(N) .* echo_r_mtx;
sigma_n = sqrt(N) * sigma_n;
% doppler matched filtering
echo_rd_mtx = zeros(lenA, lenR, N);
stat_RD = zeros(lenA, lenR, N);
for numA = 1: lenA
for numR = 1: lenR
sample = squeeze(echo_r_mtx(numA, numR, :));
y = sample;
x_LASSO = cVAMPro(y, A, lambda_v, delta, iter_max_VAMP);
[x_d_CROD, sigma_CROD] = CROD(y, A, x_LASSO, lambda, sigma_n);
stat_RD(numA, numR, :) = abs(fftshift(x_d_CROD) / sigma_CROD).^2;
echo_rd_mtx(numA, numR, :) = fftshift(x_d_CROD);
end
end
end
% algorithm for LASSO
% y: measurements
% A: measurement matrix
% lambda: LASSO weight
% tau: convergence normalized difference
% Kit: maximum number of iterations
% LASSO estimator
function x_hat_wl = cVAMPro(y, A, lambda, tau, Kit)
% Initialization
[M, N] = size(A);
gamma = M / N;
k = 0;
p = ctranspose(A) * y;
h_1 = p;
Q_1 = gamma;
tau_d = 1;
% Iteration
while ((k < Kit) && (tau_d > tau))
% Factorized Part
x_1 = ST(h_1, lambda, Q_1);
chi_1 = F1(x_1, lambda, Q_1);
% Message Passing
h_2 = x_1 / chi_1 - h_1;
Q_2 = 1 / chi_1 - Q_1;
% Gaussian Part
t1 = (p + h_2) / Q_2;
t2 = ctranspose(A) * (A * (p + h_2)) / ((Q_2 + 1) * Q_2);
x_2 = t1 - t2;
chi_2 = gamma / (Q_2 + 1) + (1 - gamma) / Q_2;
% Message Passing
h_1_next = x_2 ./ chi_2 - h_2;
Q_1_next = 1 / chi_2 - Q_2;
tau_d = norm(h_1_next - h_1, Inf) / norm(h_1_next, Inf);
k = k + 1;
% output
x_hat_wl = x_1;
% next
h_1 = h_1_next;
Q_1 = Q_1_next;
end
end
% soft threshold function
% x: processing object
% thd: threshold
% y: result
function x = ST(h_1, lambda, Q_1)
[N, M] = size(h_1);
x = zeros(N, M);
for i = 1:N
sign = h_1(i) ./ abs(h_1(i));
diff = abs(h_1(i)) - lambda(i);
x(i) = sign .* (diff ./ Q_1) .* SF(diff);
end
end
% Heaviside's step function
function v = SF(a)
if a > 0
v = 1;
elseif a == 0
v = 0; % at zero points
else
v = 0;
end
end
% Calculation of chi_1
function chi_1 = F1(x_1, lambda, Q_1)
[N, M] = size(x_1);
count = 0;
for i = 1:N
temp = Q_1 * abs(x_1(i)) + lambda(i);
count = count + (2 - lambda(i) / temp) * SF(abs(x_1(i)));
% count = count + (2-lambda(i)/temp) * (abs(x_1(i)) > 1e-4);
end
chi_1 = count / (2 * N * Q_1);
end
% calculate debiased LASSO estimator
% y: measurements
% A: measurement matrix
% x_LASSO: LASSO estimator
% lambda: LASSO weight
% sigma_n: input noise standard deviation
% x_d_CROD: debiased LASSO estimator
% sigma_CROD: equivalent noise standard deviation estimator
function [ x_d_CROD, sigma_CROD ] = CROD(y, A, x_LASSO, lambda, sigma_n)
[m, n] = size(A);
gamma = m / n;
rho_active = sum(abs(x_LASSO) > 1e-3)/n;
Q_hat = (gamma - rho_active)/(1 - rho_active);
Rho = sum((abs(x_LASSO) > 1e-3).* (2 - lambda./(Q_hat*abs(x_LASSO) + lambda))) / 2 / n;
diff = 1;
while(diff > 1e-4)
Rho_pre = Rho;
Rho = sum((abs(x_LASSO) > 1e-3).* (2 - lambda./((gamma-Rho)/(1-Rho)*abs(x_LASSO) + lambda))) / 2 / n;
diff = abs(Rho - Rho_pre);
end
Q_hat = (gamma-Rho)/(1-Rho);
x_d_CROD = x_LASSO + A'*(y - A*x_LASSO)/Q_hat;
RSS = sum(abs(y - A * x_LASSO).^2)/m;
chi = Rho*(1 - Rho)/(gamma - Rho);
if chi ~= 0
chi_temp = sqrt((chi+1)*(chi+1)-4*gamma*chi);
z = -(1 - chi + chi_temp) / (2*chi);
z_prime = -(1 - 2*gamma*chi + chi + chi_temp) / (2*chi*chi*chi_temp);
G_prime = (z + 1/chi);
G_wprime = (z_prime + 1/chi/chi);
chi_hat = gamma/2*G_wprime*RSS/(G_prime - chi*G_wprime)...
+ (G_prime*G_prime/2 - gamma/2*G_wprime)*sigma_n*sigma_n/(G_prime - chi*G_wprime);
else
G_prime = gamma;
G_wprime = gamma*(1-gamma);
chi_hat = gamma/2*G_wprime*RSS/(G_prime - chi*G_wprime)...
+ (G_prime*G_prime/2 - gamma/2*G_wprime)*sigma_n*sigma_n/(G_prime - chi*G_wprime);
end
sigma_CROD = sqrt(2*chi_hat) / Q_hat;
end
@@ -0,0 +1,38 @@
% echo_r_mtx: range processing echo data
% sigma_n: input noise standard deviation
% gamma: compressed ratio
% echo_rd_mtx: range-doppler processing echo data
% stat_RD: range-doppler statistics
function [ echo_rd_mtx, stat_RD ] = doppler_process_MF(echo_r_mtx, sigma_n, gamma)
% parameters
if nargin < 3
gamma = 0.5;
end
[lenA, lenR, M] = size(echo_r_mtx);
N = round(M / gamma);
% generate mtx
F_ori = dftmtx(N);
F = F_ori(1:M,:);
multiple_d = F(:,1)' * F(:,1);
% doppler matched filtering
echo_rd_mtx = zeros(lenA, lenR, N);
for numA = 1: lenA
for numR = 1: lenR
sample = squeeze(echo_r_mtx(numA, numR, :));
dpl_temp = transpose(F) * sample;
dpl_norm = fftshift(dpl_temp ./ multiple_d);
echo_rd_mtx(numA, numR, :) = dpl_norm;
end
end
% calculate output noise
sigma_n_o = sqrt(sigma_n^2 / multiple_d);
stat_RD = abs(echo_rd_mtx ./ sigma_n_o).^2;
end
@@ -0,0 +1,21 @@
% target_list_RDA: target list, including range, doppler and angle information
% stat_RD: range-doppler statistics
% target_map: show targets information
function [ target_map ] = draw_target_map(target_list_RDA, stat_RD)
% initialization
target_map = ones(size(stat_RD)) .* -300;
t_map = target_list_RDA(:, 1);
t_R = target_list_RDA(:, 2);
t_D = target_list_RDA(:, 3);
t_A = target_list_RDA(:, 4);
% draw_map
for i = 1: size(target_list_RDA, 1)
target_map(t_map(i), t_R(i), t_D(i)) = t_A(i);
end
end
@@ -0,0 +1,72 @@
% PRF: pulse repetition frequency
% B: bandwidth
% fs: sampling rate
% D: duty ratio
% gamma: compression ratio
% A: chirp matrix
% signal_t: transmitting beam
function [ A, signal_t ] = generate_chirp_mtx(PRF, B, fs, D, gamma, sign_mid)
% parameters
if nargin < 5
gamma = 0.5;
end
if nargin < 6
sign_mid = 0;
end
Tr = 1 / PRF;
Tp = Tr * D;
K = B / Tp;
% generate_signal
N = Tr * fs;
N_high = Tp * fs;
N_mtx = round(N / gamma);
signal_t = zeros(1, N);
for i = 1: N_high
tp = i * (1 / fs) - sign_mid * N_high / fs / 2;
signal_t(1, i) = exp(1j * 2 * pi * 0.5 * K * tp .^ 2);
end
signal_t_2fs = zeros(1, N_mtx);
for i = 1: round(N_high / gamma)
tp = (i+1) * (1 / fs / 2) - sign_mid * N_high / fs / 2;
signal_t_2fs(1, i) = exp(1j * pi * K * tp .^ 2);
end
% generate chirp matrix
A = generate_matrix_by_signal2fs(transpose(signal_t_2fs));
end
% generate chirp matrix when gamma=0.5
function [ mtx ] = generate_matrix_by_signal2fs(signal)
mtx = [];
l = round(length(signal) / 2);
temp1 = signal(1:2:end);
temp2 = circshift(signal(2:2:end), 1);
if length(temp2) ~= length(temp1)
temp2 = [temp2; 0];
end
for i = 1:l
t1 = circshift(temp1, i-1);
t2 = circshift(temp2, i-1);
if i - 1 > 0
t1(1:i - 1,1) = 0;
end
if i - 1 > 0
t2(1:i - 1,1) = 0;
end
mtx = [mtx,t1,t2];
end
end
@@ -0,0 +1,29 @@
% PRF: pulse repetition frequency
% fs: sampling rate
% fc: carrier frequency
% numP: number of pulses
% gamma_r: range compression ratio
% gamma_d: doppler compression ratio
% distance_v: real distance value
% speed_v: real speed value
function [distance_v, speed_v] = get_range_speed_val(PRF, fs, fc, numP, gamma_r, gamma_d)
% parameters
if nargin < 6
gamma_d = 0.5;
end
if nargin < 5
gamma_r = 0.5;
end
c = 3e8;
Tr = 1 / PRF;
lambda = c / fc;
% calculate
distance_v = 0: (c / fs / 2 * gamma_r) : (Tr * c / 2 - c / fs / 2 * gamma_r);
speed_v = -(-PRF / 2: PRF / numP * gamma_d: PRF / 2 - PRF / numP * gamma_d) * lambda / 2 ;
end
@@ -0,0 +1,84 @@
clc
clear
close all
%% load echo data
filename = 'Raw_Echo_60dB';
load(['./data/', filename, '.mat']);
%% parameters
% ladar
PRF = 5000;
B = 5e6;
D = 0.1;
Tp = 2e-5;
fs = 5e6;
fc = 1.25e9;
% antenna
num_antenna = 18;
d = 0.12;
% echo
num_pulse = 64;
sigma_n = 0.1;
% detect
P_fa = 1e-5;
% algorithm
gamma_r = 0.5;
gamma_d = 0.5;
lambda_r = 0.005;
lambda_d = 0.15;
%% data processing
fprintf(['File: ', filename, '\n']);
[distance_v, speed_v] = get_range_speed_val(PRF, fs, fc, num_pulse, gamma_r, gamma_d);
[A, signal_t] = generate_chirp_mtx(PRF, B, fs, D);
fprintf(' 1: generate_chirp_mtx done.\n');
% first antenna
Raw_Echo_antenna1 = Raw_Echo(1, :, :);
[echo_r_mtx_cs_antenna1, sigma_n_o_cs_antenna1] = range_process_CS(Raw_Echo_antenna1, A, sigma_n, lambda_r);
fprintf(' 2: first antenna range_process_CS done.\n');
% first pulse
Raw_Echo_pulse1 = Raw_Echo(:, :, 1);
[echo_r_mtx_cs_pulse1, sigma_n_o_cs_pulse1] = range_process_CS(Raw_Echo_pulse1, A, sigma_n, lambda_r);
fprintf(' 3: first pulse range_process_CS done.\n');
[echo_rd_mtx_cs, stat_RD_cs] = doppler_process_CS(echo_r_mtx_cs_antenna1, sigma_n_o_cs_antenna1, lambda_d, gamma_d);
fprintf(' 4: doppler_process_CS done.\n');
[target_list_RD_cs, target_map_cs] = rd_detection(stat_RD_cs, P_fa);
fprintf(' 5: rd_detection done.\n');
[target_list_RDA, RA_map] = angle_est(echo_r_mtx_cs_pulse1, target_list_RD_cs, d, fc);
fprintf(' 6: angle_est done.\n');
%% show result
element = 1;
list_r_idx = find(target_list_RDA(:, 1) == element);
target_list_RDA(:, 2) = distance_v(target_list_RDA(:, 2));
target_list_RDA(:, 3) = speed_v(target_list_RDA(:, 3));
figure(1)
scatter3(target_list_RDA(list_r_idx,2), target_list_RDA(list_r_idx,3),...
target_list_RDA(list_r_idx,4), 'filled', 'o')
% xlim([17000, 19000])
% ylim([80, 160])
% zlim([-90, 90])
%% save
echo_rd_mtx = echo_rd_mtx_cs;
save(['./output/', filename, '_cs_part.mat'],...
'target_list_RDA', 'echo_rd_mtx', 'RA_map', 'P_fa');
+67
View File
@@ -0,0 +1,67 @@
clc
clear
close all
%% load echo data
filename = 'Raw_Echo_60dB';
load(['./data/', filename, '.mat']);
%% parameters
% ladar
PRF = 5000;
B = 5e6;
D = 0.1;
Tp = 2e-5;
fs = 5e6;
fc = 1.25e9;
% antenna
num_antenna = 18;
d = 0.12;
% echo
num_pulse = 64;
sigma_n = 0.1;
% detect
P_fa = 1e-4;
% algorithm
gamma_r = 0.5;
gamma_d = 0.5;
%% data processing
[distance_v, speed_v] = get_range_speed_val(PRF, fs, fc, num_pulse, gamma_r, gamma_d);
[A, signal_t] = generate_chirp_mtx(PRF, B, fs, D);
[echo_r_mtx_mf, sigma_n_o_mf] = range_process_MF(Raw_Echo, A, sigma_n);
[echo_rd_mtx_mf, stat_RD_mf] = doppler_process_MF(echo_r_mtx_mf, sigma_n_o_mf, gamma_d);
[target_list_RD_mf, target_map_mf] = rd_detection(stat_RD_mf, P_fa);
[target_list_RDA, RA_map] = angle_est(echo_r_mtx_mf, target_list_RD_mf, d, fc);
%% show result
element = 1;
list_r_idx = find(target_list_RDA(:, 1) == element);
target_list_RDA(:, 2) = distance_v(target_list_RDA(:, 2));
target_list_RDA(:, 3) = speed_v(target_list_RDA(:, 3));
figure(1)
scatter3(target_list_RDA(list_r_idx,2), target_list_RDA(list_r_idx,3),...
target_list_RDA(list_r_idx,4), 'filled', 'o')
% xlim([17000, 19000])
% ylim([80, 160])
% zlim([-90, 90])
%% save
echo_rd_mtx = echo_rd_mtx_mf;
save(['./output/', filename, '_mf.mat'],...
'target_list_RDA', 'echo_rd_mtx', 'RA_map', 'P_fa');
@@ -0,0 +1,73 @@
clc
clear
close all
%% load echo data
filename = 'Raw_Echo_60dB';
load(['./data/', filename, '.mat']);
%% parameters
% ladar
PRF = 5000;
B = 5e6;
D = 0.1;
Tp = 2e-5;
fs = 5e6;
fc = 1.25e9;
% antenna
num_antenna = 18;
d = 0.12;
% echo
num_pulse = 64;
sigma_n = 0.1;
% detect
P_fa = 1e-4;
% algorithm
gamma_r = 0.5;
gamma_d = 0.5;
%% data processing
[distance_v, speed_v] = get_range_speed_val(PRF, fs, fc, num_pulse, gamma_r, gamma_d);
[A, signal_t] = generate_chirp_mtx(PRF, B, fs, D);
% first antenna
Raw_Echo_antenna1 = Raw_Echo(1, :, :);
[echo_r_mtx_mf_antenna1, sigma_n_o_mf_antenna1] = range_process_MF(Raw_Echo_antenna1, A, sigma_n);
% first pulse
Raw_Echo_pulse1 = Raw_Echo(:, :, 1);
[echo_r_mtx_mf_pulse1, sigma_n_o_mf_pulse1] = range_process_MF(Raw_Echo_pulse1, A, sigma_n);
[echo_rd_mtx_mf, stat_RD_mf] = doppler_process_MF(echo_r_mtx_mf_antenna1, sigma_n_o_mf_antenna1, gamma_d);
[target_list_RD_mf, target_map_mf] = rd_detection(stat_RD_mf, P_fa);
[target_list_RDA, RA_map] = angle_est(echo_r_mtx_mf_pulse1, target_list_RD_mf, d, fc);
%% show result
element = 1;
list_r_idx = find(target_list_RDA(:, 1) == element);
target_list_RDA(:, 2) = distance_v(target_list_RDA(:, 2));
target_list_RDA(:, 3) = speed_v(target_list_RDA(:, 3));
figure(2)
scatter3(target_list_RDA(list_r_idx,2), target_list_RDA(list_r_idx,3),...
target_list_RDA(list_r_idx,4), 'filled', 'o')
% xlim([17000, 19000])
% ylim([80, 160])
% zlim([-90, 90])
%% save
echo_rd_mtx = echo_rd_mtx_mf;
save(['./output/', filename, '_mf_part.mat'],...
'target_list_RDA', 'echo_rd_mtx', 'RA_map', 'P_fa');
@@ -0,0 +1,47 @@
clc
clear
close all
Fontsize = 18;
plot_width = 800;
plot_height = 600;
Linewidth = 2;
Markersize = 8;
Pfa_set = '1e-4';
method = 'cs';
if_part = 1;
SNR = 10;
if if_part == 1
filename = ['Raw_Echo_', num2str(SNR), 'dB_', method, '_part'];
else
filename = ['Raw_Echo_', num2str(SNR), 'dB_', method];
end
load(['./output/Pfa', Pfa_set, '/', filename, '.mat']);
%%
element = 1;
list_r_idx = find(target_list_RDA(:, 1) == element);
figure(1)
scatter3(target_list_RDA(list_r_idx,2), target_list_RDA(list_r_idx,3),...
target_list_RDA(list_r_idx,4), 'filled', 'o')
xlabel('Range(m)');
ylabel('Speed(m/s)');
zlabel('Angle(°)');
zlim([-90, 90]);
ylim([80, 160]);
xlim([17000, 21000]);
set(gca, 'FontSize', Fontsize);
title(['Target detected by ', upper(method), ' under Pfa=', Pfa_set])
set(gcf, 'position', [100, 200, plot_width+100, plot_height+50]);
set(gca,'fontsize',18,'fontname','Times');
@@ -0,0 +1,146 @@
% echo_mtx: echo data
% A: chirp matrix
% sigma_n: input noise standard deviation
% lambda: LASSO weight
% delta: convergence normalized difference
% echo_r_mtx: range processing echo data
% signal_n_o: output noise standard deviation
function [ echo_r_mtx, sigma_n_o ] = range_process_CS(echo_mtx, A, sigma_n, lambda, delta)
% parameters
if nargin < 5
delta = 2e-7;
end
[M, N] = size(A);
[lenA, M, lenP] = size(echo_mtx);
% normalization
J1 = A*A';
lambda_J=eig(J1);
A = A / sqrt(lambda_J(end));
echo_mtx = echo_mtx ./ sqrt(lambda_J(end));
sigma_n = sigma_n / sqrt(lambda_J(end));
% compressed sensing
echo_r_mtx = zeros(lenA, N, lenP);
for numA = 1: lenA
for numP = 1: lenP
sr = echo_mtx(numA, :, numP);
y = transpose(sr);
% LASSO
x_FISTA = FISTA(y, A, lambda, delta);
% debiased LASSO
[x_d, sigma_w] = cal_debiased_LASSO(x_FISTA, A, y, lambda, sigma_n);
echo_r_mtx(numA, :, numP) = x_d;
end
end
% calculate output noise
sigma_n_o = sigma_w;
end
% algorithm for LASSO
% y: measurements
% A: measurement matrix
% lambda: LASSO weight
% delta: convergence normalized difference
% z: LASSO estimator
function [z] = FISTA(y, A, lambda, delta)
x_pre = A'*y;
t = 1;
z = x_pre;
z_pre = z;
t_pre = t;
N = size(A, 2);
diff = 1;
E = eig(A'*A);
L = E(end);
temp1 = A'*y/L;
temp2 = eye(N) - A'*A/L;
k = 0;
while((diff > delta) && (k < 1000))
temp = temp1 + temp2 * z_pre;
x = sft_thd(temp, lambda/L);
t = 0.5*(1 + sqrt(1+4*t_pre*t_pre));
z = x + (x - x_pre) * (t_pre-1) / t;
diff = mean(abs(z_pre - z));
x_pre = x;
z_pre = z;
t_pre = t;
k = k + 1;
end
end
% soft threshold function
% x: processing object
% thd: threshold
% y: result
function y = sft_thd(x, thd)
if isequal(size(x), size(thd))
tmp = abs(x);
y = x;
y(tmp <= thd) = 0;
y(tmp > thd) = (tmp(tmp > thd) - thd(tmp > thd)) .* x(tmp > thd) ./ tmp(tmp > thd);
else
tmp = abs(x);
y = x;
y(tmp <= thd) = 0;
y(tmp > thd) = (tmp(tmp > thd) - thd) .* x(tmp > thd) ./ tmp(tmp > thd);
end
end
% calculate debiased LASSO estimator
% x: LASSO estimator
% A: measurement matrix
% y: measurements
% lambda: LASSO weight
% sigma_n: input noise standard deviation
% x_d: debiased LASSO estimator
% sigma_d: equivalent noise standard deviation
function [x_d, sigma_d] = cal_debiased_LASSO(x, A, y, lambda, sigma)
[M, N] = size(A);
gamma = M/N;
hat_Q1 = gamma;
[~, D] = eig(A'*A);
d = diag(D);
diff = 1;
T = 1000;
t = 0;
while (t < T) && (diff > 1e-6)
Q1_pre = hat_Q1;
rho = mean((2 - lambda./(hat_Q1*abs(x) + lambda)).*(abs(x) > 1e-4))/2;
hat_Q1 = rho/mean(1./(d + (1-rho)*hat_Q1/rho));
diff = abs(Q1_pre - hat_Q1);
t = t+1;
end
x_d = x + 1/hat_Q1*A'*(y - A*x);
chi = rho/hat_Q1;
hat_Q2 = 1/chi - hat_Q1;
t = -hat_Q2;
t_prime = -1/mean((1./(d+hat_Q2)).^2);
G_prime = t + 1/chi;
G_wprime = t_prime + 1/chi/chi;
RSS = sum(abs(y - A*x).^2)/M;
hat_chi = gamma*G_wprime/(2*G_prime-2*chi*G_wprime)*RSS +...
(-G_wprime*gamma+G_prime*G_prime)/(2*G_prime-2*chi*G_wprime)*sigma^2;
sigma_d = sqrt(2*hat_chi)/hat_Q1;
end
@@ -0,0 +1,30 @@
% echo_mtx: echo data
% A: chirp matrix
% sigma_n: input noise standard deviation
% echo_r_mtx: range processing echo data
% signal_n_o: output noise standard deviation
function [ echo_r_mtx, sigma_n_o ] = range_process_MF(echo_mtx, A, sigma_n)
% parameters
multiple_r = A(:, 1)' * A(:, 1);
[M, N] = size(A);
[lenA, M, lenP] = size(echo_mtx);
% matched filtering
echo_r_mtx = zeros(lenA, N, lenP);
for numA = 1: lenA
for numP = 1: lenP
sr = echo_mtx(numA, :, numP);
mf_res = A' * transpose(sr);
mf_norm = mf_res ./ multiple_r;
echo_r_mtx(numA, :, numP) = mf_norm;
end
end
% calculate output noise
sigma_n_o = sqrt(sigma_n^2 / multiple_r);
end
@@ -0,0 +1,32 @@
% stat_RD: range-doppler statistics
% P_fa: false alarm rate
% target_map: show targets in RD map
% target list include range and doppler information
function [ target_list_RD, target_map ] = rd_detection(stat_RD, P_fa)
% parameters
target_map = zeros(size(stat_RD));
[lenA, lenR, lenP] = size(stat_RD);
% detection threshold
d_thd = chi2inv(1 - P_fa, 2) / 2;
% find target
target_list_RD = [];
for i = 1: lenA
RD_map = squeeze(stat_RD(i, :, :));
detect_map = zeros(size(RD_map));
detect_map(RD_map > d_thd) = 1;
target_map(i, :, :) = detect_map;
[r, c] = find(detect_map);
temp_list = zeros(length(r), 3);
temp_list(:, 1) = i;
temp_list(:, 2) = r;
temp_list(:, 3) = c;
target_list_RD = [target_list_RD; temp_list];
end
end