Analysis of ECG Signal Processing and Filtering Algorithms

—Electrocardiography (ECG) is a common technique for recording the electrical activity of human heart. Accurate computer analysis of ECG signal is challenging as it is exceedingly prone to high frequency noise and various other artifacts due to its low amplitude. In remote heath care systems, computer based high level understanding of ECG signals is performed using advanced machine learning algorithms. The accuracy of these algorithms relies on the Signal-to-Noise-Ratio (SNR) of the input ECG signal. In this paper, we analyse various methods for removing the high frequency noise components from the ECG signal and evaluate the performance of several adaptive ﬁltering algorithms. The result suggest that the Normalized Least Mean Square (NLMS) algorithm achieves high SNR and Sign LMS is computationally efﬁcient.


I. INTRODUCTION
The rapid advancement in the fields of electronic and communication technologies and new developments in computational algorithms such as deep learning and big data analysis have resulted in new ways of providing health care [1].The bulky medical apparatus have been replaced by smaller electronic gadgets connected with personal computers, laptops and smart phones (Fig. 1).For example, the company Bio Telemetry, Inc., [2] offers remote healthcare services to over one million patients over the internet [3].One of the key components of the computerized remote health care systems is the automatic analysis and understanding of ECG signal by advanced computer algorithms.
The accuracy of the analysis usually depends on the quality of the input ECG signal.The recorded ECG signal has low amplitude and is often contaminated with multiple types of noises such as power line interference (PLI), electro surgical noise, lead wire problems, base-line drift and high frequency noise components [4].Several signal filtering methods exists in the literature to remove specific types of noise component from the ECG signal to improve its SNR.In this paper, we perform a comparative evaluation of four basic types of filtering methods including Least Mean Square (LMS), Normalized LMS (NLMS), Log LMS, and Sign LMS for ECG signal enhancement and remove the high frequency noise from the ECG signal.The high frequency is generated due to electromyography (EMG) and instrumentation noise.We perform detailed experiments on the ECG signals provided by the MITDB [5] database and compare the performance in terms of the SNR, convergence rate and computational complexity of these algorithms.Our analysis shows that the performance of NLMS is superior than the other adaptive methods in terms of SNR and Sign LMS is computationally efficient.These results can help us in choosing the appropriate filter for ECG signal enhancement and automatic ECG analysis.
The paper is organized as follows.Section II and III discusses related work and digital filters.In Section IV, adaptive filtering algorithms are described, where as Section V presents simulation and results.Finally, conclusion are drawn along with future prospects.

II. RELATED WORK
Luo and Johnston [6] presented a comprehensive review for ECG signal processing.Qureshi et al. [7] evaluated the performance of multistage adaptive fiter for ECG signal enhancement.Liu et al. [8] proposed a method composed of genetic algorithm and empirical mode decomposition for feature selection.Shadarmand et al. [9] proposed a method for the classification of patient heartbeat types based on block based neural network and particle swarm optimization.
A typical ECG signal waveform consists of the six parameters shown in Fig. 2. In the acquisition and transmission process, ECG wave is corrupted with different types of noises including biological noises and environmental noise or instrument noise (Fig. 3).Biological artifact is due to the movement of the subject itself, i.e. random movement of patient.Environmental artifacts are caused by power line interference, instrumentation error and additive white Gaussian noise.The low amplitude features are especially affected by high frequency noise.

III. DIGITAL FILTERS
The aim of the pre-processing is to achieve a noise free signal and enhance its features accurately.Digital filters can be categorized into two major types as shown in Fig. 4, i.e. fixed type of filters where the coefficients of the filters are fixed and adaptive filter where the coefficients change adaptively.
Fixed filters are well suited for stationary environment and can be used for eliminating the powerline interference 60/50 Hz noise.When we know which frequency is to be eliminated, fixed filters are the best choice.In case of nonstationary signals such as ECG, filters designed using advanced learning algorithms are the optimum choice.After reviewing the literature carefully, we have chosen adaptive filters as a potential candidate for the processing of ECG signal because of its flexibility to adapt to the changes in the signal.As ECG is a non-linear signal, adaptive filters are well suited for its processing.
Adaptive filters have many sub types based on their objective function.LMS, Normalized LMS and Recursive Least Squares (RLS) are some common types of adaptive filters [10].On the other hand, random noise or high frequency noise requires a more intelligent and adaptive processing mechanism.Some common filter design methods include Finite Impulse Response (FIR), Infinite Impulse Response (IIR) and Median/Average filtering.
In FIR design, the output of the filter is the weighted sum of past input values which is finite [11] and can be represented by the equation: where x[n] denotes the input signal and b k are the filter coefficients and Y [n] is the output response.
IIR filter has infinite impulse response and acts like a feedback loop which never terminates when a single impulse is applied to it.It has both zeros and poles in the system [12].IIR filters may not be stable because of the infinite response.IIR filter can be mathematically expressed as: where N is the filter's order, a i and b j are the filter coefficients and the output depends on past inputs and past outputs.IIR filters can be graphically expressed as shown in Fig. 5.
Median/Average filtering is used to suppress artifacts and to preserve edge features [13].It is computed using a running average like operations on the signal with different coefficients.In the absence of low frequency noise, signal is not distorted and as such this type of filtering is computationally efficient [2].
An adaptive filter has the ability to adapt to the change in the signal over time.Therefore, adaptive filtering is very well suited for non-linear problem [14] such as ECG noise removal.An adaptive filter has two input signals (Fig. 6): one is the base input signal and other one is the reference signal.The filter compares them and calculates the error.The error is then minimized iteratively based on some objective function [15].We have chosen adaptive filters for the pre-processing of ECG signal because of its intelligent performance under unknown conditions.Some popular algorithms for adaptive filters are  LMS, NLMS and RLS.Once the signal is filtered and artifacts are removed machine learning algorithms can be used to perform high level tasks such as identification of healthy and non healthy ECG signals or improved visualization of the ECG features (Fig. 7).

IV. ADAPTIVE FILTERING ALGORITHMS
We have implemented and tested four popular adaptive algorithms [16].These include the Least Mean Square (LMS), Normalized LMS (NLMS), Log LMS and Sign LMS.

A. Least Mean Square (LMS)
LMS minimizes the square of the error and is the most simple and popular adaptive algorithm.LMS algorithm is easy and computationally efficient [17].The weights are updated using the following operation.
Where µ is the step size.The step size determines the step of the error to be adjusted [8].The error signal is expressed as e(n) = d(n) − y(n).The convergence of LMS is slow and the other issue is the selection of step size.

B. Normalized Least Mean Square (NLMS)
NLMS algorithm is designed to address the issue of step size selection.In NLMS method, the step size is designed to be adaptive.If the error signal is large then the step size is computed to be large and if the error is small, the step size remains smaller.Initially the step size is chosen to be 0.01 and normalized using the equation ( 4).NLMS uses variable step size µ(n) [8].
The only difference between NLMS and LMS is the step size.The convergence speed increases in NLMS at a cost of increased computational complexity.

C. Log LMS
Log LMS algorithm is designed for applications where high speed adaptive filters are required such as echo cancellation or ECG de-noising.It is highly desirable to reduce the complexity of the hardware [18].Log LMS is mathematically expressed as: where Q(•) denotes the quantization function, which is defined as Q(•) = 2 log(n) * e(n).This filter converts the input signal to a power of two which reduces its complexity.

D. Sign LMS
Instead of quantizing the error, Sign LMS algorithm quantizes the input signal by a simple sign function for faster adaptation.Thus, the Sign LMS filter can be expressed mathematically as: www.ijacsa.thesai.org In this filter function, the multiplication operation is replaced with shifting operation which makes the algorithm computationally efficient.
In addition to the above algorithms, kernel algorithms based on the reproducing kernel hilbert spaces (RKHS) are popular for non-linear problems.As ECG is a non-linear signal, kernal algorithms are also well suited.LMS algorithms coupled with the Gaussian kernel or polynomial kernel is also applied for ECG signal pre-processing.

E. Feature Extraction
After de-noising, the features can be extracted using discrete wavelet transform [19], principal component analysis [20] (PCA) or independent component analysis [21] (ICA) or any other pattern recognition technique.Some of the common features include R-peak, R-R interval and QRS amplitude.These feature can be fed into any classifier, such as support vector machine [22] or neural networks [23] to classify the ECG signal.In this work, our focus is on the preprocessing of ECG signal based on the fact that if a signal is noise free, it can be more accurately classified.

V. RESULTS AND DISCUSSION
We performed experiments on the ECG signals downloaded from MITDB [5] database.The database is widely used for research on ECG signal processing and analysis for the study of cardiac diseases.Various types of high frequency noises are generated using MATLAB based on the prior knowledge (Fig. 9).Similarly, a reference signal is also generated using MAT-LAB (Fig. 8).SNR, convergence rate and computation time is used as a performance metric.SNR is calculated using the equation (9).

SN R =
P signal P noise (9) Where P signal and P noise represents the average signal power and average noise power respectively.The SNR is converted into decibel using following formula: The Mean square error (MSE) is used to measure the quality of the estimate of adaptive algorithms.MSE measures the average of the square of the errors.
Table I shows the SNR and time complexity of the four algorithms.These results are the average of five ECG signal.Note that the value of SNR is in decibel and time is in seconds.The time complexity of adaptive algorithms are calculated using MATLAB 2017a.All simulations are performed at Intel (R) Core i5-CPU 4590 @ 3.3GHZ with 8 GB RAM.These results combined with the simulation results of Table I show that the Sign LMS has lower computational complexity and the NLMS has higher SNR.
It can be concluded that different adaptive algorithm have their pros and cons, but based on observations we recommend NLMS for removing the high frequency, because of the highest SNR it has achieved in our experiments.

VI. CONCLUSION
Remote health-care systems are becoming increasingly popular that provide time efficient treatment and advanced medical services to remote areas using Internet.ECG signal processing is a key module of these systems.We have evaluated four pre-processing algorithms for ECG noise removal.These techniques can be efficiently utilized to provide a deeper insight of ECG signal processing and can be useful for ECG based remote health systems.Our experiments show that the NLMS algorithm can achieve better SNR compared to other algorithm at a cost of greater computational complexity.
These adaptive algorithms can also be used on other physiological signal such as EEG or EMG.Once the signal is de-noised, we can extract the features and train a classifier for automated ECG analysis.Recently now, deep learning has performed remarkably well on many applications.In the future it will be interesting to see how deep learning methods can be applied to achieve more significant information from the ECG signal and a complete automated ECG analysis system can be realized.

Fig. 1 .
Fig. 1.An illustration of a simple remote health care system.

Fig. 4 .
Fig. 4. Two categories of filters used for ECG signal pre-processing.

Fig. 7 .
Fig. 7. Typical high level tasks performed by a remote health care system.

Fig. 10 ,
Fig. 10, 11, 12 and 13 show the de-noising results of the LMS, NLMS, Log LMS and Sign LMS algorithms, respectively, on a representative ECG signal.These algorithms have eliminated the high frequency noise successfully.Fig. 14, 15 and 16 show the MSE of the LMS, NLMS and Log-LMS algorithm respectively.It can be seen from these figures that NLMS converges more faster than LMS.