from PhysioNet, the research resource for complex physiologic signals

QRS detection and waveform boundary recognition using ecgpuwave


ecgpuwave - QRS detector and waveform limit locator


ecgpuwave -r record -a annotator [ options ... ]


ecgpuwave analyses an ECG signal from the specified record, detecting the QRS complexes and locating the beginning, peak, and end of the P, QRS, and ST-T waveforms. The output of ecgpuwave is written as a standard WFDB-format annotation file associated with the specified annotator. This file can be converted into text format using rdann(1) or viewed using wave(1) .

The QRS detector is based on the algorithm of Pan and Tompkins (reference 1) with some improvements that make use of slope information (reference 2). Optionally, QRS annotations can be provided as input (see option -i), permitting the use of external QRS detectors such as sqrs(1) or manually-edited annotations (which can be created using wave(1) ). The waveform limit locator is based on the algorithm described in reference 3 and evaluated in references 3 and 4.

The output annotation file contains PWAVE ("p") and TWAVE ("t") annotations that indicate the P- and T-wave peaks, as well as QRS annotations (NORMAL ("N") if generated by the built-in QRS detector, or copies of the input QRS annotations if these were supplied). ecgpuwave classifies each T wave as type 0 (normal), 1 (inverted), 2 (positive monophasic), 3 (negative monophasic), 4 (biphasic negative-positive), or 5 (biphasic positive-negative); this numeric classification is written into the num field of each TWAVE annotation. The P, QRS, and T waveform onsets and ends are marked in the output annotation file using WFON ("(") and WFOFF (")") annotations. The num field of each WFON and WFOFF annotation designates the type of waveform with which it is associated: 0 for a P wave, 1 for a QRS complex, or 2 for a T wave.

Options include:

-f time
Begin at the specified time (default: the beginning of the record).
-i input-annotator
Read QRS locations from the specified input-annotator (and copy them to the output annotation file). Default: run the built-in QRS detector.
-n beat-type
Specify which beats to process (must be used together with -i): beat_type may be 0 (default: process all beats) or 1 (process only beats labelled as NORMAL ("N") by the input annotator).
-s n
Analyze signal n (default: signal 0).
-t time
Stop at the specified time (default: the end of the record).


It may be necessary to set and export the shell variable WFDB (see setwfdb(1) ).

See Also

rdann(1), sqrs(1), wave(1), wqrs(1)
Installation notes (Fortran version)
Notes for MATLAB/Octave users


1. Pan J and Tompkins WJ. A Real-Time QRS Detection Algorithm. IEEE Transactions on Biomedical Engineering 32(3):230-236, 1985.
2. Laguna P. New Electrocardiographic Signal Processing Techniques: Application to Long-term Records. Ph. D. disertation, Science Faculty, University of Zaragoza, 1990.
3. Laguna P, Jané R, Caminal P. Automatic Detection of Wave Boundaries in Multilead ECG Signals: Validation with the CSE Database. Computers and Biomedical Research 27(1):45-60, 1994.
4. Jané R, Blasi A, García J, and Laguna P. Evaluation of an automatic threshold based detector of waveform limits in Holter ECG with the QT database. Computers in Cardiology 24:295-298 (1997; available at


ecgpuwave is available as part of PhysioToolkit under the GPL (see Source below).


Pablo Laguna (, Raimon Jané, Eudald Bogatell, and David Vigo Anglada


Two implementations are available:

Important note for users of the MATLAB/Octave m-code version: The MATLAB version includes QRS delineation, but it does not include an integrated QRS detector such as the modified Pan-Tompkins detector in the original Fortran version, described above. You must provide an input annotation file containing the times of occurrence of the QRS complexes (use the dirann and anot input parameters to specify where to find this file; see the documentation for the MATLAB version for details). If no annotation file is supplied, limits.m attempts to use basicECG.m and qrsdet.m to detect the QRS complexes, but these files have not been contributed by their authors and are not available here, so this attempt will fail unless you have obtained or reimplemented these functions. PhysioToolkit includes several QRS detectors that can generate an annotation file if necessary; these include gqrs(1), sqrs(1), and wqrs(1) (all written in C and included in the WFDB Software Package), as well as the original Fortran version of ecgpuwave, which includes its own QRS detector. The sqrs and wqrs detectors are also available as MATLAB functions within the WFDB Toolbox for MATLAB.

Send feedback about this page to PhysioNet

Your comments and suggestions are welcome. We encourage you to use our feedback form to comment on this page. If you would like to receive a reply, please send your comments by email to

Updated Thursday, 9 July 2015 at 11:12 EDT

NIBIB/NIH/NIGMS National Institute for Biomedical Imaging and Bioengineering National Institutes of Health National Institute of General Medical Sciences