Borrar filtros
Borrar filtros

Signal segmentation error: how to select a specific number of points before and after the ECG signal?

1 visualización (últimos 30 días)
I want to segment an ECG signal in heartbeats by taking a number of sample points before and after each R-peak. I did the following loop:
for i=1:length(qrs_i_raw)
%qrs_i_raw has the index location of the peak
it gives me this error
Index exceeds the number of array elements (650000).
I understand why I get this error, but how can I modify the loop so for the first and last beat it will take just the existing points before the first beat and the remaining points after the last beat?

Respuesta aceptada

Star Strider
Star Strider el 9 de Feb. de 2021
See How do I find and plot the average of action potentials from a trace? for an appropriate approach. Substitute your EKG vector and time vector for the signals in that code, and adjust the ‘ofst’ value to be the one you want (typically about 450 ms for an EKG, so that value would depend on the sampling frequency of your EKG and the heart rate, so multiply the sampling frequency in Hz by 0.45 to get the number of samples to use for ‘ofst’). It may be necessary to adjust that for the heart rate, so typically that interval should be slightly less than ½ of the previous — or mean — R-R interval.

Más respuestas (1)

Mathieu NOE
Mathieu NOE el 9 de Feb. de 2021
hello Ioana
I modified a bit your code , hope it works
nn = length(qrs_i_raw);
% first and last buffer - specific cases
% general cases
for i=2:nn-1
beat(i,:)=ECG(qrs_i_raw(i)-before:qrs_i_raw(i)+after); % pls note index i is same on both sides of the equation
%qrs_i_raw has the index location of the peak


Más información sobre ECG / EKG en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by