You are on page 1of 4

ECG Signal Preprocessing using LabView : LMS based Adaptive Filter for Powerline Interference Cancellation

Eka Firmansyah*, Udayanto Dwi Atmojo*


*Department of Electrical Engineering and Information Technology, Gadjah Mada University Jalan Grafika 2 Yogyakarta 55281

eka.firmansyah.te@te.ugm.ac.id, mas_ud@mail.te.ugm.ac.id
AbstractThis paper considers Least Mean Square (LMS) algorithm to subsequently modify adaptive filter wieghts. The corresponding filter is used to cancel noise caused by powerline interference contained in Electrocardiograph (ECG) signal. The design is then implemented on LabView software. The simulation shows that the design can reduce powerline interference. Average powerline noise power contained in the signal is attenuated by more than 20 times. (Abstract) ECG; Least Mean Square; LabView ; Steepest gradient descent; Adaptive Filter; Powerline interference (key words)

II.

LEAST MEAN SQUARE ALGORITHM (LMS)

Adaptive LMS algorithm is derived from adaptive linear combiner which is formulated below [1][4]:

(1) Which yk expresses output signal, Xk expresses input signal and Wk expresses weight vector. Weight vector Wk is adjusted such that output signal yk agrees to the desired response signal dk, thus minimizing error signal k. The corresponding error signal is used to adjust the weight vector, as seen in Eq.2 below [4].

I.

INTRODUCTION

Electrocardiogram (ECG) signal is commonly used by medical examiners to diagnose patients with heart-related problems. Patients who have specific anamnesis or who complains something indicating heart-related problems are usually told to take ECG test. The device used to record ECG signal is called Electrocardiograph. The device records biopotential differences originating from electrical activity of the heart muscle [3]. Medical examiners use the ECG recording to determine the most probable diagnosis for the particular patient. Throughout recording process, unwanted noise might interfere with the acquired signal. Common noise includes magnetic induction, displacement currents in leads or in the body of the patient, and equipment imperfections and interconnections [1][3]. One of the most significant problems in the recording process is the appearance of unwanted powerline interference in the output [1]. Such noise might alter the acquired ECG signal considerably in which the signal becomes uninterpreted. There are several methods for minimizing powerline interference noise. Proper grounding and the use of twisted pairs are some common techniques applicable in the recording process itself [1]. Analog or digital filter might also be utilized to minimize noise. Another method for reducing powerline interference is adaptive noise cancelling, which can be utilized separately or in conjunction with more approaches [1]. Adaptive noise cancelling employs digital filter with adaptively changing weight such that the filter can minimize noise signal and retain the information signal. In this research, Steepest Descent Least Mean Square algorithm is used to modify filter weight. The algorithm along with the filter model is simulated using LabView software.

(2) As error might be random in distribution and probability, the term square error is used. The expected value of square error (E[k2]) is expressed below [4]. E[k2] = (3) As E[XkXkT] = R and E[dkXk] = P, then: (4) Which R denotes autocorrelation of input signal xk and P denotes crosscorrelation between desired response dk and xk.To find the Minimum Square Error (MSE), the gradient of E[k2] is derived and is made equal to zero, which is expressed below [4].

(5) The expression above is used to find the optimum weight W*, which is the can be futher expressed below (Wiener filter equation) [4]. (6)

In real application, it is difficult to determine the exact value of R and P, thus Minimum Square Error or Least Mean Square (LMS) algorithm can be approached recursively using the formula below [4]. (7) (8) Which Wk+1 denotes the updated filter weight and denotes step size for the iteration process. Step size must be chosen carefully to keep the filter weights updating process from being divergent. If the process becomes divergent, then the filter weight values might approach infinity so is the filter output. III. SYSTEM DESIGN

The noise-contaminated ECG signal is then substracted with the generated signal from the adaptive filter, resulting the error signal k, which is actually the cleaned ECG signal. Using (7), the error signal k is used to change filter weight Wk , such that it satisfies (5) and (6). By choosing a particular value of as stated in (7), the filter weight value Wk will converge to optimum value. To observe the performance of the system, the SNR (Signal to Noise Ratio) value of the cleaned signal and the input signal will be compared. User interface of the LabView software will display the signal waveform, u value setting, filter weight, and SNR values. Fig.3 below displays the user interface of LabView software.

The system consists of several parts, which is illustrated in Fig.1 below.

Figure 3. LabView user interface Figure 1. System block diagram

IV. ECG signal contains noise caused by powerline signal, which has fundamental frequency of 50 Hz, randomly shifting to represent the powerline shifting frequency, and random amplitude. A reference noise, which is signal obtained from the powerline (using sensor, for instance), is used in order to make the filter be able to produce signal that closely resembles the noise itself. The simulated model shown in Fig.1 utilizes two weights filter in adaptive predictor model. The reference noise obtained from the powerline signal is used along with its 900 degrees-delayed version. The filter weight Wk is adaptively changed using LMS algorithm stated as (7) and (8) in order to predict the powerline noise contained in the ECG signal. The overall system is illustrated in Fig.2 below [1][2].

SIMULATION RESULTS AND DISCUSSIONS

The system is simulated using LabView software. The ECG signal used in this simulation is a patient heartbeat signal file acquired from PhysioBank database. The file is in .wav format, has sampling rate of 1 kHz and 60 seconds recording, resulting in 60.000 samples. Fig.4 below displays the ECG signal used in this simulation.

Figure 4. ECG signal used

Powerline interference may cause significant disturbance, thus rendering interpretation and diagnostic impossible. Fig.5 below shows the ECG signal that contains powerline interference noise.

Figure 2. Illustration for ECG line interference cancelling

Figure 5. Powerline interfered ECG signal

Figure 6. Cleaned ECG signal

In this simulation, several values which produce convergent results are used to change filter weights and then the results will be observed based on the resulting SNR value. Table 1 below shows the SNR values in regards of each values used. A total of 60.000 iterations are done for each value.
TABLE I. No 1 2 3 4 5 6 7 8 9 10 11 SNR VALUES FOR EACH U VALUES value used 0,005 0,006 0,007 0,008 0,009 0,01 0,011 0,012 0,013 0,014 0,015 SNR Input 4,23 4,54 5,18 4,91 5,07 3,77 4,49 5,33 5,67 4,74 5,08 SNR Output 22,10 22,03 23,93 24,32 23,56 23,09 23,13 23,08 22,82 22,65 22,47

In this simulation, the model is unable to cancel out noise entirely due to the use of single frequency noise reference, as for the frequency of the noise itself is randomly shifting around its fundamental frequency (50 Hz). Fig.5 below shows the cancellation error of the system. Although the model has improved SNR value, small amplitude oscillation shown in Fig.7 still occurs because of the small uncorrelation between reference noise and the noise.

Figure 7. Cancellation error

From the results shown in Table 1 above, value of 0,007 and 0,008 displays the best results, showing the most significant increase in SNR compared to the other values as bigger increase in SNR indicates better noise cancellation. Also, based on results shown in Table 1 above, using values ranged from 0,005 until 0,015 will increase the SNR signal ranging from 17-19 dB. The SNR increase of 17-19 dB means the average noise signal power has been reduced about 50-79 times. Fig.6 below shows the result of noise cancellation on the ECG signal.

The use of Steepest Descent algorithm to approximate Wiener filter solution (6) simplifies the mathematical and programming complexity which the Wiener equation has. Unfortunately, this particular algorithm has no exact equation to express the optimum filter weight Wk. Instead, it uses step size which the value itself might be different for each filter constructions or models. Thus, to determine step size value used for the application, multiple trials are needed. SNR value is the one of most distinct variables to determine whether a particular step size is optimum for the application. Judging from the signal displayed in Fig.6, although oscillations still occur, the average noise power has been significantly reduced so the ECG signal is recovered. The cleaned ECG signal will be adequate for diagnostic purposes.

V.

CONCLUSIONS

ACKNOWLEDGMENT The authors would like to say their gratitude to Mr. Anugerah Galang Persada who has helped for the implementations and troubleshooting of the simulation. REFERENCES
[1] [2] B. Widrow, S. D. Stearns, Adaptive Signal Processing. PrenticeHall, 1985. B. Widrow et al, Adaptive noise cancelling: principles and applications. Proc of the IEEE, Vol. 63, No. 12, pp. 1692-1716. December 1975. R. Aston, Principles of Biomedical Instrumentation and Measurements, Merrill Publishing Company, 1991. S. A. D. Prasetyowati, A. Susanto, T. S. Widodo, J. E. Istiyanto, Adaptive LMS noise cancellation of wideband vehicles noise signals, Proc of International Conference on Green Computing ICGC 2010. 2010.

In this paper, steepest descent LMS algorithm is used in the adaptive filter for filter weight update. The adaptive filter is put on to adaptive predictor model to cancel powerline interference noise contained in ECG signal. The proposed model is simulated using LabView software. The simulation shows that the proposed model is working very good. The model can significantly cancel interference noise. SNR output signal is increased for 1719 dB or the average noise power is attenuated 50-79 times. Despite oscillations still occur due to uncorrelation between reference noise and the noise, the cleaned signal is adequate to be used for diagnostic purposes judging from the waveform display.

[3] [4]

You might also like