⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ls.m

📁 这个包中包含学习最小均方滤波的一个例子及其和其它滤波方法的一些比较。
💻 M
字号:
clear,close all;
N=100;
M=2;
period=[0:N-1];
x=sin(2*pi*0.02*period);
figure;%作图1的第一子图
subplot(2,1,1);
plot(x);
grid;
title('standard singal');
period1=[0,0:N-2];
x1=sin(2*pi*0.02*period1);
noise=0.05*randn(1,N);
xn=x+noise;
subplot(2,1,2);%作图1的第二子图
plot(xn);
grid;
title('standard singal with noise var=0.05');
y=0.5*x+0.5*x1+noise;
[R,d]=lsmatvec('prew',x',M,y');
cls=R\d;
Y=filter(1,cls,x);
figure;%作图2的第一子图
subplot(2,1,1);
plot(0:N-1,Y,'.',0:N-1,x,'k');
grid;
title('预测信号与实际信号的比较');
legend('预测信号,实际信号');


⌨️ 快捷键说明

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