MATLAB: Segmenting QRS complexes to perform synchronized averaging.

ecgdataqrs signal

Lately I have been trying to experiment with some ECG data and I am currently trying to perform synchronized averging on a noisy ECG signal.
Up till now I plotted the data, with the x-axis set as time in seconds and I determined a reference point for each realization of the signal, the peak of the QRS (R-wave) was deemed to be most obvious. As shown with the following code.
Now I want to manually segment 10 QRS complexes so that I may perform synchronized averging. I was thinking that maybe I should find the distance between two consecutive peaks and that would be one sample. Each sample would be set having the distance between peaks as their width. Then by using a loop I would add these 10 samples and find their mean. Any idea as to how I could implement it code-wise?

Best Answer

  • Do this in code instead. See Average of Wave from 10 waves in single graph for a relevant example.