close all
%Producing the periodic signal
t=0:0.001:2;
A=10;
xs=A*sin(2*pi*t);
figure;
subplot(2,1,1);
plot(t,xs);
grid;
ylabel('amplitude');
title('original signal');
%Prodecing noise
xn=randn(1,2001);
subplot(212);
plot(t,xn,'k');
xlabel('time');
ylabel('amplitude');
title(' randrom noise');
grid;
%-------------------------------filter signal-----------------------------%
xn = xs+xn;
xn = xn.'; % input signal
dn = xs.'; % expected signal
M = 20 ; % filter order
rho_max = max(eig(xn*xn.')); % the eigenvalue of maximum of input signal correlation matrix
mu = rand()*(1/rho_max) ; % convergence factor 0 < mu < 1/rho
[yn,W,en] = Lms(xn,dn,M,mu);
%----------------Drawing the input signal of adaptive filter--------------%
figure;
subplot(311)
plot(t,xs,'r');
title('sending signal');
axis([0,2,-A-1,A+1]);
hold on
grid on
subplot(312);
plot(t,xn,'k');
axis([0,2,-A-3,A+3]);
hold on
grid;
ylabel('amplitude');
xlabel('time');
title('the input signal of adaptive filter');
subplot(3,1,3);
plot(t,yn,'b');
axis([0,2,-A-1,A+1]);
hold on
grid;
ylabel('amplitude');
xlabel('time');
title('output signal of adaptive filter');
%-------------Drawing output signal of adaptive filter, the expected output signal and their error-----------%
figure
plot(t,yn,'r',t,dn,'k',t,dn-yn,'b');grid;
legend('the output signal of adaptive filter','expected output','error');
ylabel('amplitude');
xlabel('time');
title('adaptive filter');
林当时
- 粉丝: 113
- 资源: 1万+
最新资源
- ATmega328-Bootloader-Maker(使用ATmega328p芯片制作Arduino Uno R3开发板)
- 一组用 Javascript 解决的技术软件开发面试问题,非常合理.zip
- (源码)基于Spring Boot和WebSocket的贪吃蛇对战系统.zip
- (源码)基于C++的生产线数据传输成功率监控系统.zip
- (源码)基于Spring Boot和Dubbo的文件管理系统.zip
- (源码)基于C++的Local Generals游戏系统.zip
- (源码)基于MQTT协议的智能插座系统.zip
- Insurence_20180221.sav
- 一个简单的 JavaScript 俄罗斯方块游戏.zip
- Python课程设计:基于OpenCV的人脸识别与检测源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈