calculate_av_mvdr.m

来自「implement basic routines in Matlab and O」· M 代码 · 共 35 行

M
35
字号
function [w_av, mu, g] = calculate_av_mvdr(numIterations, s, R)

if(size(R,1) ~= size(R,2))
    error('ERROR - Covariance matrix must be square')
end
if(size(s,1) ~= size(R,1))
    error('ERROR - length of steering vector must be same as covariance matrix')
end

N = size(R,1);
w_av = zeros(N, numIterations);

w_av(:,1) = s/(norm(s)^2);
tempResult = (eye(N)-((s*s')/(norm(s)^2))) * R;
nfft = 1024;

[dummy, look_direction_index] = max(fftshift(abs(fft(s,nfft)).^2));
look_direction_range = (look_direction_index-100):1:(look_direction_index+100);
%restore_vector = 0;
for i = 2:numIterations
   g_local = tempResult * w_av(:,i-1);
   g(:,i-1) = g_local;
   %mu_local = real((g' * R * w_av(:, i-1)) / (g' * R * g));
   mu_local = ((g_local' * R * w_av(:, i-1)) / (g_local' * R * g_local));
   mu(i-1) = ((g_local' * R * w_av(:, i-1)) / (g_local' * R * g_local));
   [dummy, max_gain_index] = max(fftshift(abs(fft(mu_local*g_local,nfft)).^2));
   if sum(look_direction_range == max_gain_index) >= 1
%       restore_vector = restore_vector + mu_local*g;
   end
   w_av(:,i) = w_av(:,i-1) - mu_local*g_local;
end
%w_av(:,numIterations) = w_av(:,numIterations) + restore_vector;
%plot_array_response_and_interferers([gt(:,45:53)], strvcat('Auxiliart Vector'), Desired_AOA, interferer_aoa_deg, 1024);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?