ECG Matlab
ECG Matlab
ECG Matlab
Gautam Sarkar
Electrical Engineering Department
Jadavpur University
Kolkata, India
sgautam63@gmail.com
Abstract— Modeling of ECG signal is of much importance as different time slots in complete ECG wave cycle [4-9]. The
the outcome of it is needed for compression of ECG waveform for major objective of the present work can be significantly
remote transmission by wireless link, reconstruction of both justified for development of standalone ECG simulator using
normal and abnormal ECG waveform without patient, studying equivalents circuits and other associated parts using electronic
the performance of cardiovascular system or heart. The present components. The use of a simulink model of heart has many
work proposes a novel method to design a model of heart advantages in the simulation of P-R interval, QRS interval, S-
according to functions of electrical activity of major parts inside T interval and synthesis of ECG waveform for one cycle. The
heart. Each individual major part generates potential wave w.r.t. simulink model of heart is saving of time and it is removing
time of its own nature due to depolarization and repolarization
the difficulties of taking real ECG signals with invasive and
processes. The individual potential waves have been modeled
using Fourier analysis method. In this paper modeling P-R
noninvasive methods. The simulink model of ECG enables us
interval wave, QRS interval wave, S-T interval wave and ECG to analyze and study normal and abnormal ECG waveforms
wave for one cycle using MATLAB Simulink. The proper without actually using the ECG machine. The simulink model
utilization of MATLAB functions (PR Segment block, QRS of ECG waveform for healthy and abnormal patient can also
Segment block, ST Segment block), MATLAB curve fit GUI- be used for calibration check operation of ECG recorder.
TOOLBOX and MATLAB Simulink tool can lead us to work
with ECG signals for processing . The simulink model major
parts have been realized by interval generator blocks, ramp II. METHODOLOGY
function blocks, product blocks, segment generation blocks and
adder thereby generating P-R interval wave, QRS interval wave The electrical impulse is initiated at sinoatrial (SA) node
and S-T interval wave within different time ranges of one cycle of of human heart, this node spontaneously polarize (depolarize
ECG wave. The individuals waves as obtained from PR segment and repolarize) at a rate of 72 times/min. The electrical
block, QRS segment block, ST segment block are synthesized to impulses (Fig. 1(a)) gradually spread over the heart and
produce a typical composite ECG wave. produce bioelectric signal ‘ECG wave’[10-15]. As the basis of
the above theory a suitable model is planned to be designed
Keywords— ECG wave, Fourier method, MATLAB Function,
so that it is equivalent of human heart and the output of this
MATLAB Curve fit GUI-TOOL BOX, MATLAB Simulink.
model gives the total ECG wave(Fig. 1(b)). Generally this
model have four modules:
I. INTRODUCTION
A. 1st module of the model is to generate the output of ‘PR
The goal of the present article to develop the synthesis of Interval’ (That means P wave and PR segment) (Fig.
ECG model using MATLAB simulink tool box in frequency 1(a)).
domain analysis with the help of 4th order Fourier analysis B. 2nd module of the model is to generate the output of
method [1-3]. The biopotential interval waveforms (P-R ‘QRS Interval’ (Fig. 1(a)).
interval waveform, QRS interval waveform, S-T interval C. 3rd module of the model is to generate for giving the
waveform) arising from different parts (SA node, AV node, output of ‘ST Interval’ (That means ST segment and T
Bundle of HIS, Fascicle) of the heart are modeled by Fourier wave) (Fig. 1(a)).
spectrum analysis. We are implemented this model in
D. The last module of the model are adding the output wave
MATLAB Simulink tool box and the outputs of all segment
blocks (PR segment block, QRS segment block, ST segment form of the rest of the three modules and finally the last
block) are superimposed to produce composite waveforms at module is likely to produce total ‘ECG’ wave (Fig.1(b)).
978-1-5090-2638-8/16/$31.00©2016 IEEE 61
2016 International Conference on Intelligent Control Power and Instrumentation (ICICPI)
T
2
T 0
Bn = c(t ) cos(nω 0 t )dt (3)
2 0.0013 -0.6243
“S-T” interval potential signal. ω0 = [ ω0 is angular 150 0.1930 50.8400 3 0.0069 -1.4121
T
frequency of fundamental component]. T is the time period of 4 0.0042 -0.6543
“P-R”/ “QRS”/ “S-T” interval potential wave. 1 0.3937 -1.1860
QRS wave
T
2 2 0.1894 1.0774
T 0
An = c(t ) sin( nω 0 t )dt (2) 190 0.3330 27.5600
3 0.0474 -0.7251
4 0.0098 -0.6329
62
2016 International Conference on Intelligent Control Power and Instrumentation (ICICPI)
1 0.1096 0.6802
S-T wave
2 0.0032 1.3930
220 0.2239 32.3000
3 0.0086 -1.0926
4 0.0054 -0.4381
IV. RESULTS
The original and reconstructed waveforms with residue or
error over different segments (e.g. P-R, QRS and S-T are
shown in fig:-3). The performance of the quality of
reconstructed ECG waveform by synthesis are expressed by
mathematical indices as i) Percentage root mean squared
difference (PRD), ii) Normalized PRD (PRDN), iii) Maximum
absolute error (Emax) and iv) Root mean square error (RMSE)
and Signal to noise ratio (SNR). They are defined as :
( x[n] − xˆ[n])
n =1
2
PRD = 100 × N
( x[n])
n =1
2
( x[n] − xˆ[n])
n =1
2
PRDN = 100 × N
( x[n] − x )
n =1
2
( x[n] − xˆ[n])
n =1
2
RMSE =
N
where N = total number of samples in waveform dataset
x[n]
=actual value of sample nth
xˆ[n]
= Corresponding reconstructed value of n-th sample.
63
2016 International Conference on Intelligent Control Power and Instrumentation (ICICPI)
References
1
Actual ecg waveform [1] S. C. Bera, R. Sarkar, “Fourier Analysis of Normal ECG Signal to Find
it Maximum Harmonic Content by Signal Reconstruction”, Journal of
0.8 Sensors and Transducers, Vol. 123, Issue. 12, December 2010, pp. 106-
107.
[2] S.C.Bera, R.Sarkar and Nirupama Mondal “A Review Work on
Reconstruction of ECG Wave from Fourier Harmonic Components”,
0.6
A m plitude
Paper No: 400, 2008 IEEE Region 10 Colloquium and Third ICIIS,
Kharagpur, India.
[3] Al-Nashash, H.A.M. "A dynamic Fourier series for the compression of
Reconstructed ecg waaveform ECG using FFT and adaptive coefficient estimation", Med. Eng. Physics
0.4
17, pp.197–203, 1995.
[4] 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 &
0.2 LABVIEW as Effective Tools ”, International Journal of Computer and
Electrical Engineering , Vol. 4, No. 3, June 2012 , Page-404.
Error [5] T. Lukáč, O. Ondráček , “USING SIMULINK AND MATLAB FOR
REAL-TIME ECG SIGNAL PROCESSING ”.
0 [6] Martin Fetz , Diploma Thesis at the Department of Computer Science
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 iTec - Information and Communication , “Engineering Creation of a
Time(S) Simulation Environment in Simulink/Matlab for the Analysis and
Fig. 3 Comparison between actual and reconstructed one cycle ECG Optimization of the Spectral Algorithm for the Detection of Ventricular
waveform Fibrillation”, Dornbirn, August 2004.
[7] Trung Q. Le, Satish T.S. Bukkapatnam, Akkarapol Sangasoongsong,
In present case, the performance indices are found to be Ranga Komanduri, “Towards Virtual Instruments for Cardiovascular
Healthcare: Realtime Modeling of Cardiovascular Dynamics Using ECG
(Fig.3): Signals” , 6th annual IEEE Conference on Automation Science and
Engineering, Ontario, Canada, pp.903–910, August 21-24, 2010.
PRDN =3.5282, PRD =1.8237, RMSE =0.0353, Emax [8] Fikret YALCINKAYA, Ertem KIZILKAPLAN,Ali ERBAS,
=0.1817 “Mathematical Modelling of Human Heart as a Hydroelectromechanical
System”, Department of Electrical and Electronics Engineering,
Kirikkale University, 71450, Yahsihan, Kirikkale, Turkey, pp. 362-366.
V. DISCUSSION
[9] K. Hassani, M Navidbakhsh, M Rostami, “Simulation of the
cardiovascular system using equivalent electronic system”, Biomed Pap
In the present investigation, pulse interval generators (PR, Med Fac Univ Palacky Olomouc Czech Repub.2006, 150(1):105-112.
QRS, ST interval) and PR segment, QRS segment, ST [10] L. A. Geddes and L. E. Baker, Principles of Applied Biomedical
segment are designed using “MATLAB-SIMULINK” Instrumentation, John Wiley & Sons, Inc., N. Y., 1968.
platform/toolbox. The partial ECG waves are obtained after 4th [11] L. Cromwell, F. J. Weibel, E. A. Pfeiffer, Biomedical Instrumentation
order Fourier modeling using “MATLAB curvefit GUI- and Measurements, PHI Pvt. Ltd, 1996.
TOOLBOX”. The original and reconstructed waveforms with [12] Khandpur R S – Handbook of Biomedical Instrumentation, TMH, N.
Delhi 1991
residue are generated by MATLAB programme. The
[13] Carr – Introduction to Biomedical Equipment Technology 4/e – Pearson.
performance of designed electronic circuit could be simulated
[14] Katz A M. Physiology of the heart. 5th ed. Philadelphia, PA: Lippincott
as future work, using ORCAD/Pspice circuit simulator tool. Williams & Wilkins; 2011.
The partial ECG waves (e.g. Waves corresponding to P-R [15] R.Gupta, M.Mitra, J.Bera, “ECG Acquisition and Automated Remote
interval, QRS interval and S-T interval) are generated by 4th Processing”, Springer, 2014.
order harmonic oscillator circuits. Increasing the order greater [16] http://www.physionet.org.
than 4 will definitely increase the accuracy but the no. of
oscillators will increase and thereby increasing the
complexity. Moreover here it has been assumed that the
orders, the Fourier model of all partial ECG waves are fixed to
four. The realization of equivalent circuits for unequal order
would be necessary in that case. As a on of the future scope,
we can follow the above methods, mathematically model
arrhythmia, myocardial infarctions and other cardiac problems
and help detecting them in the humans by comparison.
Another future task, the partial waveform generation with
different time intervals could be easily implemented using
embedded hardware consisting of microcontroller, high
resolution DAC and intelligent software.
64