欢迎来到本博客❤️❤️
博主优势:博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳️座右铭:行百里者,半于九十。
本文目录如下:
目录
1 概述
2 运行结果
3 Matlab代码实现
4 参考文献
本文分享FRLS优化算法
FRLS(Fractional Least Squares)优化算法是一种用于解决非整数阶系统参数识别问题的算法。它基于最小二乘法原理,用于拟合非整数阶系统响应数据,并估计系统的参数。
FRLS算法采用了一种连续化的迭代方法,在频域中拟合系统的传递函数,并通过调整参数来最小化实际输出与拟合输出之间的误差。
算法的基本思想是将非整数阶微分方程表示为一个整数阶微分方程的组合形式,然后使用整数阶传递函数模型来近似拟合实际响应数据。通过迭代过程,不断优化参数,使拟合的误差最小化。
相比传统的整数阶系统参数识别算法,FRLS算法能够更准确地描述非整数阶系统的动态特性,适用于许多实际工程中的非整数阶系统建模与参数估计问题。
需要注意的是,FRLS算法的性能和有效性取决于选择合适的模型结构、初始参数和迭代策略等因素。在应用中需要经验和实践来调整和优化算法的参数和步骤,以获得较好的结果。
部分代码:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %%%%%%%%%%%%%%%%%%%
部分理论来源于网络,如有侵权请联系删除。
[1]Lu Shen (2022) Finite-Window RLS ALgorithm