SlideShare a Scribd company logo
ACEEE Int. J. on Signal & Image Processing, Vol. 03, No. 01, Jan 2012



          QRS Detection Algorithm Using Savitzky-Golay
                              Filter
                                               Shreya Das 1, Dr. Monisha Chakraborty*, 1
      1
     Student, School of Bio-Science and Engineering, Jadavpur University, 188, Raja S. C. Mallik Road, Jadavpur, Kolkata,
                                                            India
*, 1
     Assistant Professor, School of Bio-Science and Engineering, Jadavpur University, 188, Raja S. C. Mallik Road, Jadavpur,
                                                        Kolkata, India
                             {shreyadas.jadavpuruniv@gmail.com, *monishack@school.jdvu.ac.in}


Abstract: QRS part of an electrocardiogram (ECG) is                    generated by the depolarisation wave which travels through
physiologically important for cardiac disease detection and            the interventricular septum via the bundle of His and bundle
extraction of this waveform from the raw signal is an important        branches and reaches the ventricular myocardium via the
part of ECG analysis. Pan Tompkins’ algorithm of QRS                   Purkinje fibre network. The impulse first depolarises the left
detection is an established method for extraction of this part
                                                                       side of the septum, and then spreads towards the right. The
of ECG. In this paper, a modification has been done on Pan
Tompkins’ algorithm by using a Savitzky-Golay filter in place          left ventricle has larger muscle mass and thus its depolarisation
of the high pass filter and differentiator of Pan Tompkins’            dominates the ECG wave. The QRS complex ends at the J
algorithm. Then QRS detection of normal as well as diseased            point and from here starts the ST segment. The ST segment
ECG has been done using both Pan Tompkins’ algorithm and               which lies between the J point and the onset of the T wave,
the modified algorithm developed in this work for comparison.          represents the period between the end of ventricular
Index Terms- electrocardiogram, QRS, Pan Tompkins’                     depolarisation and repolarisation. The T wave is the result of
algorithm, Savitzky-Golay filter                                       ventricular repolarisation. This wave in a normal ECG is
                                                                       asymmetrical as the first part of this wave is more gradual
                             I. INTRODUCTION                           than the subsequent part. The QT interval is measured from
                                                                       the beginning of the QRS complex to the end of the T wave.
    Processing and extraction of features from ECG is of               Measurement of this interval is done by taking into account
importance for doctors as many physical conditions and                 the heart rate as this interval elongates as heart rate decreases.
diseases can be detected using this signal as well as for              The last part of the ECG is the U wave which is found just
engineers who obtain ECG by different stimuli and subject it           after the T wave ends. It is a small deflection and generally
to various algorithms to obtain information. Also in case of           upright [1-2].
ECG it is easy to obtain the signal from the human subject as               In this paper, the disease that has been taken is known as
it is non-invasive as well as no drugs or radiations are               ventricular tachyarrhythmia and the data is obtained from
required. Cardiologists usually use the time-domain ECG                PhysioNet. Filtering of the signals has been done on ten data
signals which are recorded on strip-charts to analyze ECG              named cu01 to cu10 [11]. The raw data available in Physionet
signals. For diagnosis purposes, the parts of the waveforms            were passed through an active second order low-pass Bessel
present in normal ECGs and their corresponding occurrences             filter of cut-off frequency 70 Hz before digitization, and were
in the cardiac system are important.                                   digitised at 250 Hz with 12-bit resolution over a 10 V range (10
    The ECG wave consists of certain parts named as the P              mV nominal relative to the unamplified signals). Each data is
wave, PR interval, QRS complex, ST segment, T wave, QT                 approximately 8.5 minutes in duration. These data show the
interval and then the infrequent presence of U wave. The               presence of sustained ventricular tachycardia, ventricular
sino- atrial node or the SA node is positioned on the left             flutter and ventricular fibrillation [11].
atrium and this initiates the electrical signal causing atrial              Ventricular fibrillation is a serious condition of the heart
depolarisation. Although the atrium is anatomically divided            which may lead to stoppage of the heart if untreated.
into two parts, electrically they function as one part.                Precursor of fibrillation is often ventricular tachycardia or
Atria have very little muscle and produce a wave of small              flutter. So it is important to detect flutter and tachycardia in
amplitude called the P wave. The PR segment is the subse-              the ECG. Ventricular tachycardia is defined as three or more
quent part after the P wave and occurs as the electrical im-           ventricular extrasystoles in succession at a rate of more than
pulse is conducted through the atrio-ventricular node or the           120 beats per minute. The tachycardia may be self terminating
AV node, bundle of His and Purkinje fibres. The PR interval            but is described as “sustained” if it lasts longer than 30
can be defined as the time between the onset of atrial                 seconds [2]. This kind of tachycardia falls under broad
depolarisation and the onset of ventricular depolarisation.            category tachycardia which maybe of ventricular or
After the PR interval, QRS complex occurs. This complex is             supraventricular in origin but is mostly ventricular. In
                                                                       ventricular tachycardia the sequence of cardiac activation is
*.1
      Corresponding author                                             altered, and the impulse no longer follows the normal
© 2012 ACEEE                                                      55
DOI: 01.IJSIP.03.01.550
ACEEE Int. J. on Signal & Image Processing, Vol. 03, No. 01, Jan 2012


intraventricular conduction pathway. As a consequence, the                  The transfer function of the high pass filter is as shown in
morphology of the QRS complex is bizarre, and the duration                  equation (4).
of the complex is prolonged [2]. The ECG waveform which is                  Hhp(z)= P(z)/X(z)= z-16 – Hlp(z)/32                            (4)
obtained is overshadowed with noise signal due to which                     It is finally obtained as in equation (5).
essential features cannot be identified from it. There are many             Hhp(z)= (-z32 + 32z16 – 32z15 + 1)/(32z32 – 32z31)             (5)
algorithms present for denoising an ECG signal and popular                  The difference equation of the filter is as in equation (6).
among them is the Pan- Tompkins’ algorithm [3,9]. In this                         p (nT)= x(nT – 16T) – 0.0313[y(nT – T) + x(nT) – x(nT –
algorithm feature extraction is restricted to QRS detection                                   32T)]                                        (6)
from the original signal by passing the signal through a band               The low cut off frequency of the filter is about 5 Hz and delay
pass filter and a differentiator and then squaring of the                   is 80 ms. The gain of this filter is 1 [9].
resulting signal. The band pass filter is the one which                     ii) Derivative
eliminates noise and the differentiator is used to provide                       To provide information about the slope of the QRS
information about the slope of the QRS complex. Squaring of                 complex, differentiation of the signal is done, after it has been
the signal is done so that all negative values in the waveform              through the band pass filter [9]. A five point derivative is
are changed to positive values. This process is a nonlinear                 implemented using the transfer function as shown in equation
operation which amplifies the output of the differentiator                  (7).
nonlinearly. Then the signal is passed through a moving                     H(z)= 0.1(2 + z-1 – z-3 – 2z-4 )                               (7)
integrator to obtain the QRS waves [3,9].                                   The difference equation for this transfer function is as shown
    This paper shows an alternative way of QRS detection                    in equation (8).
from the ECG signal using Savitzky-Golay filter in place of                      y (nT)= (1/8)*[2x(nT) + x(nT – T) – x( nT – 3T) – 2x(nT –
the band pass filter of the Pan Tompkins’ algorithm. A normal                                            4T)                               (8)
as well as a diseased ECG data showing ventricular                          The fraction 1/8 in equation (8) is an approximation of the actual
tachyarrythmic ECG data are taken and Pan Tompkins’                         gain of 0.1. This derivative approximates the ideal derivative in
algorithm using Savitzky-Golay filter is implemented. The                   the dc through 30 Hz frequency range, and it has a filter delay of
respective QRS detected signals have been obtained from                     10 ms [9].
both types of data.                                                         iii) Squaring
                                                                                 Now, the signal is to be squared. This is the non linear
                            II. THEORY                                      processing of the signal. It is done to get all positive values so
                                                                            that later these values can be processed to get the corresponding
A. Pan Tompkins’ Algorithm
                                                                            squared waves. Also this processing emphasizes the higher
i) Band pass filter                                                         frequencies of the ECG signal which are due to the presence of
    The band pass filter that has been used has been done                   the QRS complexes [9]. Point by point squaring of the signal
by using a low pass filter and then a high pass filter in cascade.          obtained from the differentiator is implemented by equation (9).
The purpose low pass filter is to suppress high frequency                    y ( nT)= [x(nT)]2                                            (9)
noise [9]. Filter design using digital filters having integer
coefficients allows real time processing speeds. No floating                iv) Moving Integrator
point processing required so speed is high. This band pass                      The slope of the R wave is not the absolute way to detect
filter for QRS detection algorithm reduces noise in the ECG                 QRS complexes in an ECG. There may be many long duration
signal by matching the spectrum of average QRS complex,                     and large amplitude QRS waves in the ECG which is abnormal.
eliminating noise due to muscle artefacts, 60 Hz power line                 Only slope of R wave cannot detect these waves [9]. So a moving
interference, baseline wandering and T wave interference. QRS               window integrator is used so that these waves can be detected
energy is maximised by the pass band of approximately in the                as well. The difference equation for this moving window
5 to 15 Hz range. The filter is an integer filter which has poles           integrator is as shown in equation (10).
located such so as to cancel out the zeroes [9]. The second                  y(nT)= (1/N) [(x(nT) – (N-1)T) + (x(nT) – (N-2)T) +…+x(nT)]
order low pass filter has the transfer function of as shown in                                            (10)
equation (1).                                                               It is important to choose an appropriate value for N, which is the
   H(z)= (1- z-6)2/(1- z-1)2                                   (1)          number of samples in the width of the moving window [9].
The cut- off frequency of the filter is 11 Hz, delay is 5 samples           B. Savitzky-Golay Filter
and the gain is 36 [9]. The difference equation of the filter is as
                                                                                 Savitzky-Golay filter has been used both for ECG noise
shown in equation (2).
                                                                            reduction and compression [4-8]. It has been used because of
 y (nT)= 2y(nT- T) - y(nT - 2T) + x(nT) – 2x(nT – 6T) + x(nT –
                                                                            its signal following capabilities by least squares approach [8,10].
 12T)                                                           (2)
                                                                            The Savitzky-Golay filter that has been used in this paper is of
The high pass filter is implemented by subtracting a first order            zero order and of frame length 41.
low pass filter from an all pass filter with delay [9]. The transfer
function of the low pass filter is as shown in equation (3).
 Hlp(z)= Y(z)/X(z)= (1 – z-32)/(1 – z-1)                        (3)
© 2012 ACEEE                                                           56
DOI: 01.IJSIP.03.01. 550
ACEEE Int. J. on Signal & Image Processing, Vol. 03, No. 01, Jan 2012




                                   Fig 2: Block diagram showing QRS detection using Savitzky-Golay filter

                                                                                                    IV. RESULTS
                          III. PROCEDURE
                                                                             The established Pan Tomkins’ algorithm as shown in Fig. 1
   On both the normal and diseased data, Pan Tompkins’
                                                                         has been applied on normal and ventricular tachyarrythmic ECG
algorithm has been implemented using the conventional
                                                                         data and the final QRS detected signals obtained are shown in
algorithm and then using Savitzky-Golay filter in place of the
                                                                         Fig. 3 and Fig. 5 respectively. The results obtained after applying
high pass filter and differentiator. The block diagrams of these
                                                                         the developed algorithm using Savitzky-Golay filter is shown
two methods are shown in Fig. 1 and Fig.2 respectively.
                                                                         in Fig. 4 and Fig. 6 for normal and diseased ECG data
                                                                         respectively. The different blocks of the algorithm have
                                                                         applied as shown in Fig. 2 and the final QRS detected signals
                                                                         are obtained.




                             Fig. 3: Result of the last block of Pan Tompkins’ algorithm for normal ECG data




  Fig. 4: Result of the last block of Pan Tompkins’ algorithm for         Fig. 5: Result of the last block of Pan Tompkins’ algorithm with
                      diseased ECG (data cu04)                                       Savitzky-Golay filter for normal ECG data


© 2012 ACEEE                                                        57
DOI: 01.IJSIP.03.01.550
ACEEE Int. J. on Signal & Image Processing, Vol. 03, No. 01, Jan 2012


                         V. CONCLUSION                                    [1] [4] Dotsinsky, G. Mihov, “A simple approach for tremor
                                                                          suppression in electrocardiograms”, in Int. J. Bioautomation, 2010,
    From the results obtained using the developed algorithm,              14(2), 129-138.
it can be observed that QRS detection is possible with higher             [5] C.M. Fira, Liviu Goras, “An ECG signals compression method
amplitudes of the detected QRS peaks. This algorithm also                 and its validation using NNs”, in IEEE Trans. Biomed. Eng. 2008,
eliminates the need of the high pass filter and the differentiator        vol.55, no.- 4.
blocks as present in Pan Tompkins’ algorithm.                             [6] M. Lascu, D. Lascu, “ Electrocardiogram compression and
                                                                          optimal ECG filtering algorithms”, in WSEAS Transactions on
                                                                          Computers, Issue 4, Volume 7, April 2008.
                           REFERENCES                                     [7] K. Pandia, S. Ravindran, R. Cole, G. Kovacs, L. Giovangrandi,
[1] Gary D. Clifford, Francisco Azuaje, Patrick E. McSharry,              “ Motion artefact cancellation to obtain heart sounds from a single
Advanced Methods and Tools for ECG Data Analysis. Engg. in                chest- worn accelerometer” in IEEE ICASSP 2010.
Medicine & Biology, Boston, London, 2006.                                 [8] S. Hargittai, “ Savitzky-Golay least squares polynomial filters
[2] Francis Morris, June Edhouse, William J. Brady, John Camm,            in ECG signal processing” in IEEE, Computers in Cardiology, 2005.
ABC of Clinical Electrocardiography.BMJ Books, London, 2003.              [9] W.J. Tompkins, Biomedical Digital Signal Processing.
[3] J. Pan, W.J. Tompkins, “A real-time QRS detection algorithm”,         Englewood Cliffs, NJ, Prentice Hall, 1993.
IEEE Trans. Biomed. Eng. 1985, vol.32, pp. 230-236.                       [10] Sophocles J. Orfanidis, Introduction to Signal Processing.
                                                                          Prentice Hall, 2010.
                                                                          [11] www.physionet.org/physiobank/database/cudb/




© 2012 ACEEE                                                         58
DOI: 01.IJSIP.03.01. 550

More Related Content

PPTX
final ppt
PDF
Ecg interpretation
PDF
Intelligent Heart Disease Recognition using Neural Networks
PDF
Jq3516631668
PDF
Classification and Detection of ECG-signals using Artificial Neural Networks
PPTX
Implication of 3D Mapping in EP
PPTX
enhancement of ecg signal using wavelet transfform
PDF
Rule Based Identification of Cardiac Arrhythmias from Enhanced ECG Signals Us...
final ppt
Ecg interpretation
Intelligent Heart Disease Recognition using Neural Networks
Jq3516631668
Classification and Detection of ECG-signals using Artificial Neural Networks
Implication of 3D Mapping in EP
enhancement of ecg signal using wavelet transfform
Rule Based Identification of Cardiac Arrhythmias from Enhanced ECG Signals Us...

What's hot (20)

PDF
Algorithm for the Representation of Parameter Values of Electrocardiogram
PPTX
Steady State Free Precession MRA
PPT
2011 10 unipolar electrograms
PDF
Analysis of RS-Segment to Evaluate the Effect of Ventricular Depolarization d...
PDF
Electrophysiologic Study
PDF
Identification of Myocardial Infarction from Multi-Lead ECG signal
PPT
Long term post Ventricular tachycardia ablation guided by non contact mapping...
PDF
IRJET- Detection of Abnormal ECG Signal using DWT Feature Extraction and CNN
PDF
Classification of Arrhythmia from ECG Signals using MATLAB
PPT
EPS 的基本設定_20120916_南區
PPTX
Cardiac MRI principle
PDF
Cardio Logical Signal Processing for Arrhythmia Detection with Comparative An...
PDF
Ecg signal processing for detection and classification of cardiac diseases
DOCX
PPTX
Noise removal using_ecg
PPTX
Islamic University Sample Question Solution 2019 (Biomedical Signal Processing)
PPTX
Ecg compression using fft
PPTX
Understanding pacemakers
PDF
Icd basic 042411(dr chang)
PDF
Focus on the origin of NCT
Algorithm for the Representation of Parameter Values of Electrocardiogram
Steady State Free Precession MRA
2011 10 unipolar electrograms
Analysis of RS-Segment to Evaluate the Effect of Ventricular Depolarization d...
Electrophysiologic Study
Identification of Myocardial Infarction from Multi-Lead ECG signal
Long term post Ventricular tachycardia ablation guided by non contact mapping...
IRJET- Detection of Abnormal ECG Signal using DWT Feature Extraction and CNN
Classification of Arrhythmia from ECG Signals using MATLAB
EPS 的基本設定_20120916_南區
Cardiac MRI principle
Cardio Logical Signal Processing for Arrhythmia Detection with Comparative An...
Ecg signal processing for detection and classification of cardiac diseases
Noise removal using_ecg
Islamic University Sample Question Solution 2019 (Biomedical Signal Processing)
Ecg compression using fft
Understanding pacemakers
Icd basic 042411(dr chang)
Focus on the origin of NCT
Ad

Similar to QRS Detection Algorithm Using Savitzky-Golay Filter (20)

PDF
Comparison of Normal and Ventricular Tachyarrhythmic Electrocardiograms using...
PDF
Wavelet transform based on qrs detection using diodic algorithm
PDF
Af4103186190
PPTX
Ecg interpretations
PDF
Paper id 36201509
PPTX
Ecg interpretation
PDF
PPT
ECG.ppt in this ppt heart rate rhythm, ecg waves all can study
PPTX
PDF
Ax32327332
PPTX
1. Basic ECG.pptxfffffffffffffffffffffffff
PPTX
Biomedical signal processing
PDF
ANALYSIS OF ECG SIGNAL USING SELF ORGANISING MAP
PPTX
Ecg ppp.pptx 2
PPTX
ECG persentayion for study and university seminar
PPTX
Normal ecg interpretation
PDF
Heart rate detection using hilbert transform
PPTX
basicsofecg-150707084411-lva1-app6892.pptx
Comparison of Normal and Ventricular Tachyarrhythmic Electrocardiograms using...
Wavelet transform based on qrs detection using diodic algorithm
Af4103186190
Ecg interpretations
Paper id 36201509
Ecg interpretation
ECG.ppt in this ppt heart rate rhythm, ecg waves all can study
Ax32327332
1. Basic ECG.pptxfffffffffffffffffffffffff
Biomedical signal processing
ANALYSIS OF ECG SIGNAL USING SELF ORGANISING MAP
Ecg ppp.pptx 2
ECG persentayion for study and university seminar
Normal ecg interpretation
Heart rate detection using hilbert transform
basicsofecg-150707084411-lva1-app6892.pptx
Ad

More from IDES Editor (20)

PDF
Power System State Estimation - A Review
PDF
Artificial Intelligence Technique based Reactive Power Planning Incorporating...
PDF
Design and Performance Analysis of Genetic based PID-PSS with SVC in a Multi-...
PDF
Optimal Placement of DG for Loss Reduction and Voltage Sag Mitigation in Radi...
PDF
Line Losses in the 14-Bus Power System Network using UPFC
PDF
Study of Structural Behaviour of Gravity Dam with Various Features of Gallery...
PDF
Assessing Uncertainty of Pushover Analysis to Geometric Modeling
PDF
Secure Multi-Party Negotiation: An Analysis for Electronic Payments in Mobile...
PDF
Selfish Node Isolation & Incentivation using Progressive Thresholds
PDF
Various OSI Layer Attacks and Countermeasure to Enhance the Performance of WS...
PDF
Responsive Parameter based an AntiWorm Approach to Prevent Wormhole Attack in...
PDF
Cloud Security and Data Integrity with Client Accountability Framework
PDF
Genetic Algorithm based Layered Detection and Defense of HTTP Botnet
PDF
Enhancing Data Storage Security in Cloud Computing Through Steganography
PDF
Low Energy Routing for WSN’s
PDF
Permutation of Pixels within the Shares of Visual Cryptography using KBRP for...
PDF
Rotman Lens Performance Analysis
PDF
Band Clustering for the Lossless Compression of AVIRIS Hyperspectral Images
PDF
Microelectronic Circuit Analogous to Hydrogen Bonding Network in Active Site ...
PDF
Texture Unit based Monocular Real-world Scene Classification using SOM and KN...
Power System State Estimation - A Review
Artificial Intelligence Technique based Reactive Power Planning Incorporating...
Design and Performance Analysis of Genetic based PID-PSS with SVC in a Multi-...
Optimal Placement of DG for Loss Reduction and Voltage Sag Mitigation in Radi...
Line Losses in the 14-Bus Power System Network using UPFC
Study of Structural Behaviour of Gravity Dam with Various Features of Gallery...
Assessing Uncertainty of Pushover Analysis to Geometric Modeling
Secure Multi-Party Negotiation: An Analysis for Electronic Payments in Mobile...
Selfish Node Isolation & Incentivation using Progressive Thresholds
Various OSI Layer Attacks and Countermeasure to Enhance the Performance of WS...
Responsive Parameter based an AntiWorm Approach to Prevent Wormhole Attack in...
Cloud Security and Data Integrity with Client Accountability Framework
Genetic Algorithm based Layered Detection and Defense of HTTP Botnet
Enhancing Data Storage Security in Cloud Computing Through Steganography
Low Energy Routing for WSN’s
Permutation of Pixels within the Shares of Visual Cryptography using KBRP for...
Rotman Lens Performance Analysis
Band Clustering for the Lossless Compression of AVIRIS Hyperspectral Images
Microelectronic Circuit Analogous to Hydrogen Bonding Network in Active Site ...
Texture Unit based Monocular Real-world Scene Classification using SOM and KN...

Recently uploaded (20)

PPTX
Machine Learning_overview_presentation.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Spectroscopy.pptx food analysis technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Approach and Philosophy of On baking technology
PDF
Electronic commerce courselecture one. Pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
sap open course for s4hana steps from ECC to s4
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
cuic standard and advanced reporting.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
A Presentation on Artificial Intelligence
PDF
Encapsulation theory and applications.pdf
Machine Learning_overview_presentation.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Spectral efficient network and resource selection model in 5G networks
Spectroscopy.pptx food analysis technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Approach and Philosophy of On baking technology
Electronic commerce courselecture one. Pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
MIND Revenue Release Quarter 2 2025 Press Release
sap open course for s4hana steps from ECC to s4
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Big Data Technologies - Introduction.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
NewMind AI Weekly Chronicles - August'25-Week II
cuic standard and advanced reporting.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Network Security Unit 5.pdf for BCA BBA.
A Presentation on Artificial Intelligence
Encapsulation theory and applications.pdf

QRS Detection Algorithm Using Savitzky-Golay Filter

  • 1. ACEEE Int. J. on Signal & Image Processing, Vol. 03, No. 01, Jan 2012 QRS Detection Algorithm Using Savitzky-Golay Filter Shreya Das 1, Dr. Monisha Chakraborty*, 1 1 Student, School of Bio-Science and Engineering, Jadavpur University, 188, Raja S. C. Mallik Road, Jadavpur, Kolkata, India *, 1 Assistant Professor, School of Bio-Science and Engineering, Jadavpur University, 188, Raja S. C. Mallik Road, Jadavpur, Kolkata, India {shreyadas.jadavpuruniv@gmail.com, *monishack@school.jdvu.ac.in} Abstract: QRS part of an electrocardiogram (ECG) is generated by the depolarisation wave which travels through physiologically important for cardiac disease detection and the interventricular septum via the bundle of His and bundle extraction of this waveform from the raw signal is an important branches and reaches the ventricular myocardium via the part of ECG analysis. Pan Tompkins’ algorithm of QRS Purkinje fibre network. The impulse first depolarises the left detection is an established method for extraction of this part side of the septum, and then spreads towards the right. The of ECG. In this paper, a modification has been done on Pan Tompkins’ algorithm by using a Savitzky-Golay filter in place left ventricle has larger muscle mass and thus its depolarisation of the high pass filter and differentiator of Pan Tompkins’ dominates the ECG wave. The QRS complex ends at the J algorithm. Then QRS detection of normal as well as diseased point and from here starts the ST segment. The ST segment ECG has been done using both Pan Tompkins’ algorithm and which lies between the J point and the onset of the T wave, the modified algorithm developed in this work for comparison. represents the period between the end of ventricular Index Terms- electrocardiogram, QRS, Pan Tompkins’ depolarisation and repolarisation. The T wave is the result of algorithm, Savitzky-Golay filter ventricular repolarisation. This wave in a normal ECG is asymmetrical as the first part of this wave is more gradual I. INTRODUCTION than the subsequent part. The QT interval is measured from the beginning of the QRS complex to the end of the T wave. Processing and extraction of features from ECG is of Measurement of this interval is done by taking into account importance for doctors as many physical conditions and the heart rate as this interval elongates as heart rate decreases. diseases can be detected using this signal as well as for The last part of the ECG is the U wave which is found just engineers who obtain ECG by different stimuli and subject it after the T wave ends. It is a small deflection and generally to various algorithms to obtain information. Also in case of upright [1-2]. ECG it is easy to obtain the signal from the human subject as In this paper, the disease that has been taken is known as it is non-invasive as well as no drugs or radiations are ventricular tachyarrhythmia and the data is obtained from required. Cardiologists usually use the time-domain ECG PhysioNet. Filtering of the signals has been done on ten data signals which are recorded on strip-charts to analyze ECG named cu01 to cu10 [11]. The raw data available in Physionet signals. For diagnosis purposes, the parts of the waveforms were passed through an active second order low-pass Bessel present in normal ECGs and their corresponding occurrences filter of cut-off frequency 70 Hz before digitization, and were in the cardiac system are important. digitised at 250 Hz with 12-bit resolution over a 10 V range (10 The ECG wave consists of certain parts named as the P mV nominal relative to the unamplified signals). Each data is wave, PR interval, QRS complex, ST segment, T wave, QT approximately 8.5 minutes in duration. These data show the interval and then the infrequent presence of U wave. The presence of sustained ventricular tachycardia, ventricular sino- atrial node or the SA node is positioned on the left flutter and ventricular fibrillation [11]. atrium and this initiates the electrical signal causing atrial Ventricular fibrillation is a serious condition of the heart depolarisation. Although the atrium is anatomically divided which may lead to stoppage of the heart if untreated. into two parts, electrically they function as one part. Precursor of fibrillation is often ventricular tachycardia or Atria have very little muscle and produce a wave of small flutter. So it is important to detect flutter and tachycardia in amplitude called the P wave. The PR segment is the subse- the ECG. Ventricular tachycardia is defined as three or more quent part after the P wave and occurs as the electrical im- ventricular extrasystoles in succession at a rate of more than pulse is conducted through the atrio-ventricular node or the 120 beats per minute. The tachycardia may be self terminating AV node, bundle of His and Purkinje fibres. The PR interval but is described as “sustained” if it lasts longer than 30 can be defined as the time between the onset of atrial seconds [2]. This kind of tachycardia falls under broad depolarisation and the onset of ventricular depolarisation. category tachycardia which maybe of ventricular or After the PR interval, QRS complex occurs. This complex is supraventricular in origin but is mostly ventricular. In ventricular tachycardia the sequence of cardiac activation is *.1 Corresponding author altered, and the impulse no longer follows the normal © 2012 ACEEE 55 DOI: 01.IJSIP.03.01.550
  • 2. ACEEE Int. J. on Signal & Image Processing, Vol. 03, No. 01, Jan 2012 intraventricular conduction pathway. As a consequence, the The transfer function of the high pass filter is as shown in morphology of the QRS complex is bizarre, and the duration equation (4). of the complex is prolonged [2]. The ECG waveform which is Hhp(z)= P(z)/X(z)= z-16 – Hlp(z)/32 (4) obtained is overshadowed with noise signal due to which It is finally obtained as in equation (5). essential features cannot be identified from it. There are many Hhp(z)= (-z32 + 32z16 – 32z15 + 1)/(32z32 – 32z31) (5) algorithms present for denoising an ECG signal and popular The difference equation of the filter is as in equation (6). among them is the Pan- Tompkins’ algorithm [3,9]. In this p (nT)= x(nT – 16T) – 0.0313[y(nT – T) + x(nT) – x(nT – algorithm feature extraction is restricted to QRS detection 32T)] (6) from the original signal by passing the signal through a band The low cut off frequency of the filter is about 5 Hz and delay pass filter and a differentiator and then squaring of the is 80 ms. The gain of this filter is 1 [9]. resulting signal. The band pass filter is the one which ii) Derivative eliminates noise and the differentiator is used to provide To provide information about the slope of the QRS information about the slope of the QRS complex. Squaring of complex, differentiation of the signal is done, after it has been the signal is done so that all negative values in the waveform through the band pass filter [9]. A five point derivative is are changed to positive values. This process is a nonlinear implemented using the transfer function as shown in equation operation which amplifies the output of the differentiator (7). nonlinearly. Then the signal is passed through a moving H(z)= 0.1(2 + z-1 – z-3 – 2z-4 ) (7) integrator to obtain the QRS waves [3,9]. The difference equation for this transfer function is as shown This paper shows an alternative way of QRS detection in equation (8). from the ECG signal using Savitzky-Golay filter in place of y (nT)= (1/8)*[2x(nT) + x(nT – T) – x( nT – 3T) – 2x(nT – the band pass filter of the Pan Tompkins’ algorithm. A normal 4T) (8) as well as a diseased ECG data showing ventricular The fraction 1/8 in equation (8) is an approximation of the actual tachyarrythmic ECG data are taken and Pan Tompkins’ gain of 0.1. This derivative approximates the ideal derivative in algorithm using Savitzky-Golay filter is implemented. The the dc through 30 Hz frequency range, and it has a filter delay of respective QRS detected signals have been obtained from 10 ms [9]. both types of data. iii) Squaring Now, the signal is to be squared. This is the non linear II. THEORY processing of the signal. It is done to get all positive values so that later these values can be processed to get the corresponding A. Pan Tompkins’ Algorithm squared waves. Also this processing emphasizes the higher i) Band pass filter frequencies of the ECG signal which are due to the presence of The band pass filter that has been used has been done the QRS complexes [9]. Point by point squaring of the signal by using a low pass filter and then a high pass filter in cascade. obtained from the differentiator is implemented by equation (9). The purpose low pass filter is to suppress high frequency y ( nT)= [x(nT)]2 (9) noise [9]. Filter design using digital filters having integer coefficients allows real time processing speeds. No floating iv) Moving Integrator point processing required so speed is high. This band pass The slope of the R wave is not the absolute way to detect filter for QRS detection algorithm reduces noise in the ECG QRS complexes in an ECG. There may be many long duration signal by matching the spectrum of average QRS complex, and large amplitude QRS waves in the ECG which is abnormal. eliminating noise due to muscle artefacts, 60 Hz power line Only slope of R wave cannot detect these waves [9]. So a moving interference, baseline wandering and T wave interference. QRS window integrator is used so that these waves can be detected energy is maximised by the pass band of approximately in the as well. The difference equation for this moving window 5 to 15 Hz range. The filter is an integer filter which has poles integrator is as shown in equation (10). located such so as to cancel out the zeroes [9]. The second y(nT)= (1/N) [(x(nT) – (N-1)T) + (x(nT) – (N-2)T) +…+x(nT)] order low pass filter has the transfer function of as shown in (10) equation (1). It is important to choose an appropriate value for N, which is the H(z)= (1- z-6)2/(1- z-1)2 (1) number of samples in the width of the moving window [9]. The cut- off frequency of the filter is 11 Hz, delay is 5 samples B. Savitzky-Golay Filter and the gain is 36 [9]. The difference equation of the filter is as Savitzky-Golay filter has been used both for ECG noise shown in equation (2). reduction and compression [4-8]. It has been used because of y (nT)= 2y(nT- T) - y(nT - 2T) + x(nT) – 2x(nT – 6T) + x(nT – its signal following capabilities by least squares approach [8,10]. 12T) (2) The Savitzky-Golay filter that has been used in this paper is of The high pass filter is implemented by subtracting a first order zero order and of frame length 41. low pass filter from an all pass filter with delay [9]. The transfer function of the low pass filter is as shown in equation (3). Hlp(z)= Y(z)/X(z)= (1 – z-32)/(1 – z-1) (3) © 2012 ACEEE 56 DOI: 01.IJSIP.03.01. 550
  • 3. ACEEE Int. J. on Signal & Image Processing, Vol. 03, No. 01, Jan 2012 Fig 2: Block diagram showing QRS detection using Savitzky-Golay filter IV. RESULTS III. PROCEDURE The established Pan Tomkins’ algorithm as shown in Fig. 1 On both the normal and diseased data, Pan Tompkins’ has been applied on normal and ventricular tachyarrythmic ECG algorithm has been implemented using the conventional data and the final QRS detected signals obtained are shown in algorithm and then using Savitzky-Golay filter in place of the Fig. 3 and Fig. 5 respectively. The results obtained after applying high pass filter and differentiator. The block diagrams of these the developed algorithm using Savitzky-Golay filter is shown two methods are shown in Fig. 1 and Fig.2 respectively. in Fig. 4 and Fig. 6 for normal and diseased ECG data respectively. The different blocks of the algorithm have applied as shown in Fig. 2 and the final QRS detected signals are obtained. Fig. 3: Result of the last block of Pan Tompkins’ algorithm for normal ECG data Fig. 4: Result of the last block of Pan Tompkins’ algorithm for Fig. 5: Result of the last block of Pan Tompkins’ algorithm with diseased ECG (data cu04) Savitzky-Golay filter for normal ECG data © 2012 ACEEE 57 DOI: 01.IJSIP.03.01.550
  • 4. ACEEE Int. J. on Signal & Image Processing, Vol. 03, No. 01, Jan 2012 V. CONCLUSION [1] [4] Dotsinsky, G. Mihov, “A simple approach for tremor suppression in electrocardiograms”, in Int. J. Bioautomation, 2010, From the results obtained using the developed algorithm, 14(2), 129-138. it can be observed that QRS detection is possible with higher [5] C.M. Fira, Liviu Goras, “An ECG signals compression method amplitudes of the detected QRS peaks. This algorithm also and its validation using NNs”, in IEEE Trans. Biomed. Eng. 2008, eliminates the need of the high pass filter and the differentiator vol.55, no.- 4. blocks as present in Pan Tompkins’ algorithm. [6] M. Lascu, D. Lascu, “ Electrocardiogram compression and optimal ECG filtering algorithms”, in WSEAS Transactions on Computers, Issue 4, Volume 7, April 2008. REFERENCES [7] K. Pandia, S. Ravindran, R. Cole, G. Kovacs, L. Giovangrandi, [1] Gary D. Clifford, Francisco Azuaje, Patrick E. McSharry, “ Motion artefact cancellation to obtain heart sounds from a single Advanced Methods and Tools for ECG Data Analysis. Engg. in chest- worn accelerometer” in IEEE ICASSP 2010. Medicine & Biology, Boston, London, 2006. [8] S. Hargittai, “ Savitzky-Golay least squares polynomial filters [2] Francis Morris, June Edhouse, William J. Brady, John Camm, in ECG signal processing” in IEEE, Computers in Cardiology, 2005. ABC of Clinical Electrocardiography.BMJ Books, London, 2003. [9] W.J. Tompkins, Biomedical Digital Signal Processing. [3] J. Pan, W.J. Tompkins, “A real-time QRS detection algorithm”, Englewood Cliffs, NJ, Prentice Hall, 1993. IEEE Trans. Biomed. Eng. 1985, vol.32, pp. 230-236. [10] Sophocles J. Orfanidis, Introduction to Signal Processing. Prentice Hall, 2010. [11] www.physionet.org/physiobank/database/cudb/ © 2012 ACEEE 58 DOI: 01.IJSIP.03.01. 550