hi, I simulated TRLS algorithm with leading DCD, but the coefficients didn't converge,would you help me?please

2 次查看(过去 30 天)
clear all close all clc
global N Ts format long % ============================= system model ============================ % % continuous model
num = [0.004104 , 380]; den = [0.0000000213 , 0.0000586 , 1];
G = tf(num,den) pole(G); zero(G); syms z;
% discrete model Ts = 20e-06; % Ts = 0.1; Gd = c2d(G,Ts) pole(Gd); zero(Gd);
b = Gd.num{1,1}; a = Gd.den{1,1}; %step responce
% identification parameters teta = [a(2:3),b(2:3)]' N = 800;
% ======================== RLS with step input ========================== %
Rand_signal = [0.91*randn(1,N/8) -0.91*randn(1,N/8) zeros(1, 3*(N/4)) ] ; % Rand_signal = [0.85*randn(1,N/2) zeros(1,N/2) ] ; x = [0.91*rand(1,N/8) -0.91*rand(1,N/8) zeros(1, 3*(N/4)) ]; S = var(x); %signal Power SNR = 30; Noise_amp = sqrt(S/(10^(SNR/10))); Noise_sample = Noise_amp*rand(1,length(x)); % figure(1) % plot([0:N-1]*Ts,Noise_sample)
u = 0.126*ones(1,N) + Noise_sample ; % figure(2) % plot([0:N-1]*Ts,u)
y = system_equation(a,b,u);
teta_hat(:,2) = zeros(4,1); % 4 parameters should be identified M=16; H=1; landa= 0.965; L=4; R=1e-1*eye(4,4);
r = zeros(4,1); %Rh=z h=zeros(L,N); %solution vector alpha=H; %step size m=1;
for t = 3:N for w=1:4 phi = [-y(t-1) -y(t-2) u(t-1) u(t-2)]';
R(:,w) = landa*R(:,w)+ phi(w)*phi ;
y_hat (t) = phi'*teta_hat(:,t-1);
error(t) = y(t) - phi'*teta_hat(:,t-1);
z = landa*r+error(t)*phi;
r = z; %residual vector
[~,p]=(max(abs(r)));
for k=1:1:N %itrations while abs(r(p))<=alpha/2*R(p,p) && m<=M m=m+1; alpha=alpha/2; end if m>M % number of bits coeffiecient break end h(p,t)=h(p,t)+sign(r(p))*alpha; r=r-sign(r(p))*alpha*R(:,p);
end
% [r , h] = DCDReal(R,z,L,M,N,H);
SNRi = 10*log10(var(phi)/var(error));
% disp([num2str(SNRi) 'dB SNR Improvement']);
teta_hat(:,t) = teta_hat(:,t-1) + h(:,t);
end
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Control System Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by