📄 lmsbianshi.m
字号:
clear
t=1:500
x = 0.1*randn(1,500); % Input to the filter
b = fir1(31,0.5); % FIR system to be identified
d = filter(b,1,x); % Desired signal
w0 = zeros(1,32); % Initial filter coefficients
mu = 0.8; % LMS step size
S = initlms(w0,mu);
[y1,e1,S1] = adaptlms(x,d,S);
%legend('Actual','Estimated');
%title('System Identification of an FIR filter');grid on;
% x = 0.1*randn(1,500); % Input to the filter
b = fir1(31,0.5); % FIR system to tbe identified
d = filter(b,1,x); % Desired signal
w0 = zeros(1,32); % Initial filter coefficients
P0 = 5*eye(32); % Initial input correlation matrix inverse
lam = 1; % Exponential memory weighting factor
S = initrls(w0,P0,lam);
[y2,e2,S2] = adaptrls(x,d,S);
figure(1)
%stem([b.',S.coeffs.']);
plot(t,y1,t,y2)
figure(2)
%stem([b.',S.coeffs.']);
plot(t,e1,t,e2)
figure(3)
n=1:32
stem([S1.coeffs' S2.coeffs'])
figure(4)
z=S1.coeffs-S2.coeffs;
stem(n,z)
%legend('Actual','Estimated');
% title('System Identification of an FIR filter via RLS');grid on;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -