标记ECG信号中的峰 [英] Marking peaks in an ECG signal
本文介绍了标记ECG信号中的峰的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在从事ECG信号处理.我正在使用MIT-BIH心律失常数据库在此处找到.
I am working on ECG signal processing. I am using the MIT-BIH Arrhythmia database found here.
加载信号后,我正确标记了R峰. 然后我试图提取QRS复数,但是我做不到.
After loading the signal, I marked the R peaks correctly. Then I was trying to extract QRS complex, but I couldn't.
我想在峰上标记如下图所示:
I want to make marks on peaks like in this image:
. . . . . . .
. . . . . . .
这是我的代码:
clear all;
clc;
close all;
load ('G:\1.Thesis\data set\100\100m')
%% Remove base & gain
%%figure (1)
val = (val - 1024)/200;
ECGsignal = val(1,1:3600);
SAMPLES2READ = 3600;
time = (0:length(ECGsignal)-1)/SAMPLES2READ;
plot(time,ECGsignal); title('ECG Signal')
%% Finding Maxima or Peaks
figure (2)
[pks,locs] = findpeaks(ECGsignal);
plot(time,ECGsignal,time(locs),pks,'rv','MarkerFaceColor','r'); grid on
xlabel('Time'); ylabel('Voltage')
title('Find All Peaks'); legend('ECG Signal','Peaks')
%% Measuring Distance Between Peaks
%Find R peaks
figure (3)
[pks_Rwave,locs_Rwave] = findpeaks(ECGsignal,'MinPeakHeight',0.5,'MinPeakDistance',200);
fprintf('locs_Rwave = \n');
disp (locs_Rwave)
pks_Rwave1 = pks_Rwave*100;
fprintf('pks_Rwave = \n');
disp (pks_Rwave1)
plot(time,ECGsignal,time(locs_Rwave),pks_Rwave,'rv','MarkerFaceColor','r'); grid on
xlabel('Time'); ylabel('Voltage');
title('Find Prominent Peaks');
%% Q wave
ECG_inverted = -ECGsignal;
[pks_Qwave,locs_Qwave] = findpeaks(ECG_inverted,'MinPeakHeight',0.2,'MinPeakDistance',200);
k = 1:length(ECGsignal);
figure(5)
hold on
plot(k,ECGsignal);
plot(locs_Qwave,ECGsignal(locs_Qwave),'rs','MarkerFaceColor','g');
plot(locs_Rwave,ECGsignal(locs_Rwave),'rv','MarkerFaceColor','r');
grid on
axis([50 400 -0.8 2]);
legend('ECG signal','Q-wave','R-wave','S-wave');
xlabel('Samples'); ylabel('Voltage(mV)')
title('Q-wave , R-wave and S-wave');
推荐答案
我不确定我是否正确理解了您,但是这是一种获得所显示图表中标记的方法:
I'm not sure I understood you correctly, but here's one way to get markings like in the chart you showed:
rng(41826521);
sig = 1.6*randn(100,1); % Y-vector
smpl_id = 1:numel(sig); % X-vector; Or you can use find(idx) instead of smpl_id(idx).
figure(); plot(sig); grid on; hold on; grid minor;
idx = 2 < sig; plot(smpl_id(idx),sig(idx),'rv','MarkerFaceColor','r');
idx = -2.5 < sig & sig < -2; plot(smpl_id(idx),sig(idx),'rs','MarkerFaceColor','g');
idx = sig < -2.5; plot(smpl_id(idx),sig(idx),'rs','MarkerFaceColor','b');
这给出了:
这篇关于标记ECG信号中的峰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文