💥1 概述
本文分享FRLS优化算法
📚2 运行结果
部分代码:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% randn('seed',0); rand('seed',0); %%%%%%%%%%%%%% Input parameters %%%%%%%%%%%%%%%% N = 50; % Length of the adaptive filter M_set = 61:20:201; % Set of window lengths Nmc = 50; % number of simulation trials Nit = 13000; % signal length (number of samples) sigma = sqrt(10^(2.5)); % sqrt(noise variance) % - DCD parameters: - dcd.Mb = 16; % number of bits for representation of taps in the adaptive filter dcd.H = 1; % initial step-size dcd.Nu = 8; % number of updates % ------------------------------------------- % - Channel model parameters: - fs = 1000; % sampling frequency (Hz) max_f = 1; % maximum frequency of the channel variation (Hz) Nfft = 100e4; % FFT size in the channel model delta_f = fs/Nfft; % FFT bin step (Hz) power_delay_profile = 2; Np = 2*round(max_f/delta_f) + 1; % -------------------------------------------- MSD_dB = zeros(length(M_set),Nmc); for trial = 1 : Nmc disp(['trial number: ', num2str(trial)]) % -- Channel model: -- h_t = zeros(N,Nit); for i = 1 : N H1 = zeros(Nfft, 1); H1(1) = randn(1,1) + 1i*randn(1,1); if max_f > 0 H1(2:(Np-1)/2+1) = randn((Np-1)/2,1) + 1i*randn((Np-1)/2,1); H1(Nfft-(Np-1)/2+1:Nfft) = randn((Np-1)/2,1) + 1i*randn((Np-1)/2,1); elseif max_f == 0 H1(2:(Np-1)/2+1) = 0; H1(Nfft-(Np-1)/2+1:Nfft) = 0; end h = ifft(H1); h_t(i,:) = h(1:Nit); end E_h = 0; for i = 1 : Nit E_h = E_h + h_t(:,i)'*h_t(:,i); end coeff = sqrt(1/(E_h/Nit)); h_t = coeff.*h_t; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Initialization x_new = randn(Nit,1) + 1i*randn(Nit,1); Eh = 0; y_true = zeros(Nit,1); for sample = 1 : Nit if sample == 1 x = zeros(N,1); else x = [x_new(sample);x(1:end-1)]; end h_et = h_t(:, sample); y_true(sample) = h_et'*x; Eh = Eh + sum(abs(h_et).^2); end E_y = y_true'*y_true; noise = randn(Nit,1) + 1i*randn(Nit,1); E_n = noise'*noise; sigma_n = sqrt(E_y/(E_n*sigma^2)); noise = sigma_n*noise; E_n = noise'*noise; print_SNR = 10*log10(E_y/E_n); disp(['SNR = ', num2str(print_SNR), ' dB']) z = y_true + noise; for idx_M = 1:length(M_set) M = M_set(idx_M); Delay = (M-1)/2; MSD = zeros(Nit,1); %- window function window = hanning(M); h_est = FRLS(x_new, z, dcd, N, Delay, window); % - for sample = 1 : length(h_est(1,:)) MSD(sample) = sum(abs((h_est(:,sample) - h_t(:,sample))).^2); end Eh1 = Eh / Nit; MSD = MSD/Eh1; print_MSD = mean(MSD(1501:end-1500),1); MSD_dB(idx_M, trial) = 10*log10(print_MSD); disp(['M = ', num2str(M_set(idx_M)), ', MSD = ', num2str(MSD_dB(idx_M, trial)), 'dB']) end end MSD = reshape(MSD_dB, length(M_set), Nmc); mean_MSD = mean(MSD, 2); figure(1) plot(M_set, mean_MSD, ':ro', 'LineWidth', 1.5, 'MarkerSize', 10) xlabel('M') ylabel('MSD, dB') grid on box on axis([50 201 -24 -8]) legend('FRLS') saveas(gcf,'MSD_results.png') %%%%%%%%%%%% END %%%%%%%%%%%%%%%%%%%
🌈3 Matlab代码实现
🎉4 参考文献
部分理论来源于网络,如有侵权请联系删除。
[1]Lu Shen (2022) Finite-Window RLS ALgorithm