关于
心电信号中QRS波检测是一个非常重要的步骤,可以用于实现重要波群的基本定位,在定位基础上,可以进一步分析心电信号的特征变化,从而为医疗诊断提供必要的参考。
工具
MATLAB
ECG心电信号
方法实现
ECG心电信号加载
ecg = load('DataN.txt');
fs = 256;
time_period = 1/fs;
x = (1/(8*time_period));
nyquist_rate = fs/2;
w0 = 50/nyquist_rate;
bw = w0/10;
ECG心电信号带陷滤波
[b,a] = iirnotch(w0,bw);
notchdata= filter(b,a,ecg);
nsamples=size(notchdata,1);
time=zeros(nsamples,1);
for i = 1:1:nsamples+1
time(i)=i/256;
end
ECG心电信号带通滤波
low = 0.1 / nyquist_rate;
high = 45 / nyquist_rate;
wn = [low high];
[b,a] = butter(2,wn,'bandpass');
banddata= filter(b,a,notchdata);
nsamples=size(banddata,1);
ECG心电信号差分和平方化
derivativedata = zeros(nsamples,1);
for n = 3:1:nsamples-3
derivativedata(n) = x * (-banddata(n-2) - 2*banddata(n-1) + 2*banddata(n+1) + banddata(n+2));
end
squaredata = derivativedata.*derivativedata;
ECG心电信号均值滤波
windowSize = 25;
b = (1/windowSize)*ones(1,windowSize);
a = 1;
avgmovingdata = filter(b,a,squaredata);
ECG心电信号基于滑动窗的极大值R波检测
阈值参数为0.6
窗口长度为25
threshold = 0.6 * max(avgmovingdata);
N1=length(avgmovingdata);
j=[];
v=[];
m=1;
n = windowSize;
n = 25;
i=1;
while n<=2000
y = max(avgmovingdata(m:n));
index=find(avgmovingdata==y);
if(y>threshold)
j(i)=index;
v(i)=y;
i=i+1;
end
n=n+windowSize;
m=m+windowSize-1;
end
数据获取
相关问题和项目,欢迎私信交流沟通。