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
+60
View File
@@ -0,0 +1,60 @@
function [ target_list_RDA ] = angle_estimation(target_list_RDA_temp, echo_mtx, A, d, lambda, acc)
% This function estimates all targets angle
%
% Usage:
% [target_list_RDA] = angle_estimation(target_list_RDA_temp, echo_mtx, A, d, lambda, acc)
%
% Inputs:
% target_list_RDA_temp: Temporary list of targets before angle estimation
% echo_mtx: Original echo data matrix
% A: Chirp measurement matrix
% d: Antenna spacing
% lambda: Wave length
% acc: Accuracy for angle estimation
%
% Outputs:
% target_list_RDA: Target list include range, doppler and angle information
% parameters
if nargin < 6
acc = 181;
end
% calculate all targets angle
target_list_RDA = zeros(size(target_list_RDA_temp));
for i = 1: size(target_list_RDA_temp, 1)
t_rda = target_list_RDA_temp(i, :);
target_list_RDA(i, 1:2) = t_rda(1:2);
target_list_RDA(i, 3) = cal_angle(t_rda(1), t_rda(2), echo_mtx, A, d, lambda, acc);
end
end
%% sub-functions
% calculate target actual angle with range and doppler index
function [ angle ] = cal_angle(r_idx, d_idx, echo_mtx, A, d, lambda, acc)
% range doppler processing
echo_r = zeros([size(echo_mtx, 1), 1, size(echo_mtx, 3)]);
for i = 1 : size(echo_mtx, 3)
echo_r(:, 1, i) = sum(bsxfun(@times, echo_mtx(:, :, i), A(:, r_idx)'), 2);
end
echo_r = squeeze(echo_r);
echo_r_ex = [echo_r, zeros(size(echo_r))];
echo_rd = zeros(size(echo_r_ex, 1), 1);
for i = 1 : size(echo_r_ex, 1)
temp_v = fftshift(fft(echo_r_ex(i,:)));
echo_rd(i) = temp_v(d_idx);
end
% CBF
THETA = linspace(-90, 90, round(acc));
fai = exp((0: size(echo_r_ex, 1) - 1)' *...
-1j * 2 * pi / lambda * d * sin(THETA / 180 * pi));
angle_mf = abs(fai'* echo_rd);
[v, idx] = max(angle_mf);
angle = THETA(idx);
end