bicoherencia ECG

Embed Size (px)

Citation preview

  • 8/2/2019 bicoherencia ECG

    1/22

    B.Tech Project

    ECG Analysis System

    By

    Manu Rastogi

    200101079

    Dhirubhai Ambani Institute of Information &

    Communication Technology

    Gandhinagar, GUJARAT

    April 23, 2005

    1

  • 8/2/2019 bicoherencia ECG

    2/22

    Dhirubhai Ambani Institute of Information &

    Communication Technology

    Gandhinagar, GUJARAT

    CERTIFICATE

    This is to certify that the Project Report titled ECG Analysis System submitted by Manu Rastogi ID 200101079

    for the partial fulfillment of the requirements of B.Tech (ICT) degree of the institute embodies the work doneby him on campus under my supervision.

    Date: Signature:

    (Prof. D. Nagchoudhuri)

    Date: Signature:

    (Prof. C. Parikh)

    i

  • 8/2/2019 bicoherencia ECG

    3/22

    Acknowledgement

    I would like to express my sincere gratitude and appreciation to my mentors, Professor Dipankar Nagchoudhuriand Professor Chetan D. Parikh, for providing me with the opportunity to work in the research area of Higher

    Order Statistical Analysis and Bio-medical Signal Analysis. In the absence of their invaluable guidance andencouragement at various levels I would not have been able to complete this work.

    I am also thankful to Prof. Ranjan for allowing me to utilize the facilities of Reliance Infocomm lab at DA-IICTfor this project.

    I am also indebted to Vasudha Chaurey , Vaibhav Garg and Siddharth Mohan for sharing their knowledge andexpertise at various stages of the project.

    Finally I am grateful to Abhinav Asthana, and Mrinal Kanti Rai for their help on tex and all others who directlyor indirectly were associated with this project.

    Manu Rastogi

    ii

  • 8/2/2019 bicoherencia ECG

    4/22

    Contents

    1 Introduction 11.1 ECG or EKG Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Characteristics of ECG Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3 Approaches to ECG Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    2 Background 32.1 Motivation for using Higher order Spectral(Statistics) Analysis (HOSA) . . . . . . . . . . . . . . 3

    2.2 Quadratic Phase Coupling (QPC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.3 Bicoherence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.4 Finding Bicoherence for a given signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    2.4.1 bicoher function of HOSA Toolbox ver 2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.4.2 Plotting bicoherence and interpreting the plots . . . . . . . . . . . . . . . . . . . . . . . . 6

    2.5 Bicoherence for ECG beats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.6 What does constant Bicoherence mean? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

    3 Discussion 93.1 Bicoherence based ECG Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.2 Steps in ECG Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    3.2.1 Why no filter is required? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    3.2.2 Reasons for an algorithm for Beat detection . . . . . . . . . . . . . . . . . . . . . . . . . . 103.2.3 Algorithm for beat detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.2.4 ECG beat Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    4 Conclusion 144.1 Data source for Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144.2 Statistical Results for Data Tested . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154.3 Observations made and problems in testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164.4 Scope for improvement and research . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

    5 References 17

    List of Figures1.1 ECG beats in a rhythm with an abnormality at the fourth beat . . . . . . . . . . . . . . . . . . . . . . . . 11.2 A single ECG beat[2] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3 Relative Power spectra of QRS complex, P and T waves, muscle noise and motion artifacts based

    on an average of 150 beats[8] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22.4 Bicoherence of a normal beat,MIT-BIH SVDB Database . . . . . . . . . . . . . . . . . . . . . . . 72.5 Bicoherence of an abnormal beat,MIT-BIH SVDB Database . . . . . . . . . . . . . . . . . . . . . 72.6 Value of bicoherence along w=0 for Fig. 2.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.7 Value of bicoherence along w=0 for Fig. 2.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.8 ECG Analysis System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.9 ECG Signal: First 1000 samples of MIT-BIH SVDB Database, rec:800.dat . . . . . . . . . . . . . 113.10 ECG signal after five point derivative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    3.11 Derived ECG signal after squaring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.12 The fourth peak zoomed from the above plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.13 ECG signal after deriving, squaring and moving window integration . . . . . . . . . . . . . . . . 133.14 Mid Point detection as mentioned in Sec 3.2.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.15 The fourth beat extracted from the original signal . . . . . . . . . . . . . . . . . . . . . . . . . . 133.16 P lots of windowed mean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    iii

  • 8/2/2019 bicoherencia ECG

    5/22

    ABSTRACT

    The Electrocardiogram (ECG) is a representation of the electrical activity of the heart and canbe used for detection of heart ailments. The ECG signal is composed of a fundamental beat

    being repeated at regular intervals of time. Any variations in the fundamental beat or the timeof occurrence of the beat would classify it as normal or abnormal. Although the ECG beatsappearing at approximately regular intervals of time are not identical in nature the basic shapeis preserved. The frequencies contributing to the shape of the beat are strongly phase coupled.The phase coupling present is such that for a range of frequencies, for a normal beat, the ratioof power of the phase coupled frequencies to the total power remains constant. This reportexploits techniques for measuring the magnitude of phase coupling present using bicoherencebased techniques. Bicoherence, an estimate of Quadratic Phase Coupling, uses higher ordermoments or higher order analysis of a signal to preserve the phase information present in thesignal which is usually lost in the power spectrum estimation. Using windowed mean basedapproach for estimating the flatness along a 2-D slice of the 3-D value of bicoherence it can beconcluded whether the beat present is abnormal or normal.

    iv

  • 8/2/2019 bicoherencia ECG

    6/22

    1 Introduction

    1.1 ECG or EKG Signals

    Electrocardiogram or ECG (EKG) signal is a measure of the electrical activity of the heart [1]. ECG signals arerecorded by placing ECG leads on pre-defined positions of the body which pick up the electrical signals fromthe skin. These electrical signals from the skin can be used for various kinds of analysis like [1]:

    1. The underlying rate and rhythm mechanism of the heart.

    2. The orientation of the heart (how it is placed) in the chest cavity.

    3. Evidence of increased thickness (hypertrophy) of the heart muscle.

    4. Evidence of damage to the various parts of the heart muscle.

    5. Evidence of acutely impaired blood flow to the heart muscle.

    6. Patterns of abnormal electric activity that may predispose the patient to abnormal cardiac rhythm dis-turbances.

    The pattern of human ECG is a continuous repetition of a fundamental beat at roughly fixed time intervalfrom one another (Fig 1.1 and Fig 1.2). Different intervals in this fundamental beat as referred as P,Q,R,S,Tand U, as shown in Fig 1.2, each of these are characteristic of a specific kind of electrical activity of the heart.

    When this fundamental beat pattern is distorted (i.e. the P, QRS, ST, T and U dont adhere to the normaltime interval or amplitude relationship between them) or repeated at an irregular time interval, it representsan abnormality in the electrical activity of the heart. These patterns or rather lack of pattern is known asArrhythmias. Fig 1.1 shows the fourth beat as an irregular pattern appearing prematurely. An arrythmia isclassified on the basis of distortion in the fundamental beat and also on the relative occurrence of the arrythmiato normal beats. For instance Fig 1.1 shows Super Ventricular Tachycardia (SVT) or the premature occurrenceof only a QRS complex . The frequency of arrhythmia and the nature of arrhythmia prompts a doctor to classifya person as healthy or unhealthy.This project report exploits the variations in Quadratic Phase Coupling (QPC) for the normal and the abnormalheart beats using bicoherence estimation. The report presents techniques for classification of an extracted beatfrom recorded human ECG signal as normal or abnormal , it doesnt specify the nature of abnormality orwhether the person is healthy or unhealthy.

    Figure 1.1: ECG beats in a rhythm with an abnormality at thefourth beat

    Figure 1.2: A single ECG beat[2]

    1.2 Characteristics of ECG Signal

    ECG signals are low frequency and low amplitude signals. The typical frequency range being 3Hz-70Hz[7]and amplitude values are in ones or twos of millivolts[10]. Fig 1.2 shows that the amplitude values are inmillivolts and the time duration is in milliseconds. In addition to P,Q,R,S,T and U waveforms(ref Fig 1.2) ECG

    waveforms also contain powerline interference,EMG from muscles, motion artifact from the electrode and theskin interference from the other electrosurgery equipment in the room. These noises can be both Gaussian andnon-Gaussian. Since ECG signals ar very low frequency signals they are prone to the noise disturbances. Ref

    1

  • 8/2/2019 bicoherencia ECG

    7/22

    to Fig 1.3 from [8] for a view on relative power spectra of different ECG components and noise. Since the noisebeing added is comparable to the ECG data it can result in being classified as ECG data or as an abnormality.The solution is to filter the data before analysis. The problem arises by the fact that noise components both interms of amplitude (time domain) and frequency (frequency range) overlap with the ECG signal. Implementingany kind of filtering approach would result in loss of ECG signal as well. For instance powerline interference istypically appears as a sharp spike at 50Hz or 60Hz. ECG data is present both at 50Hz/60Hz and around thesefrequencies. Thus filtering the data would result in the distortion of ECG beats or loss of valuable information.

    Figure 1.3: Relative Power spectra of QRS complex, P and T waves, muscle noise and motion artifacts basedon an average of 150 beats[8]

    1.3 Approaches to ECG Analysis

    A lot of work has been accomplished in the field of ECG signal analysis. Most of the work has been broadlyin the field of designing filters for ECG signals for removing noise components as mentioned in Sec 1.2,beat

    detection and ECG analysis.For noise removal earlier attempts were to implement FIR, IIR and integer filters[8].With advancements incomputing power and efficient algorithms in DSP filtering techniques based on minimization of mean squareerror(adaptive filters)[13] and time varying filters like Kalman filters have been tried[15]. However as mentionedin Sec 1.2 most of filters end up removing crucial ECG data as well.For beat detection and analysis the work has mainly concentrated in the time-domain. Approaches tried in thetime domain can be listed as:

    1. Furno and Tompkins presented automata based template matching for effective QRS detection. Theautomata based technique breaks the fundamental ECG beat into tokens and then uses a state transitiondiagram for beat detection. The limitation of algorithm comes from the fact that it fails to detect crucialabnormalities like Artial flutter or SVT[8].

    2. Dobbs et al. presented the Template crosscorrelation technique. In this technique a predefined templateof the signal we wish to detect is saved and a crosscorrelation between the two is computed. Dependingon the correlation coefficient between the two degree of match is predicted. The main disadvantages ofthis approach is that the template needs to be perfectly aligned to the incoming signal. The techniquefails to differentiate between abnormalities and noise. Since both can be uncorrelated to the template[8].Another approach of using template based subtraction is similar to the above mention technique exceptin this case the incoming signal is subtracted from the template stored and detections are made on thebasis of the value. Other approaches based on time domain template matching can be found in [12].

    3. Recognition of QRS complexes on the basis of slopes. Pan and Tompkins presented an approach usingderivative and moving integrators for QRS detection. Because of the simplistic nature of the algorithmand its accuracy this algorithm has been widely used for QRS detection even after nearly two decades ofit being published [8]. This project uses the above mentioned technique for QRS beat detection.

    4. Pattern recognition techniques have also been attempted by researchers exploiting the repetitive natureof the beats. However the approach fails as the ECG beats are almost periodic meaning that the pattern

    2

  • 8/2/2019 bicoherencia ECG

    8/22

    of the beats repeats itself at not constant rate but a near constant rate. Another drawback of patternbased approaches stems from the fact that the fundamental beat pattern itself is not of fixed duration.Pattern based approach is presented in [14]

    5. Owing to the different frequency ranges of P,QRS,ST and U segments of the ECG beats computationallyheavy systems designed on Filter bank approach have also been constructed.[16]

    However the study of ECG in the time domain is yet to yield any significant results. Efforts have also beenmade in the field of frequency domain by finding the FFT and analyzing the frequency components. Lately

    significant interest has been in using neural network based and knowledge based approaches for beat detectionand analysis[18].This report tries to look beyond the frequency domain by using the Higher Order Spectral Analysis. Use ofHOSA for physiological signals is yet to be fully explored. Work done previously on HOSA for ECG signalscan be found in [17] and [11]. [11] tries to compare fourier series coefficients to Bispectrum(Ref Sec 2.3Frequencies(BF) of an entire ECG signal to find the Shape Determining Frequencies(SDF). Where as [17]presents Higher order Auto-Regressive(AR) modeling for arrythmia. However no prior work on HOSA or ECGanalysis uses Quadratic Phase Coupling using bicoherence estimation for beat classification.

    2 Background

    2.1 Motivation for using Higher order Spectral(Statistics) Analysis (HOSA)

    HOSA is a field of statistical signal processing which reveals not only the amplitude information about a signalbut also the phase information. The motivations for using HOSA as a tool for ECG analysis can be listed asfollowing:

    1. Noise as mentioned in section 1.2 can be both Gaussian and non-Gaussian. The higher order spectrum ofa Gaussian signal is identically zero and for a non-Gaussian noise is flat. Hence HOSA helps in increasingthe SNR of the signal[3]. On the other hand a simple autocorrelation is not prone to these noises and thenoises also show up in the power spectrum.

    2. HOSA based approaches tend to preserve phase information which is lost in the power spectrum is oth-erwise lost in the power spectrum. Thus HOSA retains more information than the power spectrum

    3. Non-linearities present in the signal also can be estimated using higher order moments.Physiological signals

    like the ECG are non-linear in nature[4] thus a linear analysis approach like the power spectrum andfrequency estimation are not sufficient.

    It is for the above mentioned reasons that HOSA is a better technique for analysis of ECG beats as comparedto the conventional autocorrelation and FFT based approaches.

    2.2 Quadratic Phase Coupling (QPC)

    A common approach to analysis of signals is the estimation of the frequencies and power of the sinusoidalcomponents. If the system is non-linear, say second order, then some of the sinusoidal components wouldexhibit a harmonic relation relationship to form bifrequencies 1. Presence of these bifrequencies in the powerspectrum does not indicate that they have necessarily been generated by a non-linear system. However if welook at the phase components of these harmonics then for a second-order non-linear system the individual phasecomponents would also add up along with the frequency components, which is not the case for a linear system.Meaning that for a frequency f1 with phase 1, if passed through a second order non linear system the resultantsignal would contain a component 2f1 and 21. This phenomena of phases adding up can only be observed ina second order non-linear system and not a linear system [5]Consider the following example:Assume a discrete time system

    y(n) = x(n) + x2(n) (1)

    x(n) = cos(f1n + 1) + cos(f2n + 2). (2)

    y(n) = cos(f1 + 1) + cos(f2n + 2) + cos2(f1n + 1) + cos

    2(f2n + 2) + 2 cos(f1n + 1) cos(f2n + 2) (3)

    1If three frequencies f1,f2 and f3 are such that f3 = f1 + f2 then the triple ( f1 , f2 , f3 ) is said to be a bifrequency.

    3

  • 8/2/2019 bicoherencia ECG

    9/22

    using

    2 cos(A) cos(B) = cos(A + B) + cos(AB) (4)

    1 + cos(2A) = cos2A (5)

    y(n) = cos(f1n + 1) + cos(f2n + 2) + 1 + cos(2f1n + 21) + 1 + cos(2f2n + 22)

    + cos(f1n + f2n + 1 + 2) + cos(f1n f2n + 1 2)(6)

    Note The following bifrequency triples in y(n):

    Bifrequency Pairs Corresponding Phases(f1,f1,2f1) (1,1,21)(f2,f2,2f2) (2,2,22)

    (f1,f2,f1+f2) (1,2,1+2)(f2,f1-f2,f1) (2,1-2,21)

    In the example above the phase of the component of the frequency f1+f2 in y(n) is given by 1+2, which isthe sum of the phases of the fist two components of the bifrequency. Since a second order non-linearity gives riseto this such a phase relationship is known as Quadratic Phase Coupling or QPC[5]. Thus if we have somemethod of measuring the degree of (QPC) between the various frequency components present we can commenton the presence or the absence of second order non-linearity of a signal. Bicoherence is one such measure.

    2.3 Bicoherence

    Bicoherence is the quantity used to estimate the contribution of the second-order non-linearity to the powerin the bifrequencies[5].The Bicoherence bic(1,2)is defined as:

    bic(1, 2) =| B(w1, w2) | /

    P(w1)P(w2)P(w1 + w2) (7)

    where

    B(w1, w2) =

    k=

    l=

    c(k, l)exp[jw1k + w2l] (8)

    c(k, l) = E{x(n)x(n + l)} (9)

    c(k,l) is defined as the third order moment of the sequence x(n)or the third order cumulant of x(n). E{.} denotes the expectation. B(w1,w2) is the 2-D Fourier Transform of c(k,l) and is also known as the Bispectrum.For stationary Gaussian process, the third order cumulant sequence and hence the bispectrum are identicallyzero.[5]Consider the following example.Let

    x(n) =3

    i=1

    Ai cos(fin + i) + B cos(f3n + ) (10)

    where f3=f1+f2 and 3=1+2 , phase angles 1,2,3 and are independent and uniformly distributed over[0,2]. is not equal to the sum of any of the combinations of i.The contribution to the power spectrum of x(n) at frequency f3 is partly due to the quadratic coupling i.e. dueto the signal with the phase 3 and due to the non-coupled or the signal with the phase . Thus the fractionof the total power at f3 due to coupling is equal to[5]:

    A23/(A23 + B

    2) (11)

    Now consider the following two scenarios:

    1. There are no phase coupled frequencies present in x(n) as defined in equation (10) i.e 3 = 1 + 2 and is not equal to the sum of any combination of i then the fraction of total power at f3 due to couplingwould be zero.

    2. There are only phase coupled frequencies present in x(n) as defined in equation (10) i.e the value of B asdefined in equation (10) is zero then the fraction of total power at f3 due to coupling would be one.

    4

  • 8/2/2019 bicoherencia ECG

    10/22

    Thus a zero value of equation (11) indicates absence of any phase coupled frequencies in a signal whereas thevalue of one indicates presence of only phase coupled frequencies. If some processing on the signal results in theabove fractions we would be in a position to estimate the presence/absence of phase coupled frequencies. Thepresence/absence of the phase coupled frequencies would in turn indicate the presence/absence of second ordernon-linearity in the signal. Bicoherence is one such estimate. To understand bicoherences output consider thefollowing altered version of the above example:

    x(n) =3

    i=1

    Ai cos(fin + i) +3

    i=1

    Bi cos(fin + i) (12)

    As stated in the previous example f3=f1+f2 and 3=1+2 , phase angles 1,2,3 and 1,2 and 3 areindependent and uniformly distributed over [0,2]. i are not equal to the sum of any combination of i andi. The bicoherence as defined in equation ( 7) at (f1,f2) would be:

    [A21

    (A21 + B21)

    ][A22

    (A22 + B22)

    ][A23

    (A23 + B23)

    ] (13)

    Each term within the square bracket is equal to the fraction of the power contributed to the coupling in thebifrequency by the concerned frequency[5]. For instance [A23/(A

    23+B

    2)] is the fraction of the power in thefrequency f1 contributing to the coupling in (f1,f2,f3). IfB2 and B3 are zero then equation (13) reduces toequation (11).

    2.4 Finding Bicoherence for a given signal

    Finding the bicoherence for a signal x(n) has been described in [5].Suppose x(n) is given with n=0,1,....,N-1.Let N=LM where L and M are integers. The first step is to break the sequence into L segments of M each as:

    xl(m) = x(M(l 1) + m) xl m = 0, 1,.....,M 1; l = 1, 2,...,L (14)

    where xl is the sample mean of the lthe record. The next step is to take the M-point DFT of each record as

    Xl(k) = DFTxl(m) k = 0, 1,...,M 1; l = 1, 2,...,L. (15)

    Estimates of the power spectrum is obtained for each record as

    Pl(k1) = |Xl(k1)|2Wp(k1) (16)

    Pl(k2) = |Xl(k2)|2Wp(k2) (17)

    Pl(k3) = |Xl(k1 + k2)|2Wp(k1 + k2) l = 1, 2,...,L (18)

    Where Wp(k) is a smoothing window. The final power spectrum estimates are then obtained by averaging overall records as

    Pl(k1) =1

    L

    Ll=1

    Pl(ki) i = 1, 2, 3 (19)

    For the bispectrum the estimates are obtained as

    Bl(k1, k2) = Xl(k1)Xl(k2)X

    1 (k1 + k2)Wb(k1, k2) l = 1, 2,...,L (20)

    where * denotes the complex conjugation and Wb(k1, k2) is again a smoothing window. the final estimate isobtained by averaging over the records as

    B(k1, k2) =1

    L

    Ll=1

    B(k1, k2) (21)

    The bicoherence estimate is formed by combining the bispectrum and the power estimates as:

    bic(k1, k2) = | B(k1, k2)|/

    Pl(k1) Pl(k2) Pl(k3) (22)

    If a large number of samples and statistically independent records are given then the squared bicoherenceestimate as formed above tends to the fraction of the power due to quadratic coupling[5].

    5

  • 8/2/2019 bicoherencia ECG

    11/22

    2.4.1 bicoher function of HOSA Toolbox ver 2.0

    This project uses bicoher function of the Higher Order Spectral Analysis Toolbox ver 2.0 by Ananthram Swami,Jerry M. Mendel, Chrysostomes L. (Max) Nikias to find the bicoherence. bicoher uses the direct FrequencyDivision method for bicoherence estimation. Other approaches can be found in [5].The bicoher function has thefollowing format:

    [bic, waxis] = bicoher(y, nfft,wind,nsamp,overlap)

    The parameters have the following meanings:

    1. y:The data vector or the time series for which bicoherence has to be found.

    2. nfft: fft length [default = power of two nsamp] actual size used is power of two greater than nsamp

    3. wind: specifies the time-domain window to be applied to each data segment should be of length segsamp(see below). If no window is specified it uses the Hanning window. This corresponds to the smoothingwindow Wp specified in Sec 2.4.

    4. nsamp: samples per segment. Default value chosen is such that there are a minimum of 8 segments.

    5. overlap: percentage overlap, allowed range [0,99]. [default = 50];

    6. bic: estimated bicoherence.The output would be a real valued 2-D matrix of size nfft x nfft with the origin

    as w=(0,0) at the center point of the matrix. Since digital frequencies fall in the range[-] values to theleft and above the origin would correspond to negative frequencies whereas values on the right and belowthe origin would correspond to positive frequencies.

    7. waxis- vector of normalized frequencies(w=F/Fs)2 associated with the rows and columns of bic.

    2.4.2 Plotting bicoherence and interpreting the plots

    The bicoherence plots as shown in Fig2.4 and Fig2.5 have been plotted using the surf function of MATLAB.The plot shows the bicoherence output on the z-axis and x and the y axis have the absolute frequency inHz. Absolute frequency is calculated by multiplying w(the output of the bicoher) method with the samplingfrequency. The surf command looks like the following:

    surf(w Fs,w Fs,bic)

    where w and bic are the outputs of the bicoher function as explained in the section above and Fs is the samplingfrequency of the input signal.Fig2.6 and Fig2.7 show the 2-D cross-section of the 3-D plots of Fig2.4 and Fig2.5 respectively. The 2-D plothas absolute freq in Hz on the x axis and bicoherence value on the y-axis corresponding to (wslice, wx). wsliceis the frequency along which the cross-section has been taken and wx indicates the frequency from [-pi].Thefollowing command can be used for plotting the 2-D cross section plots.

    plot(w Fs,bic(:, 65), r : )

    where w and Fs are the output of bicoher function and the sampling frequency respectively. bic(:,65) denotesthe 1-D matrix of all the rows of bic along column number 65 of 2-D matrix bic. This would plot the slice along

    the frequency present at index number 65 of w i.e. value present at w(65).

    2F is the freq in Hz and Fs is the sampling frequency in Hz

    6

  • 8/2/2019 bicoherencia ECG

    12/22

    Figure 2.4: Bicoherence of a normal beat,MIT-BIH SVDB Database

    Figure 2.5: Bicoherence of an abnormal beat,MIT-BIH SVDB Database

    Figure 2.6: Value of bicoherence along w=0 for Fig. 2.4

    7

  • 8/2/2019 bicoherencia ECG

    13/22

    Figure 2.7: Value of bicoherence along w=0 for Fig. 2.5

    2.5 Bicoherence for ECG beats

    Bicoherence for ECG signal showed peculiar patterns. Normal beats displayed presence of constant bicoherencefor a range of frequencies whereas abnormal or diseased beats displayed a lack of it.(Ref to Fig 2.4 to 2.5).The bicoherence value in case of a normal beat remained constant over a range of frequencies whereas incase ofan abnormal beat it dipped in values. This indicates the following:

    1. Phase coupling for a normal beat is present for a range of frequencies.

    2. The product of the fractions of power of frequencies in (f1, f2, f3) contributing to coupling remains constantfor a patch of frequencies for a normal beat.

    3. Phase coupling for an abnormal beat is absent for a range of frequencies.

    4. Since bicoherence for an abnormal beat is absent it indicates the absence of particular frequencies or the

    absence of phase coupling as explained in Sec2.3.The next section explores the nature of time domain signal for which the bicoherence value would stay constantfor a range of frequencies.

    2.6 What does constant Bicoherence mean?

    Constant bicoherence over a range of frequencies is a typical phenomena translating into a very interestingresult in the time domain representation.Consider the bicoherence values for (w1,w2) where f1 w1 f5 and f1 w2 f5. Assuming that frequenciesgreater than f5 are absent. From equation (13) we can conclude that bicoherence at (1,2) and (2,1) shall havethe same value. Thus equation (13) remains same for (fi,fj) and (fj ,fi). Therefore we consider (13) only forthe top diagonal frequencies i.e. only for the following pairs:

    (1,1),(1,2),(1,3),(1,4),(1,5),(2,2),(2,3),(2,4),(2,5),(3,3),(3,4),(3,5),(4,4),(4,5) and (5,5)

    Since it is assumed that frequencies greater than f5 are absent therefore value of (13) for (wi,wj) where i + j>5reduces to zero. Thus from the above mentioned pairs we are left with:

    (1,1),(1,2),(1,3),(1,4),(2,2) and (2,3)

    Let all these points have the same bicoherence value k. Let us also assume that:

    yi = A2i /(A

    2i + B

    2i ) (23)

    Then we have the following equations:

    y21

    .y2 = y1.y2.y3 = y1.y3.y4 = y1.y4.y5 = y2

    2

    .y4 = y2.y3.y5 = k (24)

    (25)

    8

  • 8/2/2019 bicoherencia ECG

    14/22

    Solving the above set of equations result in:

    y1 = y3 = y5 (26)

    and

    y2 = y4 =k

    y21(27)

    let (26) be equal to g.

    A24B24

    =A22B22

    =k

    g k(28)

    A21B21

    =A23B23

    =A25B25

    = g (29)

    A4B4 = A2B2 A1B3 = A3B1 (30)

    A1B5 = A5B1 A5B3 = A3B5 (31)

    (32)

    Thus in the time domain the signal would look like for any arbitrary a1 and b1:

    a1cos(f1t + 1) + b1cos(f1t + 1)+

    i=2n+2,n=0

    cos(fit + i) + P cos(fit + i)+

    i=2n+1,n=1

    cos(fit + i) + Q cos(fit + i)(33)

    where P=

    Qk

    kand Q=

    b1a1

    Assuming that i+j=i+j but i+j=i+j

    The above signal representation leads to the following inferences:

    1. The fraction of total power due to coupling at even and odd frequencies would be equal to each otherrespectively.

    2. The ratio of power of coupled components to uncoupled components at even and odd frequencies remainssame.

    3. The ECG beat being generated consists of both even and odd in constant power ratios and should abideby the above results.

    3 Discussion

    3.1 Bicoherence based ECG Analysis

    As mentioned in section 2.5 normal and abnormal ECG beats showed presence and absence of constant phasecoupling.The absence as observed mapped to peaks being present in the bicoherence plot for an abnormal beat.Hence if we are able to test the bicoherence value for presence and the absence of flatness we will be in a positionto label a beat as normal or abnormal respectively. With this motivation the following sections describe thesteps adopted for ECG analysis and classification.

    3.2 Steps in ECG Analysis

    The detailed algorithm for ECG analysis is shown in Fig3.8. The algorithm broadly consists of the followingsteps:

    1. Splitting incoming ECG signal into beats: Since the objective of the project is to label individualbeats as normal or abnormal. The first step is to split the ECG signal into individual beats. This processof splitting the signal into individual beats is shown in the first two rows of Fig 3.8. The detailed algorithmwith reasons for splitting up the signal into individual beats is given in sec 3.2.3.

    2. Bicoherence Calculation: Once the beats have been split up bicoherence for the every beat is calculatedas explained in sec 2.4.1.

    3. Detection of the flatness for a range of frequencies For the sake of simplicity of analysis a 2-Dcross-section was taken along w=0 for bicoherence as mentioned in Sec 2.4.2. This 2-D slice or 1-D arraywas the tested for flatness of the ECG beats using a windowed mean based approach.

    9

  • 8/2/2019 bicoherencia ECG

    15/22

    Figure 3.8: ECG Analysis System

    3.2.1 Why no filter is required?

    Typically the first step to any nature of an ECG analysis is to obtain the clean ECG signal contaminated by thevarious noise components as stated in section 1.2. In addition to the reasons mentioned in sec 2.1 the followingare the reasons why a filter is not used in a QPC based analysis system:

    1. A filter is bound to add phase to the existing signal thereby disrupting the existing phase correlations.

    2. The high frequency noise(>=50 Hz) and low frequency noise (

  • 8/2/2019 bicoherencia ECG

    16/22

    and is implemented as the following difference equation:

    y(nT) =2x(nT) + x(nT T) x(nT 3T) 2x(nT 4T)

    10(35)

    2. Square : Squaring the five point derivation of the signal.

    y(nT) = [x(nT)]2 (36)

    This operation makes all the data points in the processed signal as positive and amplifies the derivativeprocess non-linearly. It boosts the higher frequencies in the signal which are mainly due to the QRScomplex.

    3. Moving window integral : The slope of the R wave alone is not a guaranteed way to detect a QRScomplex. Many abnormal QRS complexes have large amplitudes and long durations but not steep slopes[8].Thus using the squared derivative alone( i.e. slope alone) we can not extract the information about these.The moving window integration extracts features in addition to the slope of the R wave. It is implementedwith the following difference equation:

    y(nT) =x(nT (N 1)T) + x(nT (N 2)T) + ... + x(nT)

    N(37)

    Value of N was chosen to be 20 i.e. 156.3ms for a signal sampled at 128Hz as an approximation to 150msas given by [8].

    4. Beat Extraction Taking a look at the output of the moving window integral(Ref Fig. 3.13) we realize thatcorresponding to every QRS complex we get a what looks like an inverted tumbler. The ECG beat startsmid-way, roughly speaking, between the end point of a tumbler and the starting point of the succeedingtumbler and ends at the mid point between a tumblers end and the start point of the other tumbler.What we are essentially doing is that we detect the R point which we assume to be at middle of theinverted tumbler, then we say that the beat lies between the mid points of three consecutive R points.This methodology is an approximate way of detecting beats. The reason this approach works is becausethe ECG being a nearly periodic signal we would have shifted all the start and stop points by the sameamount. Thus the statistical properties for every beat would bear the same nature. However this poses adifferent kind of problem as described in sec 4.3.

    The resultant waveforms for the above mentioned steps are shown below Fig. 3.9-Fig. 3.15. Once the samplenumbers for each of the start and stop for the beat are known, the samples between the start and the stoppoints of the original ECG signal are passed for calculation of the bicoherence and classification.

    Figure 3.9: ECG Signal: First 1000 samples of MIT-BIH SVDB Database, rec:800.dat

    11

  • 8/2/2019 bicoherencia ECG

    17/22

    Figure 3.10: ECG signal after five point derivative

    Figure 3.11: Derived ECG signal after squaring

    Figure 3.12: The fourth peak zoomed from the above plot

    12

  • 8/2/2019 bicoherencia ECG

    18/22

    Figure 3.13: ECG signal after deriving, squaring and moving window integration

    Figure 3.14: Mid Point detection as mentioned in Sec 3.2.3

    Figure 3.15: The fourth beat extracted from the original signal

    13

  • 8/2/2019 bicoherencia ECG

    19/22

    3.2.4 ECG beat Classification

    Ref Fig. 2.4-Fig 2.7 . It was observed that along the w=0 slice (Ref sec2.4.2)the bicoherence stayed nearlyconstant for some time and then dipped very fast for normal beats. In order to find for which frequencies ingeneral the bicoherence stayed constant. Cross bicoherence of all the normal beats was found out. I was observedthat for normal ECG signals for a slice along w=0, the bicoherence value stayed constant for frequencies between10Hz and 30Hz. Once this was known he following approaches were adopted for detecting if the bicoherencevalue stayed constant for the above mentioned frequencies:

    1. Derivative: The problem with the derivative based approach was that whenever the bicoherence valuehad ripples, which is normally the case. The derivative showed spikes in the value.

    2. Windowed Mean: Taking a windowed mean for the intervals 10Hz-14Hz,15Hz-19Hz,20Hz-24hz and25Hz-30 Hz. The variance for this sample set along with the maximum value between 10-30Hz was calcu-lated. It was observed that for normal beats the average standard deviation value was 1.456. Thereforethe system at the end compared the standard deviation to 1.456 , if the value was less or equal to 1.456then the beat was labeled as normal else it was labeled as abnormal.(Ref Fig. 3.16)

    Figure 3.16: Plots of windowed mean

    4 Conclusion

    4.1 Data source for Testing

    The data source for testing can be obtained from [19]. ECG data available at [19] is classified for various elementsand can be downloaded from [19] free of cost. The data comes in a bundle of three files with the extensions of.dat,.hea and .atr. The .dat file contains the ECG data where as .hea contains the header information required

    for reading this .dat file. The .atr file contains the annotations and the time of annotation. Annotations are a setof symbols adopted by [19] for classification of ECG beats or the occurrence of an event. The annotation timeis the time of the occurrence of the event with respect to the starting time of the signal. A list of annotations

    14

  • 8/2/2019 bicoherencia ECG

    20/22

    with their meanings can be found at[19].The file formats for the above mentioned files are also available at[19]. A series of free programs both in C/C++and MATLAB are available for reading the data. This project used the source code by ose Garcia Moros andSalvador Olmos, available on MIT-BIH website[19] for reading the ECG data.

    4.2 Statistical Results for Data Tested

    Record Number800.dat

    Normal classified as Normal 770Normal classified as Abnormal 42

    Abnormal classified as Abnormal 11Abnormal classified as Normal 17

    100.datNormal classified as Normal 176

    Normal classified as Abnormal 351Abnormal classified as Abnormal 1

    Abnormal classified as Normal 316483.dat

    Normal classified as Normal 701Normal classified as Abnormal 352

    Abnormal classified as Abnormal 0Abnormal classified as Normal 5

    19090.datNormal classified as Normal 632

    Normal classified as Abnormal 346Abnormal classified as Abnormal 23

    Abnormal classified as Normal 52801.dat

    Normal classified as Normal 577Normal classified as Abnormal 195

    Abnormal classified as Abnormal 226Abnormal classified as Normal 115

    18177.datNormal classified as Normal 1106

    Normal classified as Abnormal 129Abnormal classified as Abnormal 43

    Abnormal classified as Normal 35856.dat

    Normal classified as Normal 897Normal classified as Abnormal 192

    Abnormal classified as Abnormal 22Abnormal classified as Normal 10

    843.datNormal classified as Normal 1033

    Normal classified as Abnormal 45Abnormal classified as Abnormal 2

    Abnormal classified as Normal 4

    Data taken from MIT-BIH Database[11]Normal beats correctly detected : 82.79%Normal beats incorrectly detected : 17.21%Abnormal beats correctly detected : 70.13%Abnormal beats incorrectly detected : 29.87%

    15

  • 8/2/2019 bicoherencia ECG

    21/22

    4.3 Observations made and problems in testing

    .

    The following problems were observed while testing the ECG analysis system:

    1. A problem observed was the fact that for premature beats the detection of the abnormality took placeexactly a beat before the abnormal beat and for late beats it was detected exactly a beat later. The reasonfor this was attributed to the rough methodology adopted for ECG beat detection. When a prematurebeat occurred, because of taking the mid-points the beat length of the beat before the premature beat

    was lessened as a result the phase coupling between the frequencies was absent. Thus the abnormal beatwas getting detected a step before or a step later.For instance Fig. 3.16 abnormality is actually at beat 5however it is detected both at 4.

    2. The system picked up 10 seconds of data (sampled at 128 Hz)in one go i.e. 1280 samples from the storeddata analyzed, produced results and again picked 10 seconds of data and so on. The fixed window sizeresulted in part of an ECG beat appearing at the end of a window and the other part of the same beatappearing in the other window . Since only a part of the beat appeared in a window the standard deviationwas higher and the beat resulted in being classified as abnormal.

    3. The data provided by [18] also contains annotations like change in the quality of the signal which have norelevance to the ECG data. While testing this posed as a problem. The problem was when you are doinga one to one matching of the annotations and their times. This kind of annotation would go undetected by

    the ECG analysis system resulting in a mismatch of the alignment of (annotation time given,annotationgiven) and (annotation time detected,annotation detected). Thus effectively reducing the accuracy.

    4. The annotated data present on [18] varies in the time of annotation. Some databases like the MIT-BIHAFDB database annotate the signal at the start of the beat whereas the others like SVDB database doso towards the end.

    4.4 Scope for improvement and research

    The following points can be further improved in the system:

    1. Beat Detection can be improved so that the problem of premature beat classification as mention in Sec.3.2.4 can be done away with

    2. A better understanding of bicoherence for choosing an appropriate slice instead of w=0Hz needs to bedeveloped.

    3. The system presented above merely tries to prove that a bicoherence based ECG classification system ispossible , refinements in detection of flatness of the slice needs to be looked at.

    4. Most of the ECG beats lying at the starting and ending of the 1000 size window were classified as abnormalbecause the windowing resulted in slicing these. Since the beats were incomplete the bicoherence resembledthat of an abnormal beat. Thus a better mechanism like adaptive windowing needs to be looked at.

    16

  • 8/2/2019 bicoherencia ECG

    22/22

    5 References

    References

    [1] www.medicinenet.com/electrocardiogram ecg or ekg/article.htm, As on April 2005.

    [2] www.nlm.nih.gov/research/visible/vhpconf98/AUTHORS/WERNER/IMAGES/ECG.GIF, As on April 2005

    [3] J.M. Mendel Tutorial on higher order Statistics in signal processing and System theory: theoretical results

    and some applications, Proc. IEEE, vol. 79 pp. 278-305, Jan 1991

    [4] LDR Sandeep Saxena Higher Order Spectrum of Biomedical Signals: Hardware Implementation, M. TechThesis, May 2004, IIT-D, India

    [5] M.R. Raghuveer Time-Domain Approaches to Quadratic Phase Coupling,IEEE Transcations on Auto-matic Control, Vol. 35, No. 1, January 1990

    [6] Gangandeep S. Sandha, Pawan K. Singh, Neha Oberoi, D. Nagchoudhuri Phase Correlations in Hu-man EEG Signal: A Case Study, Second IEEE International Workshop on Electronic Design, Test andApplications, January 2004

    [7] Rangayyan RM. Biomedical Signal Analysis: a case study approach.Wiley, New York, NY, 2002.

    [8] Tompkins WJ. Biomedical Digital Signal Processing. Prentice Hall, Englewood Cliffs, NJ, 1989.

    [9] Ananthram Swami, Jerry M. Mendel, Chrysostomes L. (Max) Nikias Higher Order Spectral AnalysisToolbox: Users Guide ver 2.0.

    [10] http://www.cs.wright.edu/phe/EGR199/Lab 4/, As on April 2005

    [11] GVS Chiranjivi, Vamsi Krishna Madasu, Madasu Hanmandlu, Brian C. Lovell Arrhythmia Detection inHuman Electrocardiogram

    [12] tephanie Caswell Schuckers, Xueyan Xu, Michael E. Schuckers, Janice M. Jenkins Ventricular ArrhythmiaDetection Using Time-Domain Template Algorithms

    [13] Laszlo Szilagyi Application of the Kalman Filter in Cardiac Arrythmia Detection, proceedings of the

    20th Annual International Conference of the IEEE Engineering in Medicine and Biology Society, Vol. 20,No 1,1998

    [14] Vinod V kumar A novel approach to pattern recognition in real time arrythmia detection,REC Trichi

    [15] Nitish V. Thakor, Yi-Sheng Zhu Applications of Adaptive Filtering to ECG Analysis: Noise Cancellationand Arrythmia Detection, IEEE Transsactions on Biomedical Engineering, Vol. 38, No.8, August 1991.

    [16] Valtino X. Afonso,Willis J. Tompkins, Truong Q. Nguyen, Shen Luo, Member, ECG Beat DetectionUsing Filter Banks, IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING, VOL. 46, NO. 2,FEBRUARY 1999

    [17] A.Alliche,K.Mokarani,Higher order Statistics and ECG Classification

    [18] Ziad Elghazzawi, Fredrich Geheb Knowledge Based System for Arrhythmia Detection,Siemens MedicalSystems,Danvers,MA,USA

    [19] MIT-BIH Databasehttp://www.physionet.org/physiobank/database/ecg, as on April 2005

    [20] Meenakshi Sukhiya Low noise power interface design for Higher order Spectral analysis of ECG Signals,M.Tech. thesis, May 2004, IIT-D, India

    [21] Patrick S. Hamilton,Open Source ECG Analysis Software Documentation http://www.eplimited.com/

    [22] Raman Arora,Shailesh Patil Methods of Quadratic Phase Coupling, B.Tech Thesis, Dept. of Electronicsand Communications Enineering, NSIT, May 2001.

    [23] Chrysostomos L. Nikias and Jerry M. Mendel,Signal Processing with Higher Order Spectra, IEEE Signal

    Processing Magazine, July 1993