LMS自适应滤波

1.问题描述:

 LMS自适应滤波

2.部分程序:

 

clear all;
t=0:0.0001:1.9999;
N=20000;

%生成有用信号s
s=3*sin(2*pi*100*t);
figure(1);
subplot(3,1,1);
plot(t,real(s));
title('有用信号s');
xlabel('n');
ylabel('s');

%生成两个相关的噪声n1,n2
n1=wgn(1,N,3);
n2=zeros(1,N);
n2(1:18000)=n1(1:18000);
n3=wgn(1,N,3);
n2(18001:N)=n3(18001:N);
figure(1);
subplot(3,1,2);
plot(t,real(n2));
title('噪声参考输入');
xlabel('n');
ylabel('n2');

%输入端期望信号d=s+n1
d=s+n1;
subplot(3,1,3);
plot(t,real(d));
title('含有噪声的信号d');
xlabel('n');
ylabel('d');


%初始化各参量
M=8;  %滤波器阶数
w=zeros(M,1); %滤波器权系数
mu=0.01;  %更新步长
iter=2000; %迭代次数
x=zeros(M,1); %输入矢量

%LMS循环算法
for i=1:iter
    i
   x(1)=n2(i);   
   y(i)=dot(w,x);
   e=d(i)-y(i);
   w=w+mu*e*x;
   
    for j=M:-1:2
        x(j)=x(j-1);    
    end

    error(i)=e; %保存输出误差
   cost(i)=e*e;  
end

   

figure(2);
subplot(1,1,1);
plot(error);
title('除噪后的信号');
xlabel('n');
ylabel('error');

3.仿真结论:

 

B0025

  • 1
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

fpga和matlab

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值