aalms1.m
来自「Adaptive Filtering Primer with MATLAB」· M 代码 · 共 25 行
M
25 行
function[w,y,e,J,w1]=aalms1(x,dn,mu,M)
%function[w,y,e,J,w1]=aalms1(x,dn,mu,M);
%this function provides also the changes of filter coefficients
%versus iterations;
%all quantities are real-valued;
%x=input data to the filter; dn=desired signal;
%M=order of the filter;
%mu=step size; x and dn must be of the same length;
%each column of the matrix w1 contains the history of each
%filter coefficient;
N=length(x);
y=zeros(1,N);
w=zeros(1,M); %initialized filter coefficient vector;
for n=M:N
xl=x(n:-1:n-M+1); %for each n the vector xl is produced
%of length M with elements from x in reverse order;
y(n)=w*xl';
e(n)=dn(n)-y(n);
w=w+2*mu*e(n)*xl;
w1(n-M+1,:)=w(1,:);
end;
J=e.^2;%J is the learning curve of the adaptive process;
%each column of the matrix w1 depicts the history of each filter
%coefficient;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?