ls1.m

来自「这个包中包含学习最小均方滤波的一个例子及其和其它滤波方法的一些比较。」· M 代码 · 共 30 行

M
30
字号
clear,close all;
N=400;
M=2;
period=[0:N-1];
x=sin(2*pi*0.02*period);
period1=[0,0:N-2];
x1=sin(2*pi*0.02*period1);
xs=0.4*x+0.4*x1;
figure;
subplot(2,1,1);
plot(xs);
grid;
title('standard singal');
noise=0.05*randn(1,N);
y=0.4*x+0.4*x1+noise;
subplot(2,1,2);
plot(y);
grid;
title('standard singal with noise ave=0.5 var=0.05');
[R,d]=lsmatvec('full',x',M,y');
cls=R\d;
Y=filter(1,cls,y);
figure;
plot(0:N-1,Y,'.',0:N-1,y,'k');
grid;
title('The predict singal vs the disired response--post');
legend('Predict singal','Desired response');


⌨️ 快捷键说明

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