[25.08.17] Applying DOA logic : CBF

This commit is contained in:
2025-08-17 21:09:28 +09:00
parent 00859bdaaa
commit e64ea8a2e2
2 changed files with 18 additions and 17 deletions
+8 -8
View File
@@ -1,4 +1,4 @@
function [esti_ang_deg, P_CBF] = df_cbf(snapshot, test_ang_elev_deg, test_ang_azi_deg, lambda_c, array_struct, Ntarget)
function [esti_ang_deg, P_CBF] = df_cbf(snapshot, test_ang_elv_deg, test_ang_azi_deg, lambda_c, array_struct, Ntarget)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Conventioanl Beamforming algorithm for df
@@ -9,7 +9,7 @@ function [esti_ang_deg, P_CBF] = df_cbf(snapshot, test_ang_elev_deg, test_ang_az
% Description
% - Input
% - 1) snapshot [matrix], [-] : raw data(snapshot) for df
% - 2) test_ang_elev_deg [vector], [deg] : elevation angle grid for beamforming
% - 2) test_ang_elv_deg [vector], [deg] : elvation angle grid for beamforming
% - 3) test_ang_azi_deg [vector], [deg] : Azimuth angle grid for beamforming
% - 4) lambda_c [scalar], [m] : wavelength of center frequency
% - 4) array_struct [struct], [-] : Structure containing virtual array information
@@ -29,11 +29,11 @@ function [esti_ang_deg, P_CBF] = df_cbf(snapshot, test_ang_elev_deg, test_ang_az
% Spectrum
P_CBF = zeros(length(test_ang_elev_deg), length(test_ang_azi_deg));
for ang_elev_idx = 1 : length(test_ang_elev_deg)
P_CBF = zeros(length(test_ang_elv_deg), length(test_ang_azi_deg));
for ang_elv_idx = 1 : length(test_ang_elv_deg)
for ang_azi_idx = 1 : length(test_ang_azi_deg)
sv = exp(-1i * 2 * pi / lambda_c * ( array_struct.azi_eff_ch_loc.' * array_struct.lambda_c * cosd(test_ang_elev_deg(ang_elev_idx)) * sind(test_ang_azi_deg(ang_azi_idx)) + array_struct.elev_eff_ch_loc.' * array_struct.lambda_c * sind(test_ang_elev_deg(ang_elev_idx))));
P_CBF(ang_elev_idx, ang_azi_idx) = abs((sum(sv'*snapshot))).^2;
sv = exp(-1i * 2 * pi / lambda_c * ( array_struct.azi_eff_ch_loc.' * array_struct.u_azi * cosd(test_ang_elv_deg(ang_elv_idx)) * sind(test_ang_azi_deg(ang_azi_idx)) + array_struct.elv_eff_ch_loc.' * array_struct.u_elv * sind(test_ang_elv_deg(ang_elv_idx))));
P_CBF(ang_elv_idx, ang_azi_idx) = abs((sum(sv'*snapshot))).^2;
end
end
@@ -46,7 +46,7 @@ if size(P_CBF, 1) == 1
esti_ang_deg = pks_ang(order(1:Ntarget));
end
elseif size(P_CBF, 2) == 1
[pks, pks_ang, ~, ~] = findpeaks(pow2db(abs(P_CBF)), test_ang_elev_deg);
[pks, pks_ang, ~, ~] = findpeaks(pow2db(abs(P_CBF)), test_ang_elv_deg);
[~, order] = sort(pks, 'descend');
if isempty(pks)
esti_ang_deg = nan;
@@ -59,7 +59,7 @@ else
if isempty(pks)
esti_ang_deg = nan;
else
esti_ang_deg = [test_ang_elev_deg(locs_x(order(1:Ntarget))).' test_ang_azi_deg(locs_y(order(1:Ntarget))).'];
esti_ang_deg = [test_ang_elv_deg(locs_x(order(1:Ntarget))).' test_ang_azi_deg(locs_y(order(1:Ntarget))).'];
end
end
+10 -9
View File
@@ -31,7 +31,7 @@ opt_window = 1;
flag_plot_physical_array = 0;
flag_plot_virtual_array = 0;
flag_plot_RVM = 1;
flag_plot_RVM = 0;
flag_plot_noise_esti = 0;
flag_plot_birdview = 1;
@@ -115,7 +115,7 @@ accR = [0 0 0].'; % radar acceleration
% 01. Target
tgt_rng = [100];
tgt_azi = [0];
tgt_azi = [10];
tgt_elv = [0];
tgt_pos = [tgt_rng.*cosd(tgt_azi).*cosd(tgt_elv) tgt_rng.*sind(tgt_azi).*cosd(tgt_elv) tgt_rng.*sind(tgt_elv)].';
@@ -608,9 +608,12 @@ az_array_pos = mimoarray(2, :) / u_azi;
elv_Unit = u_elv / lambda_c;
test_ang = -90 : 0.1 : 90;
svmat = exp(-1i * 2 * pi / lambda_c * az_array_pos.' * u_azi .* sind(test_ang));
test_ang_azi_deg = -90 : 0.1 : 90;
test_ang_elev_deg = 0;
array_struct.azi_eff_ch_loc = az_array_pos;
array_struct.elv_eff_ch_loc = 0;
array_struct.u_azi = u_azi;
array_struct.u_elv = 0;
det_jdx = 1;
for det_idx = 1 : size(snapshot_data, 2)
% DOA estimation
@@ -619,10 +622,8 @@ for det_idx = 1 : size(snapshot_data, 2)
temp_esti_elv_deg = asind(angle(elv_phase_diff)/2/pi/elv_Unit);
% Azi esti.
azi_spectrum = abs(svmat' * snapshot_data(:, det_idx)).^2;
[pks, esti_azi_deg] = findpeaks(azi_spectrum/max(azi_spectrum), test_ang, 'MinPeakHeight', 0.9);
figure
plot(test_ang, pow2db(azi_spectrum));
Ntarget = 1;
[esti_azi_deg, P_CBF(det_idx,:)] = df_cbf(snapshot_data(:,det_idx), test_ang_elev_deg, test_ang_azi_deg, lambda_c, array_struct, Ntarget);
esti_elv_deg = temp_esti_elv_deg * ones(1, length(esti_azi_deg));