Signal Processing of Stress Test ECG Using MATLAB

DOI : 10.17577/IJERTV6IS080073

Download Full-Text PDF Cite this Publication

Text Only Version

Signal Processing of Stress Test ECG Using MATLAB

Omer Mukhtar Wani

M. Tech ECE

Geeta Engineering College, Panipat

Abstract -Electrocardiography is used to record the electrical activity of the heart over a period of time. It is used to monitor patients, detect arrhythmias and other diseases and analyze the overall cardiac performance. . An ECG stress test monitors the heart rate under external stress, which is increasing over time. It helps to diagnose diseases like the coronary artery disease (how likely it is to happen) or changes in the appearance of arrhythmias. It is examined how the patient responds to the stress and how the blood pressure changes. If the patient experiences chest pain, the test is terminated.

Key word; ECG, heartbeat, CAD, Algorithm, Low-pass Filtering, Peak Detection High-pass Filtering, Band-pass Filtering

1 INTRODUCTION Electrocardiography is used to record the electrical activity of the heart over a period of time. It is used to monitor patients, detect arrhythmias and other diseases and analyze the overall cardiac performance. By using 12 electrodes placed on the patients skin the electric potential is measured to capture the entire cardiac cycle. The waves shown in the ECG represent depolarization and repolarization towards and away from the electrodes. Those form a dominant vector that shows the main direction of the electrical impulse. This pattern is known as PQRST cycle (a normal sinus rhythm), in which every part represents one segment of the cardiac cycle. The P-wave shows the atrial depolarization, the QRS complex exhibits the ventric- ular depolarization. After then comes T-wave which shows the ventricular repolarization. This pattern is influenced by various diseases and a changed heart structure.

An ECG diagram shows the heart rate (as the measured voltage) over the time. A normal heart rate is 60-100 beats per minute, although it changes with the age. If it is less than 60 beats per minute, it is called bradycardia, while more than 100 bpm are referred to as tachycardia. In a sinus rhythm the rate is usually the rate of P-waves or of QRS complexes (they always appear after each other).If there are any differences in the ECG from a normal sinus rhythm, it indicates a cardiac arrhythmia. An ECG stress test monitors the heart rate under external stress, which is increasing over time. It helps to diagnose diseases like the coronary artery disease (how likely it is to happen) or changes in the appearance of arrhythmias. It is examined how the patient responds to the stress and how the blood pressure changes. If the patient experiences chest pain, the test is terminated.

2 OVERVIEW OF THE ELECTROCARDIOGRAM

2.1 Heart rate contractility and ECG profile

The standardized positions of chest lead covers from the right ventricle to the left ventricle. As the heart generates sequence of repolarisation and depolarisation waves, the leads record the deflections based on the received current and generates ECG wave profile. The conduction system of the heart starts from Sino atrial node (SAN) in right atria and then spread downwards to the left and outwards towards the front of the chest where the wave is moving towards the leads generating positive deflection producing p-wave. Generally, P wave is about 1 box wide or 1 box tall and 0.2 secs long and the abnormality indicates atria hypertrophy. PR Interval: The measure of P wave to the start of Q wave represents the duration of atria depolarization

Figure 1: General ECG Profile [1]

Which gives PR interval? The normal duration is about 0.12 to

0.20 seconds, about 3 to 5 box wide. If the PR interval is greater than 0.2 seconds, then AV block can be predicted. QRS Complex: The measure from the start of Q wave to the end of S wave represents the duration of ventricle depolarization which gives QRS complex. Normal duration is about 0.08 to 0.12 seconds, about 2 to 3 box wide. If duration is longer, bundle branch blocks can be predicted. QT Interval: The measure from the start of the Q wave to the end of T wave represents the duration of activation and recovery of the ventricular muscle which gives QRS complex. This duration varies inversely with the heart rate. The normal QT is about 0.4 to 0.43 seconds and ST Segment: The measure from the end of S wave, J point, to the start of T wave gives ST segment. This segment is best suited to suspect and inspect myocardial ischemia (depressions) and myocardial infarctions (elevations).

    1. Stress Test

      Stress test is used to assess the performance of heart muscle in terms of ECG changes and severity. The maximum work load, heart and respiratory rate, the blood pressure as well as the recovery period of repo- larization are also analyzed. After a period of rest, the patient should walk on a treadmill or more generally to perform exercises whose difficulty degree will progressively increase until he feels exhausted or stopped. These analyses will process the heart complications such as myocar dial ischemia, coronary artery disease (CAD), atherosclerosis etc. For example, in case of myocardial ischemia, coronary obstruction often causes unstable angina. The main ECG abnormalities are down slope ST segmentation depression of 1mm or greater and another case is myocardial infarction which is ST segmentation elevation of 1mm or greater. The overall specificity for detecting obstructive CAD in case of women is lesser than ECG characteristics of men as per [2]. The concave appearance referred to as benign.

      whereas convex appearance is dangerous due to early repolarisation. The main etiologies of ST elevation is due to left bundle branch block, left ventricular hypertrophy, early repolarisation and ST elevation MI. ST depression has three morphological sub-types such as horizontal depression, up-sloping depression and down sloping depression.

    2. Additional features of ST Segment

      To check if the patient suffers from coronary artery disease, the ST segment need to be evaluated. The first thing to do is to determine the ST segment in the cycle. For that we found the S-peaks by looking for local minima in the diagram. From the S-peak (point S) it takes 0,02s to the J-peak that means 5 samples (250 samples per second). The duration of the ST segment is around 0.12s long, so for the whole period we are looking at 30 samples. We are taking all samples from S+5 to S+35 and find the average value for this interval. In a normal ECG, this value should be close to 0, but if the patient suffers from CAD, the ST segment is elevated or depressed. To cover both cases, we compare our calculated value to 0 and set a difference of 0.5mV as limit for a normal ECG appearance. Comparing it to the S-peak could be problematic because with the stress increasing over the time, the value of the S-peak is decreasing. It may also occur that the normal value of the ST segment is changing, then a comparison to an adaptive value would make more sense. Because of the noise we cant compare one single value of the interval to zero, the variation between the samples is too big and the chosen sample could easily exceed the limit, even though the signal is normal.

  1. ALGORITHM DESCRIPTION

    1. Raw ECG Aspect

      The electrocardiogram in fig 2 appears to be quite noisy. As we can observe in the second part, there is a

      small trend coming along. In addition, there is some brutal amplitude variations that we need to remove, as figured right after 200 seconds in the first chart.

      1. Noise removal and filtering

        Figure 2: Raw ECG aspect, in general and in detail

        it, specially around 0 Hz, which corresponds to the

        In order to analyze our data set, we apply a Fourier transform on our signal, to get the frequencies we look for. From figure 3, it is clear that there is a lot of noise in

        baseline wonder and noise. There is also the power-line at 50 Hz that we will need to filter.

        Figure 3: Fourier transform of our signal (Fs=250Hz)

    2. Low-pass Filtering

      To remove the low amplitude frequencies of above 20Hz, we have used a zero phase Butterworth IIR low pass

      filter with cutoff frequency of 25Hz of order 12 and the filtered signal is plotted as shown in Figure 4, which attenuates the frequencies above 25 Hz.

      1. High-pass Filtering

        Figure 4: Power spectra of ECG after Low pass filter

        heart rate range varies between 40 (0.66 Hz) and 200(3.33

        A high pass filter is needed to remove the low frequencies which correspond to the noise generated noise from body movements. It is quite important to select carefully the cutoff frequency of the HPF. To remove the low frequencies noise below 5Hz baseline, a 5th order zero phases IIR filter is used, with a 0.5 Hz cut-off frequency. This value relies on physiological hypothesis: the human

        Hz) [3], but we need to include every case, even physiologically. It also matches with the normalized frequency. Finally, the baseline has been removed, which de-trends the signal. The spectrum of the ECG signal after the high pass filter is shown in Figure with frequencies below 0.5 Hz attenuated

        Figure 5: Power spectra of ECG into a single band pass filter

        Or we can combine the low pass and High pass filter into a single band pass filter to meet the requirements of baseline wander removal and attenuating low frequencies below 0.5 Hz.

      2. Band-pass Filtering

        We created a Chebyshev Type II Order band pass filter to remove the baseline line wonder 50 Hz and noise. This value is preferred to lower values (10, 15 Hz), which would smooth the QRS peak that we are looking for. The figure 6 below shows this phenomenon. Finally, here is what we were looking for: Magnitude and Phase response:

        Figure 6: Chebyshev Type II Order band pass filtering and removal of baseline Wonder

        Figure 7: Plots of Magnitude and Phase response

        Figure 8: Plots of ECG in zoom in view Baseline Wonder Removed Signal:

        Figure 9: Plots of baseline wonder enhanced signal – before

        Smoothing filter: In order to smooth then the signal, we used savitsky-golay differences order filter to smoothen the filtered signal with cubic polynomial fit and

        a window size of 11. The smoothened signal is plotted in Figure 9 below.

        Figure 10: Plots of baseline wonder enhanced signal – After

        Figure 11: Plots of Net ECG wave intensity analysis

        Ensemble Averaging: In order to look at the statistics of the every heart beat ensemble averaging was performed to see the statistics of the heartbeat. Although the R peaks in the Figure. 10 is clearly visible, but it is difficult to observe the P and T waves because of the noise present in the signal and the changing duration of each heartbeat. Our algorithm for ensemble averaging is not adaptive to the changing heart beat thus we can see it is not good enough to localize the P and T waves. However, the algorithm can be further improved to make it adaptive with the changing

        heartbeat. Also, if wave intensity analysis is performed on the beats it will be best to see the changes in the ECG and prediction for the diagnosis are supposed to be more realistic. There are some outline signals visible which corresponds to the initial segment of the signal in which the ECG is still in dynamic state after the filtering and after the filter has reached the steady state there is no such outline signals and the doted signals corresponds to the +1 and -1 standard d e v i a t i o n s .

    3. Peak Detection

      Figure 12: Ensemble Averaging

      there will be a beat inside. The following figure 11 will

      Once the signal is filtered out, peaks can be visualized and counted. In order to achieve, we use this fundamental assumption that each sample frequency has 250 samples per second. Without speaking about time anymore, we talk about samples, and assume that every 250 samples,

      explain how we keep heartbeats. Finally, we take the number of peaks obtained in a minute which gives a heart rate per minute. Max and Min Heart rate and the plot of variation of the heart rate for every minute is plotted in Figure 15 below:

      Figure 13: Flowchart of beat counting

      Figure 14: Number of peaks obtained in a minute

      Finally, through this algorithm, we are able to detect R- peaks and count them.

  1. CORONARY ARTERY DISEASE

    1. Overview

      Coronary artery disease is heavily targeted by stress test. Due to other diseases and risks factors, such as smoking or obesity, fat progressively obstructs vessels (coronary arteries who supply it) around the heart. This phenomenon, called atherosclerosis, leads to alarming diagnostics i.e.,

      cardiovascular accidents, heart failures, etc. During stress test, the heart has to work m ore, increasing the blood volume supply. If there is a coronary artery disease, this blood volume will be difficult to provide. Its principle feature in the ECG is to get a strong drop between the S peak and the T wave. Indeed, numerous studies demonstrated that exercise stress test has ability to diagnose the suspected Coronary artery disease (CAD) [2].

      Figure 15: Evolution of heart rate per minute. The minimal and maximal heart rate is notably displayed to allow somediagnosis.

    2. Algorithm

      In this part, we will explain how we can detect whether or not a patient has this disease, highlighted on an ECG by an important drop or increase in the ST interval compared to healthy ones. This algorithm works in two parts: firstly, the ST interval of each beat is located, and then the

      mean value of this interval is compared to the mean ST value in the ECG. The method to find the S peak reuses the principles of the previous algo- rithm explained in Fig. 5, except we looking for the minima. The result of this processing is shown is the fig 14 below.

      Figure 16: Peak detection on different periods. The peaks are presented in the red dots.

      Once its done, we take the mean value of the interval ST. From Fig. 2, we already know that there is a 0.02s interval between the S peak and the J point, and about 0,12s between this J point and the T wave. Hence, for each beat, we will take the mean value for the interval between the J point (S position

      + 5 samples

      = 0.02s) and this new position + 30 samples = 0.12s. This value will then be compared to the value found for each beat between the values of the S peak. If this value is less to 25 percent (arbitrary threshold) from this S-peak value, then there is a drop and the diagnostic would be pushed further. The sample position of the wrong ECG is stored.

  1. DISCUSSION

Despite effectively counting heartbeats and eventually wrong patterns inducing coronary artery diseases, these algorithms are subject to limitations. Firstly, there is a lot of noise inside the signal. If finding the QRS complex is quite easy (a sharp peak), finding the P and T waves without confusing them with random noise post-filtering may be tricky. In addition, the lower the high- pass filter cut- off frequency is, the smoother peaks are. Consequently, it is difficult to get rid of all the noise and we cannot focus on a tiny window that would contain exactly the frequencies we are looking for.

Secondly, we are counting peaks from a different method that doesnt require an adaptive threshold, a method commonly used which is still under study. To

extend the validation of our method, we should compare it with this well- known alternative on many ECG. Thirdly, regarding our CAD detection algorithm, we are using an arbitrary value (a ST mean vlue less than 25 percent of the S peak value would result in a diagnosis) that does not really fit the clinical daily life much more complex. However, given only one ECG (of a patient healthy or not), it is difficult to go beyond this first analysis, and this method needs to get confronted to others data sets. Nonetheless, this signal processing task is a strong first approach of what biomedical signal processing is, and how this tool may be used to diagnose diseases starting from bioelectric signals. (Speaking about real time?)

REFERENCES

  1. PHYSIOLOGICALPROPERT IESOFHEART.ELECT ROCARDIOGRAPHY INV EST IGATIONOFHEART

    //intranet.tdmu.edu.ua/data/kafedra/internal/normalphiz/classesstud/e n/nurse/Bacchaour20of 20sciences20in20 Bybee K A, Dew M L, Lawhorn S L, Stevens T L. A non-invasive evaluation of coronary artery disease in women in Cardiovascular Disease in Women Essentials, chapter 2, Jones & Bartlett Learning, 2012, ISBN 9780763790790.

  2. AmericanHeartAssociation.T argetHeartrates.Accessedon12/02/16.W WW.heart.org/HEART ORG/HealthyLiving Heart RatesUCM 434341Article.jsp.

  3. KangK.ParkJ.Intelligentclassicationofheartbeatsforaut omatedrealtimeECGmonitoring.InTelemedJEHealth(2 0110.1089/tmj.2014.0033.

  4. Christov,I.RealtimeelectrocardiogramQRSdetectionusi ngcombinedadaptivethreshold.InBioMedicalEngineeri ng O10.1186/1475925X328

Leave a Reply