MATLAB Probing to Churn Out Analytics of ECG Waveform

Download Full-Text PDF Cite this Publication

Text Only Version

MATLAB Probing to Churn Out Analytics of ECG Waveform

Utsab Ray

Department of Biomedical Engineering

JIS College of Engineering, Kalyani, W.B.

Dibyendu Mandal Department of Biomedical Engineering

JIS College of Engineering, Kalyani, W.B.

Karabi Ganguly Department of Biomedical Engineering

JIS College of Engineering, Kalyani, W.B.

Abstract:- This paper dispenses on the accord of the study and analysis of Electro Cardiogram Processing by MATLAB tool effectively. Examination of the ECG signal implies on the generation of ECG signal which pertains to the waves that are produced by an electrical impulse or wave that travels through the heart. It estimates the heat rhythm as well as the rate. The work is allocated on MATLAB coding which is indeed instrumental to provide data to the patients or subjects without any physiological involvement. Through the graphical representation procured through MATLAB coding, the anatomy and physiology of cardio vascular exploration can be done. Further requisite and obligatory informations that are inevitable like heart attack, abnormal heart rhythms can be disclosed. Subjects can easily differentiate the original data obtained along with the graphs obtained which also provides coherent information about the exact transposition of their reports. Thus, working with MATLAB along with their simulink and MATLAB provides consequent exertion to work with ECG for signal processing and thus developing further prospects in order to get more and more concise results with appropriate fidelity and satisfaction.

Keywords: MATLAB, ECG Analysis, Cardiovascular, QRS Complex,


    In studying and examination of various cardiac anatomy and heart pathology and physiology, electrocardiography has been most functional as it has vigorous operational and working parameters since long time [1]. A methodical and well- structured nature of standard cardiac cycle is habitual with QRS complex along with P wave followed by U wave as well as T wave [2]. Many other scientific as well as indifferent clinical methods of ECG findings are not well recognized and clearly interpreted. As a result, the method of modeling signal and analyse it through ECG simulation acts as an effective tool to enhance on the significance to get clear and coherent acceptance through justified understanding [3]. There are several issues that emerge as a major obstacle to cardiac health of humans and constant monitoring and check up is not possible. For this reason this paper focuses on the exploration to examine various kinds of ECG waves that are normal for any subject and calculation of average heart beat that entails to ensure cardiac state.

    Electrocardiogram, an analog signal, usually fetches the representation of voltage against time in a graphical form. The frequency of this signal ranges from 0.05-100 Hz and the

    value of voltage spans between 1-10 mV [3]. The formulation and constitution of ECG signal comprises of many unfamiliar and distinctive parts that are tethered by a baseline.

    Figure 1: Graphical Representation of ECG signal

    Isoelectric line: This line is the baseline that binds the fragments of ECG wave. In other words, this is termed as isopotential line. It basically represents the short inert period of heart. It is specified a zero voltage [4].

    QRS Complex: This part represents the excitation or stimulation of ventricular depolarization and atrial repolarization or in other words, the beneath part of human heart [5].

    P- Wave: It is the initial positive wave of ECG signal which constitutes the superior chamber activity of heart. The impulse received from the sinoatrial node instigates the triggering of atrial depolarization in conjunction summons the P wave [5].

    P-R interval: This interval customarily comprehends three parts which represents atrial activity; the emergence of activity chambers that gives the conduction of atria and ventricles, the impulse which passes through the atrio- ventricular node and the parts appends P wave followed by P- R segment and QRS complex [5].

    S-wave and Q wave are normally positive and negative wave respectively. The highest graphical wave that portrays cardiac cycle is R- wave [5].

    Figure 2: Cardiac cycle of a healthy heart.

    T wave: It is the wave thus generated when the heart returns to its inert state and the repolarization of cardiac ventricles takes place. Relative refractory period can also be called as T- wave.

    S-T interval: Section bridging the T wave and QRS complex characterizes the isoelectric line due to the time confiscated by ventricles after depolarization in order to undergo repolarization.

    U- Wave: This wave is designated after potentials and is unavailable in standard ECG wave. Healthy and standard heart beat is between 60 to 100 beats per minute. Each part of ECG signal has numerical values as in [3],[6]:


    Parts of ECG Signal

    Amplitude of Parts (mV)

    P wave


    Q wave

    25% R wave

    R wave


    S wave


    T wave

    0.1 to 0.5


    Parts of ECG Signal

    Duration of Parts (ms)

    P wave

    100 to 110

    Q wave


    S wave


    T wave


    QRS complex

    50 to 110

    QRS interval

    40 to 120

    P-R interval

    120 to 200

    Q-T interval

    350 to 440

    S-T interval

    50 to 150

    P-QRS interval


    A. Heart Pathology

    Heart pathology implies the indication of digression of heart valves from its normal action and is superintended for serious heart issues like cardiac arrhythmia [7]. This pathological issuance is the outcome of the circumstance may be caused as a result of relatively change in the concentration of sodium (Na+), calcium (Ca+), Potassium(K+) and magnesium (Mg+) as compared to their customary concentration across the cells

    of myocardia [4]. It is always impelled to observe and perceive emerging techniques including new strategies and tactical practices related to cardiac diseases and obstacles relating to it so that early-stage detection can be encountered so that therapies that are imperative and requisite for this affliction can be provided [6]. Thus, recognition followed by proper perception of ECG assists in rehabilitation of cardiac arrhythmia. There are varied pathologies that superintends serious cardiac arrhythmia. Some of them correlating this disease are:

    Hyperkalemia and hypokalemia- Hyperkalemia is the instance the level of serum potassium is more than 5 mmol per litre in adults [8]. On the other hand, hypokalemia correlates the situation where the level of potassium falls below 3.6 mmol per litre [8] and it can be fatal as dangerous arrhythmic diseases for normal heart rates can be the outcome of hypokalemia. It also heightens the circumstances which enhances the effect of arrhythmia in the diseased hearts [9]. The consequence of untreated hyperkalemia results in ventricular myocardium depolarization that eventully concludes in ventricular fibrillation.

    Dextrocardia This is quite sparse and infrequent congenital condition of heart where heart points towards the chest which is opposite in normal condition i.e towards the right side of the heart. It generally takes place by the side of heart defects that are invariably major and complex. To detect abnormality of heart, chest X-rays and electrocardiogram are the crucial tools that bear considerable significance.

    Angina Pectoris It is the chest pain felt due to inconsiderable supply of oxygenated blood originating from heart and to its respective heart muscles [10]. Angina is referred as the manifestation of coronary heart disease (CHD) called ischemia as well as coronary microvascular disease (MVD) called cardiac syndrome X [11].


    The preliminary inceptive in signal processing, to examine any data is feature extraction [12]. In this paper focus on each heart wave through MATLAB simulation is done which fetches original ECG signal thus making feasible for comparison between abnormal ECG signals of several diseases and fundamentally engendering fatal diseases like arrhythmia. Such signals of ECG correlating heart pathology are being undergone simulation by extracting the respective wave characteristics from data obtained from real time. According to the groundwork of the model [4] illustrated in the flowchart underneath, accompanied by following the technique for simulation of pathological ECG model signaling.

    Figure 3: Flow Chart representing the synthesis of Normal ECG

    All the respective parts of the ECG signal are exclaimed as its feature and is designed with the help of measurements using biological constants that are taken from habitual pathologies separately. MATLAB software programming is an intricate tool to sustain each and every feature of the simulation process. The simulator conceptualizes the basis of Fourier series approximation which enables each feature of ECG


    In this entire work MATLAB signal processing is being done which dictate various ECG waves and their respective peaks.

    Figure 4: ECG R-Peak detection plot

    Figure 4 depicts R-peaks of ECG Wave. It represents the electrical stimulus as the wave passes through the main portion of the ventricular walls.

    Figure 5: Flow Chart representing the synthesis of Normal ECG

    Figure 5 depicts QRS Complex, the combination of Q wave, R wave, and S wave which represents ventricular depolarization.

    signal. The waveform of ECG is periodic in nature and its fundamental frequency is as similar as heartbeat. This signal mainly persuades the Dirichlets condition that is the prime criteria or measure for a wave that is to be constituted with the help of Fourier series [13]. The significance of specific function of cardiac valves is denoted by each feature of ECG [11]. If modelling of each feature is done mathematically as mathematical functions, then expression can be done on them based on Fourier series. As a result, graphical representation of Fourier series parts represented accords the PQRST wave. The model basically focuses on the basic ground features deviated from normal part of ECG waves. Hence the deformity of all respective features of pathological ECG signal are directly explored and investigated. The values that are outlined from the basic biological characteristics of the ECG wave. By taking this into concern three pathologies have been modeled, specifically hypokalemia, angina pectoris, dextrocardia, hyperkalemia, which approaches as consequential elementary cause leading to cardiac arrhythmia. The model which resulted fits the pathology for which modelling is done and thus assists in acting as a reference in future for further detection of the three pathologies considered in this context. Thus, plays as an operative an effective role in early-stage detection of arrhythmia.

    Figure 6: P and Q wave modulation and shifting

    P wave and Q wave is depicted through its modulation and shifting in figure 6. Through modulation the data are converted into waves by adding information and to a signal. Sampling is done initially which depicts the resolution of the wave generated through the signal and quantization is done subsequent to sampling where the values of amplitude of waves are represented in finite figures.

    Figure 7: Depiction of various stages of ECG waves.

    In figure 7, initially through MATLAB Coding the original wave was generated and then discretization is done with the help of sampling in MATLAB, where filtration is done in 2 stages and in the 4th stage peaks are detected and in the second pass the filtered ECG is obtained. Finally detected peaks are generated.

    Figure 8: Average HR calculation

    Average Heart beat calculation is shown in figure 8, where every single input is considered and calculated. That computation makes it easier for patients to simultaneously input their data and get the consequent respective readings of average heart beat as per the data input given by the patient. Thus, real life accuracy is provided and multiple subjects can undergo this method to get the information about their heart rate.


ECG signal is undoubtedly one of the major signals to examine the heart rates and take necessary steps or medications required for further prospects and monitoring to be done with cardio physiological parameters of our body. The cruciality of ECG pertains to the major fact that checking of appropriate functioning of our heart can be

purposeful as it measures the electrical activity of our heart by an electrical impulse that travels through our heart. Thus, from this paper it can be concluded that MATLAB is an indispensable thing for ECG signal processing and it has an immense consequence in it. They are so functional and practical that it can be easily beneficial and advantageous to everyone. The heart condition of patients and the respective waves can easily be identified and recognized to get proper records and reports. Throughout this paper all the waves that are detected can be also be used and associated in order to check and tally with the original reports of the patient. Thus, it is instrumental as it is done without ECG data as well. Without ECG data it can be simulated and examined with pertinent and significant investigation to examine.


I would like to thank by Dr. Karabi Ganguly and Dr. Dibyendu Mandal for mentoring me through this work. I like to extend my gratitude to my teachers, Dr. Sandip Bag and Ms. Swati Sikdar for their full support and cooperation and like to thank Mr. Gourango Halder for his support in utilizing the laboratory resource. Moreover, I cater my acknowledge to my class mates for helping me in all spheres.


  1. P. R. K. Shrivastava, S. Panbude and G. Narayanan. (2014) Digitization of ECG Paper Records using MATLAB, International Journal of Innovative Technology and Exploring Engineering, 4, pp. 1-3, 2014.

  2. M. K. Islam, A. N. M. M. Haque, G. Tangim, T. Ahammad, and M.

    R. H. Khondokar, Study and Analysis of ECG Signal Using MATLAB & LABVIEW as Effective Tools, International Journal of Computer and Electrical Engineering, 4, pp. 404-409, 2012.

  3. A. K. Joshi, A. Tomar, and M. Tomar, A Review Paper on Analysis of Electrocardiograph (ECG) Signal for the Detection of Arrhythmia Abnormalities, International Journal of Advanced research in Electrical, Electronics and Instrumentation Engineering, 3, pp. 12466-12476, 2014.

  4. J. Kubicek, M. Penhaker and R. Kahankova, Design of a Synthetic ECG Signal Based on the Fourier Series, Proceedings of the International Conference on Advances in Computing, Communications and Informatics, ICACCI: 1881-1885, 2014.

  5. A. J. Viera and N. Wouk, Potassium Disorders: Hypokalemia and Hyperkalemia, American family physician, 92, pp. 487-495, 2015.

  6. H. Haqqani, K. Chan, S. Kumar and A. Denniss, he contemporary era of sudden cardiac death and Ventricular arrhythmias: basic concepts, recent developments and future directions Heart, Lung and Circulation, 25, pp. 1-5, 2019.

  7. W.J. Leon Resnekov, CARDIAC ARRHYTHMIAS, Postgraduate medical journal, 40, pp. 381-392, 1964.

  8. J. N. Weiss, Z. Qu and K. Shivkumar, Electrophysiology of Hypokalemia and Hyperkalemia, Circulation: Arrhythmia and Electrophysiology, 10, pp. e004667, 2017

  9. M. G. Lopes, D. C. Harrison and J. S. Schroeder, Ventricular arrhythmias during unstable angina pectoris, Arch Intern Med., 12, pp. 1548-1553, 1975.

  10. A. V. Ghuran and A. J. Camm, Ischaemic heart disease presenting as arrhythmias, British Medical bulletin, 59, pp. 193-210, 2001.

  11. K. P. Soman, S. Kumar, S. Neethu Mohan and P. Poornachandran, Modern methods for signal analysis and its applications, Studies in Computational Intelligence, 823, pp. 263-290, 2019.

  12. B. R. Manju, A. R. Rajan and V. Sugumaran, Wavelet Design for Fault Diagnosis of Roller Bearings using Continuous Wavelet Transform International Journal for Mechanical Engineering and Technology (IJMET), pp. 38-48, 2010.

  13. B. R. Manju, A. R. Rajan and V. Sugumaran, Optimizing the parameters of wavelets for pattern matching using GA Journal of Advanced Research in Engineering and Technology(IJRET), pp. 75-85, 2012.


Utsab Ray is currently pursuing B.Tech in Biomedical Engineering from JIS College Of Engineering. Enthusiastic and focused guy in the field of technology and innovation, published research paper and secured positions by participating in hackathons and other various innovative idea competitions across college and national level. Has a patent filed in his name on an innovative idea. Apart from these technical sights, the candidate has been indulged with various kinds of Internships and holding several positions of responsibility by possessing skills in various startups and private limited companies and successfully completed more than 14 internships and associated with various trainings irrespective of any curriculum. Presently, a student Partner in World's largest internship platform, Internshala; digital editor as well as graphic designer in Nubivagant Technology and Engineers Connect respectively; human Resource intern at Aashmam Foundation (NGO) and brand ambassador at GoDutch PVT. Ltd. Looking forward for more progressive endeavors.

Dr. Dibyendu Mandal is an Assistant Professor in the Department of Biomedical Engineering of JIS College of Engineering. he has completed his B.Tech BME from JISCE and M.E from Jadavpur University. He has completed his doctorate degree from Jadavpur University from the Department of Mechanical Engineering in Biomechanics and Biomaterials. His areas of interest are Biomechanics, Biomaterials, Computational Biomechanics, Injury Mechanics, targeted Drug Delivery.

Dr. Karabi Ganguly is an Assistant Professor since 2006 and Head of the Department, Dept. of Biomedical Engineering, JIS College of Engineering, Kalyani, West Bengal, India since December 2016. Dr. Ganguly received her undergraduate degrees as well as her Masters degree from University of Calcutta, India, and her PhD in Cellular Biochemistry and Clinical Oncology from Jadavpur University, India. She has published a number of papers in preferred International Journals and Chapters in Books, and participated in a range of international and national conferences on Clinical Oncology and Biomedical Engineering. Dr. Ganguly has 01 patent granted by IPR, Govt. of India. She also presented various research-based papers at several national and international conferences. Her research activities are currently twofold: while the first research activity is set to explore the advancement of Biomedical Engineering; the second major research theme that she is pursuing is focused on the Clinical Oncology. Her areas of interest and research are Biomedical Engineering, Cellular Biochemistry, Physiology and Clinical Oncology. She has teaching experience of 15 years (PG and UG level). Dr. Karabi Ganguly is invited as Reviewer, Session Chair, Invited Speaker and Volume Editor in various national and international conferences and journals.

Leave a Reply

Your email address will not be published. Required fields are marked *