afonso | R Documentation |
Detect R peaks of the QRS complex in a raw ECG record, based on the filter-bank algorithm proposed by Afonso et al. (1999)
afonso(ecg, fs)
ecg |
The input single-channel input vector (raw ECG) |
fs |
The frequency in Hz with which the ecg was sampled |
The Afonso et al. algorithm uses filter banks (polyphase implementation) and determines candidate R-peaks on downsampled signals in different frequency bands. Initially, a large number of false positives are generated. Then, logic is added to decrease the number of false positives while maintaining a low number of false negatives. This method is currently one of the most accurate available (> 99.5 the fastest (because the logic is applied on downsampled signals).
The present R implementation is based on the Matlab/Octave version named nqrsdetect.m, Copyright (C) 2006 by Rupert Ortner, retrieved from the internet pages maintained by Alois Schloegl (http://pub.ist.ac.at/~schloegl/). A few improvements and minor bug fixes were made, as well as comments added.
Numeric array containing the indices (sample numbers) at which the fiducial R-peaks were found
Geert van Boxtel, G.J.M.vanBoxtel@gmail.com
Afonso, V.X., Tompkins, W.J., Nguyen, T.Q., & Luo, S. (1999). ECG beat detection using filter banks. IEEE Transactions on Biomedical Engineering, 46(2), 192-202. DOI: 10.1109/10.740882
data(rec100) fs <- 360 pks <- afonso(rec100$MLII, fs) ## Not run: # plot first 10 seconds of data N <- 10 * fs plot (rec100$time[1:N], rec100$MLII[1:N], type = "l", main = "MIT-BIH database, record 100", xlab = "Time (s)", ylab = "Amplitude (mV)") points (pks[which(pks <= N)] / fs, rec100$MLII[pks[which(pks <= N)]], col="red") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.