自适应噪声抑制算法LMSmatlab源码程序 - matlab通信信号 - 谷速源码
下载频道> 资源分类> matlab源码> 通信信号> 自适应噪声抑制算法LMSmatlab源码程序

标题:自适应噪声抑制算法LMSmatlab源码程序
分享到:

所属分类: 通信信号 资源类型:程序源码 文件大小: 1.28 KB 上传时间: 2016-01-24 21:30:20 下载次数: 30 资源积分:1分 提 供 者: 马云 20160124093004171
内容:
自适应噪声抑制算法LMSmatlab源码程序,程序员在编程的过程中可以参考学习使用,希望对IT程序员有用,此源码程序简单易懂、方便阅读,有很好的学习价值!
部分代码如下:
% filter parameters
M=20;      % number of taps
mu=0.05;   % step-size parameter
e_max=500; % maximum #of epochs
 
% constants
pi=3.14;
Fs=0.02;   % signal frequency
Fn=0.05;   % noise frequency
 
% initialize
w=(randn(1,M)-randn(1,M))/100;
d=zeros(1,M);
u=zeros(1,M);
u_out=zeros(1,e_max-M);
f_out=zeros(1,e_max-M);
 
% Generate desires signal and input(signal+noise)
for t=1:M-1
    d(t)=sin(2*pi*Fs*t);
    u(t)=d(t)+0.5*sin(2*pi*Fn*t)+randn;
end
t=M;
epoch=0;
 
while epoch<e_max
    % generate new input
    input=sin(2*pi*Fs*t);
    % shift new input into array
    for i=2:M
        d(M-i+2)=d(M-i+1);
        u(M-i+2)=u(M-i+1);
    end
    d(1)=input;
    % add undesired freq & random noise
    u(1)=input+0.5*sin(2*pi*Fn*t)+0.09*randn;
    u_out(t-M+1)=u(1);
    
    % compute filteroutput
    output=dot(w,u);
    f_out(t-M+1)=output;
    
    % LMS algorithm
    % compute error
    e=d(1)-output;
    
    % update weights
    for n=1:M
        w(n)=w(n)+mu*u(n)*e;
    end
    
    %
    in(t-M+1)=u(1);
    out(t-M+1)=output;
    err(t-M+1)=e;
    
    t=t+1;
    epoch=epoch+1;
    
    %  plot noise and filtered signal
    figure(1)
    subplot(211);
    plot(t,u(1));axis([0 e_max -2.5 2.5]);
    title('滤波器输入')';
    hold on;
    subplot(212);
    plot(t,d(1));axis([0 e_max -2.5 2.5]);
    title('滤波器输出')';
    hold on;
    figure(2)
    subplot(211);
    plot(t,output);axis([0 e_max -2.5 2.5]);
    title('滤波输出信号')';
    hold on;
     subplot(212);
    plot(t,e);axis([0 e_max -2.5 2.5]);
    title('误差信号')';
    hold on;
end

文件列表(点击上边下载按钮,如果是垃圾文件请在下面评价差评或者投诉):

自适应噪声抑制算法LMSmatlab源码程序/
自适应噪声抑制算法LMSmatlab源码程序/code/
自适应噪声抑制算法LMSmatlab源码程序/code/lms_noise_cancellation.m

关键词: 噪声 算法 源码

Top_arrow
回到顶部
联系方式| 版权声明| 招聘信息| 广告服务| 银行汇款| 法律顾问| 兼职技术| 付款方式| 关于我们|
网站客服网站客服 程序员兼职招聘 程序员兼职招聘
沪ICP备19040327号-3
公安备案号:沪公网安备 31011802003874号
库纳格流体控制系统(上海)有限公司 版权所有
Copyright © 1999-2014, GUSUCODE.COM, All Rights Reserved