心电信号基于matlabsimulink胎儿心电信号提取含matlab源码1550期(代码片段)

紫极神光 紫极神光     2023-02-17     484

关键词:

一、心电信号简介

0 引言
心电信号是人类最早研究的生物信号之一, 相比其他生物信号更易于检测, 且具有直观的规律。心电图的准确分析对心脏病的及早治疗有重大的意义。人体是一个复杂精密的系统, 有许多不可抗的外界因素, 得到纯净的心电信号非常困难。可以采用神经网络算法去除心电信号的噪声, 但这种方法存在训练难度大、耗时长的缺点。小波变换在处理非线性、非平稳且奇异点较多的信号时具有一定的优越性, 近年来许多学者使用其对心电信号进行研究。

1 心电信号简介
心电信号由以下几个波段组成, 一个典型的心电图如图1所示。

图1 典型心电图
(1) P波:反映心房肌在除极过程中的电位变化过程;
(2) P-R间期:反映的是激动从窦房结通过房室交界区到心室肌开始除极的时限;
(3) QRS波群:反映心室肌除极过程的电位变化;
(4) T波:代表心室肌复极过程中所引起的电位变化;
(5) S-T段:从QRS波群终点到达T波起点间的一段水平线[2];
(6) Q-T间期:心室从除极到复极的时间[3];
(7) U波:代表动作电位的后电位。
由于心电信号十分微弱, 且低频, 极易受到干扰, 不同的干扰源的噪声虽是随机的, 但来自同一个干扰源的噪声往往具有同一类特征。分析干扰的来源, 针对不同的来源使用合适的处理方法, 是数据采集重点考虑的一个问题。常见干扰有3种: (1) 工频干扰; (2) 基线漂移; (3) 肌电干扰。其中已经证明小波变换在抑制心电信号的工频干扰方面具有较大优势。具体噪声频带如表1所示。
表1 心电信号以及主要噪声频带

二、部分源代码

 
%% Init
% clear all; close all;
Fs = 4e3;
Time = 40;
NumSamp = Time * Fs;
load Hd;


%% Mom's Heartbeat
% In this example, we shall simulate the shapes of the electrocardiogram 
% for both the mother and fetus. The following commands create an 
% electrocardiogram signal that a mother's heart might produce assuming 
% a 4000 Hz sampling rate. The heart rate for this signal is approximately 
% 89 beats per minute, and the peak voltage of the signal is 3.5 millivolts.
x1 = 3.5*ecg(2700).'; % gen synth ECG signal
y1 = sgolayfilt(kron(ones(1,ceil(NumSamp/2700)+1),x1),0,21); % repeat for NumSamp length and smooth
n = 1:Time*Fs';
del = round(2700*rand(1)); % pick a random offset
mhb = y1(n + del)'; %construct the ecg signal from some offset

axis([0 2 -4 4]);
grid;
xlabel('Time [sec]');
ylabel('Voltage [mV]');
title('Maternal Heartbeat Signal');

%% Fetus Heartbeat
% The heart of a fetus beats noticeably faster than that of its mother, 
% with rates ranging from 120 to 160 beats per minute. The amplitude of the 
% fetal electrocardiogram is also much weaker than that of the maternal 
% electrocardiogram. The following series of commands creates an electrocardiogram 
% signal corresponding to a heart rate of 139 beats per minute and a peak voltage 
% of 0.25 millivolts.
x2 = 0.25*ecg(1725);
y2 = sgolayfilt(kron(ones(1,ceil(NumSamp/1725)+1),x2),0,17);
del = round(1725*rand(1));
fhb = y2(n + del)';
subplot(3,3,2); plot(t,fhb,'m');
axis([0 2 -0.5 0.5]);
grid;
xlabel('Time [sec]');
ylabel('Voltage [mV]');
title('Fetal Heartbeat Signal');

%% The measured signal
% The measured fetal electrocardiogram signal from the abdomen of the mother is 
% usually dominated by the maternal heartbeat signal that propagates from the 
% chest cavity to the abdomen. We shall describe this propagation path as a linear 
% FIR filter with 10 randomized coefficients. In addition, we shall add a small 
% amount of uncorrelated Gaussian noise to simulate any broadband noise sources 
% within the measurement. Can you determine the fetal heartbeat rate by looking 
% at this measured signal?

%axis tight;
grid;
xlabel('Time [sec]');


%% Measured Mom's heartbeat
% The maternal electrocardiogram signal is obtained from the chest of the mother. 
% The goal of the adaptive noise canceller in this task is to adaptively remove the 
% maternal heartbeat signal from the fetal electrocardiogram signal. The canceller 
% needs a reference signal generated from a maternal electrocardiogram to perform this 
% task. Just like the fetal electrocardiogram signal, the maternal electrocardiogram 
% signal will contain some additive broadband noise.
x = mhb + 0.02*randn(size(mhb));
subplot(3,3,4); plot(t,x);
axis([0 2 -4 4]);
grid;
xlabel('Time [sec]');
ylabel('Voltage [mV]');
title('Reference Signal');

%% Applying the adaptive filter
% The adaptive noise canceller can use almost any adaptive procedure to perform its task. 
% For simplicity, we shall use the least-mean-square (LMS) adaptive filter with 15 
% coefficients and a step size of 0.00007. With these settings, the adaptive noise canceller 
% converges reasonably well after a few seconds of adaptation--certainly a reasonable 
% period to wait given this particular diagnostic application.

h = adaptfilt.lms(15, 0.001);
[y,e] = filter(h,x,d);

% [y,e] = FECG_detector(x,d);


%axis([0 7.0 -4 4]);
grid;
xlabel('Time [sec]');
ylabel('Voltage [mV]');
title('Convergence of Adaptive Noise Canceller');
legend('Measured Signal','Error Signal');

%% Recovering the fetus' hearbeat
% The output signal y(n) of the adaptive filter contains the estimated maternal 
% heartbeat signal, which is not the ultimate signal of interest. What remains in the 
% error signal e(n) after the system has converged is an estimate of the fetal heartbeat 
% signal along with residual measurement noise.
subplot(3,3,6); plot(t,e,'r'); hold on; plot(t,fhb,'b');
axis([Time-4 Time -0.5 0.5]);
grid on;
xlabel('Time [sec]');
ylabel('Voltage [mV]');
title('Steady-State Error Signal');
legend('Calc Fetus','Ref Fetus ECG');

%% Counting the peaks to detect the heart rate
% The idea is to clean up the signal, and then set some dynamic threshold, so that any signal
% crossing the threshold is considered a peak. The peaks can be counted per time window.
%[num,den] = fir1(100,100/2000);
filt_e = filter(Hd,e);
subplot(3,3,7); plot(t,fhb,'r'); hold on; plot(t,filt_e,'b');

xlabel('Time [sec]');
ylabel('Voltage [mV]');
title('Filtered signal');
legend('Ref Fetus','Filtered Fetus');
thresh = 4*mean(abs(filt_e))*ones(size(filt_e));
peak_e = (filt_e >= thresh);
edge_e = (diff([0; peak_e]) >0);
subplot(3,3,8); plot(t,filt_e,'c'); hold on; plot(t,thresh,'r'); plot(t,peak_e,'b');
xlabel('Time [sec]');
ylabel('Voltage [mV]');
title('Peak detection');
legend('Filtered fetus','Dyna thresh','Peak marker', 'Location','SouthEast');
axis([Time-4 Time -0.5 0.5]);
subplot(3,3,9); plot(t,filt_e,'r'); hold on; plot(t,edge_e,'b'); plot(0,0,'w');
fetus_calc = round((60/length(edge_e(16001:end))*Fs)* sum(edge_e(16001:end)));
fetus_bpm = ['Fetus Heart Rate =' mat2str(fetus_calc)];
xlabel('Time [sec]');
ylabel('Voltage [mV]');
title('Reconstructed fetus signal');
legend('Fetus Sig','Edge marker',fetus_bpm, 'Location','SouthEast');
axis([Time-4 Time -0.5 0.5]);



三、运行结果

四、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
[1] 沈再阳.精通MATLAB信号处理[M].清华大学出版社,2015.
[2]高宝建,彭进业,王琳,潘建寿.信号与系统——使用MATLAB分析与实现[M].清华大学出版社,2020.
[3]王文光,魏少明,任欣.信号处理与系统分析的MATLAB实现[M].电子工业出版社,2018.
[4]焦运良,邢计元,靳尧凯.基于小波变换的心电信号阈值去噪算法研究[J].信息技术与网络安全. 2019,38(05)

心电信号基于matlabgui自适应滤波+平滑滤波+小波滤波心电信号处理含matlab源码1809期(代码片段)

一、心电信号处理简介1引言ECG是一种基本的人体生理信号,具有重要的临床诊断价值。其特点是信号微弱,信噪比小,一般正常人的心电信号频率在0.05~100Hz范围内,幅度为10μV(胎儿)~5mV(成人)。在检测心电信号时,易受到仪... 查看详情

毕设题目:matlab心电信号

...命健康的一种重大疾病,随着医疗水平与技术的不断发展,心电信号分析成为了临床诊断心脏问题的重要方法。心电信号是一种微弱的生物信号,极易受到噪声的干扰,去噪的效果会直接影响到后续的分析与诊断。2现成案例(代... 查看详情

心电信号基于matlab瞬时抑制心电信号iir滤波含matlab源码1533期(代码片段)

...式获取代码方式1:完整代码已上传我的资源:【心电信号】基于matlab心电信号PTT+HRV+PRV【含Matlab源码1551期】获取代码方式2:通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码... 查看详情

心电信号基于matlab心电信号ptt+hrv+prv含matlab源码1551期(代码片段)

...式获取代码方式1:完整代码已上传我的资源:【心电信号】基于matlab心电信号PTT+HRV+PRV【含Matlab源码1551期】获取代码方式2:通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码... 查看详情

心电信号基于matlab小波阙值心电信号去噪含matlab源码2188期

一、小波阈值法去噪概述电能质量扰动信号的噪声大多以高斯白噪声的形式存在,利用小波变换对信号进行多分辨率分解,由于小波变换具有去除数据相关性的特点,故可以将有用信号与噪声的能量分离开来。信号中... 查看详情

基于python的心电信号检测与处理(代码片段)

心电信号的特征提取、分析与处理1.生物医学信号的特征提取与分析方法2.生物医学信号的滤波方法数据来源:MIT-BIH数据库(可从以下数据中任选两组进行实验)给出4组不同病例的心电信号数据,分别命名为“100-... 查看详情

心电信号基于matlab心电图峰值检测含matlab源码1548期(代码片段)

...式获取代码方式1:完整代码已上传我的资源:【心电信号】基于matlab心电图峰值检测【含Matlab源码1548期】获取代码方式2:通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码。备注&#x... 查看详情

心电信号基于matlabnlm时间序列心电信号去噪含matlab源码1547期(代码片段)

一、心电信号简介0引言心电信号是人类最早研究的生物信号之一,相比其他生物信号更易于检测,且具有直观的规律。心电图的准确分析对心脏病的及早治疗有重大的意义。人体是一个复杂精密的系统,有许多不可抗的外界因素,得... 查看详情

心电信号基于matlab心电图pqrst检测含matlab源码1549期(代码片段)

...式获取代码方式1:完整代码已上传我的资源:【心电信号】基于matlab心电图PQRST检测【含Matlab源码1549期】获取代码方式2:通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码。备注... 查看详情

基于stm32的多功能心电信号监测系统设计

为了检测人体心电、运动姿态以及体温生理信息,本文设计实现了一种基于STM32系列MCU的多功能心电信号监测系统,系统包含心电信号采集模块、体表温度采集模块、运动信息测量模块、无线数据传输模块、系统控制模块... 查看详情

基于stm32的无线蓝牙心电监护仪系统设计-毕设课设资料

本次设计的基于STM32的心电信号采集系统由四个模块组成:STM32F103VET6主控模块、OLED显示屏模块,蓝牙模块,AD8232模拟前端模块。在本设计中首先通过三路导联获取人体的心电信号,三路导联线分别与人体的左胸、... 查看详情

肌电信号基于matlab低通滤波肌电信号处理含matlab源码964期(代码片段)

一、简介滤波器的用途:滤波器主要用来滤除信号中的无用频率成分,让符合频率要求的信号通过,抑制不需要的信号。滤波器的分类:低通滤波器(LPF)、高通滤波器(HPF)、带通滤波器(BPF)、带阻滤波器(BEF)。下边介绍的... 查看详情

心电信号基于matlab逻辑算法rst波检测含matlab源码2386期

⛄一、小波阈值法去噪概述电能质量扰动信号的噪声大多以高斯白噪声的形式存在,利用小波变换对信号进行多分辨率分解,由于小波变换具有去除数据相关性的特点,故可以将有用信号与噪声的能量分离开来。信号... 查看详情

基于小波变换的emg信号病人数据matlab仿真分析(代码片段)

...背景三、matlab程序四、仿真结论一、理论基础    肌电信号(EMG)是一种非常微弱的生物电信号,它与神经肌肉活动密切相关,其中蕴涵着很多与肢体运动相关联的信息。肌电信号可通过表面肌电拾取电极或针式肌电拾取... 查看详情

matlabsimulink中设置信号存储缓冲区和全局变量在哪?

参考技术AFile->Preferences->Optimization,去掉Signalstoragereuse的勾选或去掉Reuseblockoutputs的勾选 参考技术BFile->Preferences->Optimization,去掉Signalstoragereuse的勾选或去掉Reuseblockoutputs的勾选 参考技术C可以在m文件中声明global,在simuli... 查看详情

一种基于肌电信号运动起点波峰终点实时自动检测的方法

一种基于肌电信号运动起点、波峰、终点实时自动检测的方法(⊙o⊙)…,这篇是我写收费文章的第一篇。咱也尝试下知识付费,哈哈。先看下效果,在给定理想正弦波的情况下,可以准确识别到正弦波的起点、波峰和终点。机器... 查看详情

一种基于肌电信号运动起点波峰终点实时自动检测的方法

一种基于肌电信号运动起点、波峰、终点实时自动检测的方法(⊙o⊙)…,这篇是我写收费文章的第一篇。咱也尝试下知识付费,哈哈。先看下效果,在给定理想正弦波的情况下,可以准确识别到正弦波的起点、波峰和终点。机器... 查看详情

wpf实现心电图曲线绘制(代码片段)

...及到胎儿心率图曲线的绘制,最近项目中还需要添加心电曲线和血样曲线的绘制功能。今天就来分享一下心电曲线的绘制方式;二、正文1)胎儿心率曲线的绘制是通过DrawingVisual来实现的,这里的心电曲线我也是... 查看详情