International Journal of Engineering Trends and Technology (IJETT) – Volume 4 Issue 10 - Oct 2013 Design And Implementation Of Height Adjustable Sine (Has) Window-Based Fir Filter For Removing Powerline Noise In ECG Signal Mbachu C. B1. and Anumaka M. C2. 1 2 Department of Electrical and Electronic Engineering, Anambra State University, Uli, Nigeria Department of Electrical and Electronic Engineering, Imo State University, Owerri, Nigeria . Abstract−An electrocardiogram (ECG) is a simple but vital test which records the rhythm and electrical activity of the heart. The appearance of the recorded ECG signal tells doctors if a patient is suffering from any heart disease such as enlargement or thickening of the heart, or if a heart attack is likely to occur or had earlier occurred. ECG signal is contaminated with other signals including powerline noise which must be filtered off, otherwise the recorded ECG signal will convey information that is not correct. In this paper a narrow band stop digital filter is designed with adjustable height sine (HAS) window for suppression of powerline noise in ECG signals. Matlab is used to generate the signal and noise as well as observe and record the results. Keywords: HAS Window, ECG, Powerline noise, band stop filter 1. Introduction There are various filter types that can be used to remove powerline noise in ECG signal. The filter may involve IIR, FIR and adaptive filters and each has its own advantages and disadvantages. FIR filter has a finite impulse response and therefore always stable but its number of coefficients is very large which implies larger memory space for the storage of the coefficients and higher computation time. On the other hand IIR filter has less number of coefficients but can be unstable sometimes due to feedback loops. In FIR filters windows are used to weight them so as to prevent oscillations due to sudden truncation. Different windows have been used by different researchers. In [1] Kadam Geeta and Bhaskar P. C. did a good comparison of equiripple filter and FIR ISSN: 2231-5381 filters implemented with Kaiser, Rectangular, Hanning, Hamming, Blackman and Bartlet windows in suppression of powerline noise in electrocardiographic signals. Chavan Mahesh S. et al.[2] and Mbachu C. B. et al. [3] carried out the design and implementation of FIR digital filters for processing ECG signal with rectangular window in their works. Chinchkhede K. D. et al.[4] in implementing FIR filter for enhancement of ECG compared the performances of FIR filters designed with Gaussian, Kaiser, Blackman and Blackman Harris windows. In [5] Chavan Mahesh S. et al. determined the effectiveness of removing powerlinenoise by FIR digital filters designed and implemented with rectangular, Hanning, Hamming and Kaiser windows. In [6] Islam M. K. et al. in their design of FIR filters for processing ECG weighted the filter with Kaiser Window. In [7] Mbachu C. B. et al. equally weighted the FIR filters they designed and implemented for filtration of ECG with Kaiser Window. The authors in [8] also applied Kaiser Window in designing and implementing low pass, high pass and notch digital filters for ECG processing. Renumadhavi C. H. et al. in [9] in using different types of filters to remove powerline noise in ECG included digital FIR filters designed with Hamming and Bartlett windows. In [10] Van Alste J. A. and Schilder T. S. investigated the performance of FIR digital filter designed with Kasier window in the removal of baseline wander and powerline noises in ECG. In these works or any other known work, no researcher has worked with height-adjustable sine (HAS) window. In this paper, designing a digital FIR narrow band stop filter for removing 50Hz powerline noise using HAS window is proposed. http://www.ijettjournal.org Page 4624 International Journal of Engineering Trends and Technology (IJETT) – Volume 4 Issue 10 - Oct 2013 = sin-1 (1 – ) = Sin-1 0.98 = 78.5220 2. HAS Window Function The diagram of HAS window function is shown in fig. 1 below while the mathematical model is represented as equation (1), where L is the order of the filter and α is the height determining quantity and varies from 0 to 1. W(k) 1 B 2sin1 1 2 78.522 L 100 1 . 5704 0 , where φ is the angle covered by the curve AC in fig. 1. Substituting φ = 1.547040 in (1) gives w 1 k 0 . 02 sin 1 . 5704 k , 0 k 50 w 2 k 0 . 02 sin 100 k 1 . 5704 , 50 k 100 Combining w1(k) and w2(k) yields C 0.02 sin 1.5704k ,0 k 50 w k 0.02 sin 100 k 1.5704,50 k 100 α A 0 D L 2 k L (2) If the window of (2) is used in designing and implementing a narrow band stop digital FIR filter for powerline noise removal in ECG signal, the impulse, magnitude and phase responses of the filter are shown in figure 2, 3 and 4, respectively. 1.2 1 Fig. 1: HAS Window Function 0.8 2 sin 1 1 L sin k ,0 k L 2 wk 1 sin L k 2 sin 1 L k L L 2 (1) 0.6 0.4 0.2 0 -0.2 0 10 20 30 40 50 60 70 80 90 100 0.8 0.9 1 Fig. 2: Impulse Response of the Filter 3. Design of Digital Narrow Band Stop Filter With HAS Window 5 0 A Sine window when it is used to weight symmetrical narrow band stop digital FIR filter for suppression of powerline noise in ECG may introduce oscillations due to the fact that it pulls down the impulse response of the filter to zero at both extremes of beginning and end. The HAS window may improve this effect because it pulls up the two extremes to a value of not equal to zero. Recall that varies between 0 and1. For the narrow band stop filter targeted at 50Hz powerline noise filtration in ECG, is made to be about 0.02 value. The order of filter here is L = 100 which implies that the number of samples or filter taps is M = L + 1 = 101. With this values (1) transforms to (2). 1 – = 1 – 0.02 = 0.98 ISSN: 2231-5381 -5 -10 -15 -20 -25 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 Fig. 3: Magnitude Response of the Filter http://www.ijettjournal.org Page 4625 International Journal of Engineering Trends and Technology (IJETT) – Volume 4 Issue 10 - Oct 2013 0 4 -20 3 -40 -60 2 -80 1 -100 0 -120 -1 -140 -2 -160 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 -3 0 500 1000 1500 2000 2500 3000 Fig. 4: Phase Response of the Filter Fig. 5: Normal Noise-Free ECG Signal 3. Results 4 3 A noise-free normal ECG signal of 3.5mV value generated by matlab is shown in fig 5. The generated ECG signal is corrupt with 50Hz powerline of 0.1mV and the resulting signal is recorded in fig 6. The frequency spectrum of the corrupt ECG is depicted in fig 7. From fig 7 the average power of the corrupt ECG signal at 50Hz before the application of the digital filter is about +4.2dB. The corrupt ECG is filtered with the designed digital filter and the output recorded and depicted in fig. 8. The frequency response of the filtered ECG is presented in Fig 9. Form fig. 9 the average power of the filtered ECG at 50Hz is brought down to about -19dB, which in effect means that the implemented narrow band stop FIR filter has removed the 50Hz powerline noise in the ECG signal. 1 0 -1 -2 -3 0 500 1000 1500 2000 2500 3000 Fig. 6: ECG Corrupt with 50Hz Powerline Periodogram Power Spectral Density Estimate 20 0 Power/frequency (dB/rad/sample) The corrupt ECG signal of fig. 6 is applied to an FIR adaptive notch filter as a way of comparing the performances of FIR notch filter designed with HAS window and adaptive notch filter in removing powerline interference in ECG signals. The adaptively filtered ECG signal is recorded in fig. 10 while the frequency spectrum is shown in fig. 11. From fig. 11 the average power of the ECG signal filtered with adaptive notch filter at 50Hz is further reduced to -34.2dB. Note that 50Hz here corresponds to 0.1rad in the normalized frequency scale. 2 -20 -40 -60 -80 -100 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample) 0.9 1 Fig. 7: Frequency Response of ECG Corrupt with 50Hz Powerline ISSN: 2231-5381 http://www.ijettjournal.org Page 4626 International Journal of Engineering Trends and Technology (IJETT) – Volume 4 Issue 10 - Oct 2013 Periodogram Power Spectral Density Estimate 4 20 3 Power/frequency (dB/rad/sample) 0 2 1 0 -1 -20 -40 -60 -80 -2 -3 0 500 1000 1500 2000 2500 3000 Fig. 8: Filtered ECG -100 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample) 0.9 1 Fig. 11: Frequency Spectrum of Adaptively Filtered ECG Signal Periodogram Power Spectral Density Estimate 20 4. Conclusion Power/frequency (dB/rad/sample) 0 -20 -40 -60 -80 -100 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample) 0.9 1 Fig. 9: Frequency Response of Filtered ECG The impulse response is indicating stability of the filter. The ripples in the magnitude response of the filter decay quickly which suggests filter stability. The phase response is linear and as such the filtered ECG signal will not experience any differential phase shift due to the filter. The HAS window-based filter filters off the 50Hz powerline interference in the corrupt ECG signal of fig. 6 as shown in fig.8. Comparing the performance of the HAS filter with that of adaptive filter, as can be deduced from figures 10 and 11 shows that the adaptive filter is better in ECG processing with a view to removing powerline interference. REFERENCES 4 3 2 1 0 -1 -2 -3 -4 0 500 1000 1500 2000 Fig. 10: Adaptively Filtered ECG Signal ISSN: 2231-5381 2500 3000 [1] Kadam Geeta and Bhaskar P. C., “Reduction of Powerline Interference in ECG Signal Using FIR Filter”, International Journal of Computational Engineering Research (IJCER), Vol. 2, No. 2, Pp. 314 – 319, 2012. [2] Chavan Manesh S, Agarwala R. A. and Uplane M. D., “Interference Reduction in ECG using Digital FIR Filters Based on Rectangular Window”, WSEAS Transactions on Signal Processing, Vol. 4, Issue 5, Pp. 340 – 349, 2008. [3] Mbachu C. B, Idigo Victor, Ifeagwu Emmanuel and Nsionu I. I., “Filtration of Artitacts in ECG Signal Using Rectangular-Based Digital Filters”, International Journal of Computer Science Issues (IJCSI), Vol. 8, Issue 5, Pp. 279 – 285, 2011. http://www.ijettjournal.org Page 4627 International Journal of Engineering Trends and Technology (IJETT) – Volume 4 Issue 10 - Oct 2013 [4] Chinchkhede K. D., Yadav Govind Sharan, Hirekhan S. R. and Solanke D. R., “On the Implementation of FIR Filters with various windows for Enhancement of ECG Signal”, International Journal of Engineering Science and Technology (IJEST), Vol. 3, No. 3, Pp. 2031 – 2040, 2011. [5] Chavan Mahesh S., Agarwala R. A. and Uplane M. D., “Design and Implementation of Digital FIR Equiripple Notch Filter on ECG Signal for Removal of Powerline Interference”, WSEAS Transactions on Signal Processing, Vol. 4, No. 4, Pp. 221 – 230, 2008 [6] Islam M. K., Haque A. N. M. M., Tangim G., Ahammad T. and Khondokar M. R. H., “Study and Analysis of ECG Signal using Matlab and Labview as Effecctive Tools”, International Journal of Computers and Electrical Engineering, Vol. 4, No. 3. Pp. 404 – 408, 2012. [7] Mbachu C. B., Onoh G. N., Idigo V. E., Ifeagwu E. N. and Nnebe S. U., “Processing ECG Signal with Kaiser Window-Based FIR Digital Filters”, International Journal of Engineering, Science and Technology (IJEST), Vol. 3 No. 8, Pp. 6775 – 6783, 2011. [8] Chavan Mahesh S., Agarwala R. A. and Uplane M. D., “Use of Kaiser Window for ECG Processing”, Proceedings of the 5th WSEAS International Conference on Signal Processing, Robotic and Automation, Madrid, Spain, Pp. 1 – 5, 2008. [9] Renumadhavi C. H., Kumar S. Madhava, Ananth A. G. and Srinivasan Nirupama “A new approach for evaluating SNR of ECG Signals and its implementation”, Proceedings of the 6th WSEAS International Conference on Simulation, Modeling and Optimization, Lisbon, Portugal, Pp. 202 – 205, 2006. [10] Van Alste J. A. and Schilder T. S., “Removal of Base-line Wander and Powerline Interference from the ECG by an Efficient FIR Filter with a Reduced Number of Taps”, IEEE Transactions on Biomedical Engineering, Vol. 32, No. 12, pp. 1052 – 1062, 1985. ISSN: 2231-5381 http://www.ijettjournal.org Page 4628