Initial Commit.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
function [esti_ang_deg, P_MUSIC, test_ang_deg] = df_1D_MUSIC(snapshot, Ntarget, array_struct, fov_deg, unit_ang_deg , plot_flag)
|
||||
|
||||
% Number of Snapshots
|
||||
Nsnap = size(snapshot, 2);
|
||||
|
||||
% Estimated Correlation matrix of X
|
||||
Rx = (1/Nsnap) * (snapshot * snapshot');
|
||||
|
||||
% MUSIC algorithm
|
||||
% Eigen decomposition
|
||||
[Q, ~, ~] = svd(Rx);
|
||||
|
||||
% Noise subspace
|
||||
Q_n = Q(:, Ntarget+1:end);
|
||||
|
||||
% MUSIC algorithm
|
||||
test_ang_deg = -fov_deg : unit_ang_deg : fov_deg - unit_ang_deg;
|
||||
P_MUSIC = zeros(1, length(test_ang_deg));
|
||||
|
||||
if size(array_struct.eff_ch_loc, 1) == 1
|
||||
array_struct.eff_ch_loc = array_struct.eff_ch_loc.';
|
||||
end
|
||||
|
||||
Q_n_square = Q_n * Q_n';
|
||||
for ang_idx = 1 : length(test_ang_deg)
|
||||
z = exp(1i * 2 * pi / array_struct.lambda_c * array_struct.unit * -sind(test_ang_deg(ang_idx)));
|
||||
test_sv = z.^array_struct.eff_ch_loc;
|
||||
P_MUSIC(ang_idx) = 1 / (test_sv' * Q_n_square * test_sv);
|
||||
end
|
||||
|
||||
if plot_flag == 1
|
||||
figure()
|
||||
plot(test_ang_deg, pow2db(abs(P_MUSIC)));
|
||||
grid on
|
||||
xlabel('Test angle [deg]');
|
||||
ylabel('Magnitude [dB]');
|
||||
end
|
||||
|
||||
[pks, pks_ang, ~, ~] = findpeaks(pow2db(abs(P_MUSIC)), test_ang_deg);
|
||||
[~, order] = sort(pks, 'descend');
|
||||
esti_ang_deg = pks_ang(order(1:Ntarget));
|
||||
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user