nlms.m
来自「It is a GUI designed for the learning of」· M 代码 · 共 29 行
M
29 行
function [e,W]=nlms(mu,M,u,d,a);
% Normalized LMS
% Call:
% [e,w]=nlms(mu,M,u,d,a);
%
% Input arguments:
% mu = step size, dim 1x1
% M = filter length, dim 1x1
% u = input signal, dim Nx1
% a = constant, dim 1x1
%
% Output arguments:
% e = estimation error, dim Nx1
% w = final filter coefficients, dim Mx1
%intial value 0
w=zeros(M,1);
%input signal length
N=length(u);
%make sure that u and d are colon vectors
u=u(:);
d=d(:);
W=[];
%NLMS
for n=M:N
uvec=u(n:-1:n-M+1);
e(n)=d(n)-w'*uvec;
w=w+2*mu/(a+uvec'*uvec)*uvec*conj(e(n));
W=[W w];
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?