?? self_adjust_filter.m
字號:
%自適應濾波:直接利用信號觀察值,根據某種判據在觀察過程中不斷遞歸更新處理的參數,從而逐步逼近最優的濾波效果
%自適應濾波器主要有兩種:最小均方自適應濾波器和最小二乘自適應濾波器。本實驗采用的是前者
%self_adjust_filter
clear;
clc;
t=0:1/10000:1-0.0001;
s=5*cos(2*pi*t);
n=randn(size(t));
x=s+n;
w=[0,0.5];
u=0.00026;
for i=1:9999
y(i+1)=n(i:i+1)*w';
e(i+1)=x(i+1)-y(i+1);
w=w+2*u*e(i+1)*n(i:i+1);
end
figure(1)
plot(t,x)
title('帶噪聲的信號');
figure(2)
plot(t,s)
title('標準信號');
figure(3)
plot(t,e)
title('濾波結果');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -