salms.m

来自「It is a GUI designed for the learning of」· M 代码 · 共 26 行

M
26
字号
function [e,W]=salms(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+2*mu*uvec*sign(conj(e(n)));
    W=[W w];
end
% e=(e(:)).^2;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?