aaaveragenoiselms.m

来自「Adaptive Filtering Primer with MATLAB」· M 代码 · 共 23 行

M
23
字号

function[w,J]=aaaveragenoiselms(a,b,mu,M,N,I)
%noise reduction lms filter with sine function as desired signal;
%function[w,J]=aaaveragelms(a,b,mu,M,N,I);a=controls the noise variance;
%b=controls the amplitude of the sine function;d=desired sine 
%function;M=number of filter coefficients;I=number of times to be averaged;
%N=number of data;
J=zeros(1,N);
w=zeros(1,M);
k=0:N-1;
for m=1:I
    x=a*randn(1,N)+b*sin(0.1*pi*k);
    d=b*sin(0.1*pi*k);
    for n=M:N
        x1=x(n:-1:n-M+1);
        y(n)=w*x1';
        e(n)=d(n)-y(n);
        w=w+2*mu*e(n)*x1;
    end;
    E(m,:)=e.^2;
end;
J=sum(E,1)/I;

⌨️ 快捷键说明

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