clc;
clear;
close all;
warning off;
addpath(genpath(pwd));
load('ECG_database.mat');
fs=1000;
d1=Org_Data1(2,:)/200;
d2=Org_Data2(2,:)/200;
d3=Org_Data3(2,:)/200;
noise_wn = wn/10;
noise_bwn = Org_bw_noise(1,1:5000)/200;
noise_emn = Org_em_noise(1,1:5000)/200;
noise_man = Org_ma_noise(1,1:5000)/200;
noise_pli = 0.1*sin(2*pi*60*(0:length(d1)-1)/fs);
x1=d1+noise_wn;
x2=d1+noise_bwn;
x3=d2+noise_emn;
x4=d1+noise_man;
x5=d1+noise_pli;
lamda = 1; %RLS
mu = 0.02; %LMS
a=0.1; %NLMS
mu2 = 0.02; %for NLMS
M1 =2;%LMS
M2 =2;%NLMS
M3 =2;%RLS
%----for white noise---%
[e1_wn,y1_wn,w1_wn] = myLMS(x1,noise_wn, mu, M1);
[e2_wn,y2_wn,w2_wn] = myNLMS(x1, noise_wn, mu2, M2, a);
[e3_wn,y3_wn,w3_wn] = myRLS(x1,noise_wn,lamda, M3);
figure;
subplot(411); plot(x1);
title('ECG corrupted by White Gaussian Noise');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
subplot(412); plot(e1_wn);
title('LMS Filter Response');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
subplot(413); plot(e2_wn);
title('NLMS Filter Response');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
subplot(414); plot(e3_wn);
title('RLS Filter Response');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
figure;
plot(y1_wn'-noise_wn,'r'); hold on;
plot(y2_wn'-noise_wn,'b'); hold on;
plot(y3_wn'-noise_wn,'g'); hold on;
title('Error convergence curve of three algorithms for WN');
xlabel('Samples (n)');
ylabel('Error Magnitude');
legend('LMS','NLMS','RLS');
%-----for bwn---%
[e1_bwn,y1_bwn,w1_bwn] = myLMS(x2,noise_bwn, mu, M1);
[e2_bwn,y2_bwn,w2_bwn] = myNLMS(x2, noise_bwn, mu2, M2, a);
[e3_bwn,y3_bwn,w3_bwn] = myRLS(x2,noise_bwn,lamda, M3);
figure;
subplot(411); plot(x2);
title('ECG corrupted by Baseline Wander Noise');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
subplot(412); plot(e1_bwn);
title('LMS Filter Response');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
subplot(413); plot(e2_bwn);
title('NLMS Filter Response');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
subplot(414); plot(e3_bwn);
title('RLS Filter Response');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
%-----for emn---%
[e1_emn,y1_emn,w1_emn] = myLMS(x3,noise_emn, mu, M1);
[e2_emn,y2_emn,w2_emn] = myNLMS(x3, noise_emn, mu2, M2, a);
[e3_emn,y3_emn,w3_emn] = myRLS(x3,noise_emn,lamda, M3);
figure;
subplot(411); plot(x3);
title('ECG corrupted by Electrode Motion Artifact');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
subplot(412); plot(e1_emn);
title('LMS Filter Response');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
subplot(413); plot(e2_emn);
title('NLMS Filter Response');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
subplot(414); plot(e3_emn);
title('RLS Filter Response');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
% figure;
% plot(y1_emn'-noise_emn,'r'); hold on;
% plot(y2_emn'-noise_emn,'b'); hold on;
% plot(y3_emn'-noise_emn,'g'); hold on;
% title('Error convergence curve of three algorithms for EMN');
% xlabel('Samples (n)');
% ylabel('Error Magnitude');
% legend('LMS','NLMS','RLS');
%----for man----%
[e1_man,y1_man,w1_man] = myLMS(x4,noise_man, mu, M1);
[e2_man,y2_man,w2_man] = myNLMS(x4, noise_man, mu2, M2, a);
[e3_man,y3_man,w3_man] = myRLS(x4,noise_man,lamda, M3);
figure;
subplot(411); plot(x4);
title('ECG corrupted by Muscle Artifacts Noise');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
subplot(412); plot(e1_man);
title('LMS Filter Response');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
subplot(413); plot(e2_man);
title('NLMS Filter Response');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
subplot(414); plot(e3_man);
title('RLS Filter Response');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
%----for PLI----%
[e1_pli,y1_pli,w1_pli] = myLMS(x5,noise_pli, mu, M1);
[e2_pli,y2_pli,w2_pli] = myNLMS(x5, noise_pli, mu2, M2, a);
[e3_pli,y3_pli,w3_pli] = myRLS(x5,noise_pli,lamda, M3);
figure;
subplot(411); plot(x5);
title('ECG corrupted by 60Hz PLI');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
subplot(412); plot(e1_pli);
title('LMS Filter Response');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
subplot(413); plot(e2_pli);
title('NLMS Filter Response');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
subplot(414); plot(e3_pli);
title('RLS Filter Response');
xlabel('Samples (n)');
ylabel('Amplititude (mV)') ;grid
%--error--%
figure;
plot(y1_pli'-noise_pli,'r'); hold on;
plot(y2_pli'-noise_pli,'b'); hold on;
plot(y3_pli'-noise_pli,'g'); hold on;
title('Error convergence curve of three algorithms for 60Hz PLI');
xlabel('Samples (n)');
ylabel('Error Magnitude');
legend('LMS','NLMS','RLS');
figure;
plot(d1);
title('Clean ECG signal (1)');
xlabel('Samples (n)');
ylabel('Amplititude (mV)');
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
1.领域:matlab,LMS,NLMS以及RLS自适应滤波算法 2.内容:ECG信号自适应滤波处理去噪,对比LMS,NLMS以及RLS三种自适应滤波算法+代码操作视频 3.用处:用于ECG信号自适应滤波算法编程学习 4.指向人群:本硕博等教研学习使用 5.运行注意事项: 使用matlab2021a或者更高版本测试,运行里面的Runme_.m文件,不要直接运行子函数文件。运行时注意matlab左侧的当前文件夹窗口必须是当前工程所在路径。 具体可观看提供的操作录像视频跟着操作。
资源推荐
资源详情
资源评论
收起资源包目录
ECG信号自适应滤波处理去噪,对比LMS,NLMS以及RLS三种自适应滤波算法.rar (6个子文件)
1ECG信号自适应滤波处理去噪,对比LMS,NLMS以及RLS三种自适应滤波算法
func
myLMS.m 292B
myRLS.m 437B
myNLMS.m 320B
ECG_database.mat 353KB
操作录像0022.avi 8.26MB
Runme.m 5KB
共 6 条
- 1
fpga和matlab
- 粉丝: 17w+
- 资源: 2636
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页