pantompkins: Pan & Tompkins QRS detection

pantompkinsR Documentation

Pan & Tompkins QRS detection

Description

Detect R peaks of the QRS complex in a raw ECG record, based on the algorithm proposed by Pan & Tompkins (1985)

Usage

pantompkins(ecg, fs)

Arguments

ecg

The input single-channel input vector (raw ECG)

fs

The frequency in Hz with which the ecg was sampled

Details

This function attempts to detect ECG fiducial points in a single-channel electrocardiogram signal using the algorithm proposed by Pan & Tompkins (1985). The algorithm was originally developed to be implemented in hardware. Here a software implementation with digital filters, and some improvements:

  1. Filter the signal 5-15 Hz (Butterworth); pre- and postpad the signal with 1 s of reversed data to ramp up and down the filter

  2. Compute the derivative

  3. Square the derivative

  4. Apply a moving average (0.15 s filter length)

  5. Search for the peak using findpeaks (mind = 200, minh = 2*sd of moving average), lookup local maximum in signal

Value

Numeric array containing the indices (sample numbers) at which the fiducial R-peaks were found

Author(s)

Geert van Boxtel, G.J.M.vBoxtel@gmail.com

References

Pan, J., & Tompkins, W.J. (1985). A real-time QRS detection algorithm. IEEE Transactions on Biomedical Engineering, Vol. BME-32, Issue 3, 230-236, DOI: 10.1109/TBME.1985.325532

Examples

data(rec100)
fs <- 360
pks <- pantompkins(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)

gjmvanboxtel/QRSdetect documentation built on Sept. 13, 2022, 10:41 p.m.