lms.asv
来自「A simple code for understanding lms nlms」· ASV 代码 · 共 29 行
ASV
29 行
function [MSE,W]=lms(mu,N,u,d);
% Input arguments:
% mu = step size, dim 1x1
% M = filter length, dim 1x1
% u = input signal, dim Nx1
% d = desired signal, dim Nx1
%
% Output arguments:
% e = estimation error, dim Nx1
% w = final filter coefficients, dim Mx1
w=zeros(N,1);
M=length(u);
u=u(:);
d=d(:);
W=[];
%LMS starts here
for n=N:M
uvec=u(n:-1:n-N+1);
e(n)=d(n)-w'*uvec;
w=w+mu*uvec*conj(e(n));
W=[W w];
E(n) = e(n);
MSE(n) = mean(E(1:n));
end
figure(1);
plot(MSE);grid on;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?