• 大小: 1.36MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-27
  • 语言: Matlab
  • 标签: 心电  去噪  

资源简介

在Matlab下采用多种方法对心电信号进行去噪,适用于初学者

资源截图

代码片段和文件信息

%%%%%%%%%%信号小波分解
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%基于Haar小波%%%%%%%
ecg=fopen(‘100.dat‘‘r‘);
N=1201;
data=fread(ecgN‘int16‘);
data=data/10000;
save ECGdata data;
fclose(ecg);
x=0:0.004:4.8;
figure(1);
subplot(321);
plot(xdata);
axis([0 4.8 -4 4]);
title(‘原始心电信号‘);
x=data;
wname=‘Haar‘;
level=5;
[cl]=wavedec(xlevelwname);
a5=wrcoef(‘a‘cl‘Haar‘5);
a4=wrcoef(‘a‘cl‘Haar‘4);
a3=wrcoef(‘a‘cl‘Haar‘3);
a2=wrcoef(‘a‘cl‘Haar‘2);
a1=wrcoef(‘a‘cl‘Haar‘1);
subplot(322);plot(a5);title(‘a5‘);axis([0 1201 -2 2]);
subplot(323);plot(a4);title(‘a4‘);axis([0 1201 -2 2]);
subplot(324);plot(a3);title(‘a3‘);axis([0 1201 -2 2]);
subplot(325);plot(a2);title(‘a2‘);axis([0 1201 -2 2]);
subplot(326);plot(a1);title(‘a1‘);axis([0 1201 -2 2]);
%%%%%%%%%%%%基于db6小波%%%%%
ecg=fopen(‘100.dat‘‘r‘);
N=1201;
data=fread(ecgN‘int16‘);
data=data/10;
fclose(ecg);
x=0:0.004:4.8;
figure(2);
subplot(321);
plot(xdata);
axis([0 4.8 -4000 4000]);
title(‘原始心电信号‘);
x=data;
wname=‘db6‘;
level=5;
[cl]=wavedec(xlevelwname);
a5=wrcoef(‘a‘cl‘db6‘5);
a4=wrcoef(‘a‘cl‘db6‘4);
a3=wrcoef(‘a‘cl‘db6‘3);
a2=wrcoef(‘a‘cl‘db6‘2);
a1=wrcoef(‘a‘cl‘db6‘1);
subplot(322);plot(a5);title(‘a5‘);axis([0 1201 -2000 2000]);
subplot(323);plot(a4);title(‘a4‘);axis([0 1201 -2000 2000]);
subplot(324);plot(a3);title(‘a3‘);axis([0 1201 -2000 2000]);
subplot(325);plot(a2);title(‘a2‘);axis([0 1201 -2000 2000]);
subplot(326);plot(a1);title(‘a1‘);axis([0 1201 -2000 2000]);
%%%%%%%%%%%%%%%%%基于sym3小波%%%%%%%%%%%%%%%%%%%%%%%
ecg=fopen(‘100.dat‘‘r‘);
N=1201;
data=fread(ecgN‘int16‘);
data=data/10;
save ECGdata data;
fclose(ecg);
x=0:0.004:4.8;
figure(3);
subplot(321);
plot(xdata);
axis([0 4.8 -4000 4000]);
title(‘原始心电信号‘);
x=data;
wname=‘sym3‘;
level=5;
[cl]=wavedec(xlevelwname);
a5=wrcoef(‘a‘cl‘sym3‘5);
a4=wrcoef(‘a‘cl‘sym3‘4);
a3=wrcoef(‘a‘cl‘sym3‘3);
a2=wrcoef(‘a‘cl‘sym3‘2);
a1=wrcoef(‘a‘cl‘sym3‘1);
subplot(322);plot(a5);title(‘a5‘);axis([0 1201 -2000 2000]);
subplot(323);plot(a4);title(‘a4‘);axis([0 1201 -2000 2000]);
subplot(324);plot(a3);title(‘a3‘);axis([0 1201 -2000 2000]);
subplot(325);plot(a2);title(‘a2‘);axis([0 1201 -2000 2000]);
subplot(326);plot(a1);title(‘a1‘);axis([0 1201 -2000 2000]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%心电信号降噪
%%%%%%%%%%%%%%%Birge-Massart策略阈值降噪
%基于小波变换的心电信号的降噪
ecg=fopen(‘100.dat‘‘r‘);
N=1201;
data=fread(ecgN‘int16‘);
data=data/10000;
fclose(ecg);
x=data;
wavename=‘db5‘;
level=4;
[cl]=wavedec(xlevelwavename);
alpha=1.5;
sorh=‘h‘;
[thrnkeep]=wdcbm(clalpha);%使用硬阈值给信号降噪
[xccxclxcperf0perfl2]=wdencmp(‘lvd‘clwavenamelevelthrsorh);
t1=0:0.004:(length(x)-1)*0.004;
figure(4);
subplot(211);
plot(t1x);
title(‘从人体采集的原始的ECG信号‘);
subplot(212);
plot(t1xc);
title(‘Birge-Massart策略阈值降噪后的ECG信号(wname=db5 level=4)‘);
%%%%%%%%%%%%%%%%%%最优预测软阈值降噪
%基于小波变换的心电信号的

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5444  2010-05-06 20:49  ECGprocess\process.m

     文件    1950000  2008-01-17 11:58  ECGprocess\100.dat

     文件    1950000  2008-12-25 14:18  ECGprocess\ECG1.dat

     文件       3512  2009-05-04 10:22  ECGprocess\ECGdata.mat

     目录          0  2010-06-12 16:36  ECGprocess

----------- ---------  ---------- -----  ----

              3908956                    5


评论

共有 条评论