Adaptive Interference Cancellation of ECG Signals

As an important biological signal, electrocardiogram (ECG) signals provide a valuable basis for the clinical diagnosis and treatment of several diseases. However, its reference significance is based on the effective acquisition and correct recognition of ECG signals. In fact, this mV-level weak signal can be easily affected by various interferences caused by the power of magnetic field, patient respiratory motion or contraction, and so on from the sampling terminal to the receiving and display end. The overlapping interference affects the quality of ECG waveform, leading to the false detection and recognition of wave groups, and thus causing misdiagnosis or faulty treatment. Therefore, the elimination of the interference of the ECG signal and the subsequent wave group identification technology has been a hot research topic, and their study has important significance. Based on the above, this paper introduces two improved adaptive algorithms based on the classical least mean square (LMS) algorithm by introducing symbolic functions and block-processing concepts.


Introduction
As the most important organ in the human body, the heart is the power source of metabolism of various organs and tissues. The basic units of the heart are the cardiomyocytes, and the human electrocardiogram (ECG) signal is actually their electrical activity response [1]. When there is a certain way to stimulate a certain intensity through the myocardial cells, it will result in intracellular and extracellular ion flows, resulting in an action potential. ECG signals completely record this change process [2], and ECG waveform reflects the physiological conditions of various parts of the heart in medical diagnosis, and is a very valuable reference for treatment [3].
The amplitude of the ECG signal is in the range of 10 µV to 4 mV and it is very small and weak and therefore very sensitive to the effects of various disturbances [4]. One of the main sources of interference are loop factors and 50 Hz frequency interference caused by the electromagnetic field and the patient, baseline wander (BW) caused by the patient's limb movement and breathing, and electromyogram (EMG) interference caused by skeletal muscle stimulation and contraction [5].
Power frequency interference [6], the most common ECG signal interference, is caused by the magnetic field distributed by the human body by the power supply, resulting in added 50 Hz sinusoidal and harmonic components in the pure ECG signals [7]. Figure 1 shows the time-domain and frequency-domain diagrams of the ECG signals with power-line interference (PLI). BW is another interference affected by the patient's ECG monitored breathing, electrode movement, and other frequently occurring factors [8]; its shape is similar to a periodic sinusoidal signal, generally below the 1 Hz low-frequency signal, resulting in a baseline signal instability drift, making the ECG waveform show a slow change [9]. The time and frequency domains of the ECG waveforms affected by BW are shown in Figure 2. When the ECG signal is collected using different measurement modes, the signal strength is different. In the actual acquisition in front of the armpit the ECG signal is the most obvious, as the ECG signal is obtained with no interference, as shown in Figure 3. BW is another interference affected by the patient's ECG monitored breathing, electrode movement, and other frequently occurring factors [8]; its shape is similar to a periodic sinusoidal signal, generally below the 1 Hz low-frequency signal, resulting in a baseline signal instability drift, making the ECG waveform show a slow change [9]. The time and frequency domains of the ECG waveforms affected by BW are shown in Figure 2. BW is another interference affected by the patient's ECG monitored breathing, electrode movement, and other frequently occurring factors [8]; its shape is similar to a periodic sinusoidal signal, generally below the 1 Hz low-frequency signal, resulting in a baseline signal instability drift, making the ECG waveform show a slow change [9]. The time and frequency domains of the ECG waveforms affected by BW are shown in Figure 2. When the ECG signal is collected using different measurement modes, the signal strength is different. In the actual acquisition in front of the armpit the ECG signal is the most obvious, as the ECG signal is obtained with no interference, as shown in Figure 3. When the ECG signal is collected using different measurement modes, the signal strength is different. In the actual acquisition in front of the armpit the ECG signal is the most obvious, as the ECG signal is obtained with no interference, as shown in Figure 3. Based on the classical least mean square (LMS) algorithm [10], two improved adaptive algorithms are proposed, namely, the normalized LMS (NLMS) algorithm [11] based on symbol function and the normalized block-processing LMS (BLMS) algorithm based on symbol function [12]. The symbolic functions [13] and the block-processing [14] concept are introduced and applied to the the elimination of two kinds of interference: ECG signal frequency interference and BW interference. The MIT-BIH ECG database and the real ECG data collected by a miniature ECG collector in the laboratory were used to validate the algorithm and analyze the results in detail.

Adaptive Noise Cancellation Based on LMS Algorithm
The basic principle of the adaptive noise canceller is to use the noise source to output, then to digitally filter [15], to estimate the noise most accurately, and then to subtract the estimated noise from the original input, thus achieving the separation of the pure useful signal from the noise. Figure 4 shows a block diagram of an adaptive noise canceller based on Wiener filtering [16], wherein the main input signal is X(n), which consists of the useful signal s(n) and the background interference signal v0(n), and these two are not related. The reference input signal v1(n) must be the input signal associated with the interfering signal v0(n). Because the reference signal v1(n) is correlated with the interference portion v0(n) in the main input, the filter will remove this correlation at its output. This is achieved by generating an estimate of the interference in the main input signal from the noise of the reference channel and subtracting the estimated interference value from the main input to obtain the final output of the system as an estimate of the wanted signal. In summary, the specific steps for implementing adaptive noise cancellation based on LMS can be summarized as follows: Based on the classical least mean square (LMS) algorithm [10], two improved adaptive algorithms are proposed, namely, the normalized LMS (NLMS) algorithm [11] based on symbol function and the normalized block-processing LMS (BLMS) algorithm based on symbol function [12]. The symbolic functions [13] and the block-processing [14] concept are introduced and applied to the the elimination of two kinds of interference: ECG signal frequency interference and BW interference. The MIT-BIH ECG database and the real ECG data collected by a miniature ECG collector in the laboratory were used to validate the algorithm and analyze the results in detail.

Adaptive Noise Cancellation Based on LMS Algorithm
The basic principle of the adaptive noise canceller is to use the noise source to output, then to digitally filter [15], to estimate the noise most accurately, and then to subtract the estimated noise from the original input, thus achieving the separation of the pure useful signal from the noise. Figure 4 shows a block diagram of an adaptive noise canceller based on Wiener filtering [16], wherein the main input signal is X(n), which consists of the useful signal s(n) and the background interference signal v 0 (n), and these two are not related. The reference input signal v 1 (n) must be the input signal associated with the interfering signal v 0 (n). Based on the classical least mean square (LMS) algorithm [10], two improved adaptive algorithms are proposed, namely, the normalized LMS (NLMS) algorithm [11] based on symbol function and the normalized block-processing LMS (BLMS) algorithm based on symbol function [12]. The symbolic functions [13] and the block-processing [14] concept are introduced and applied to the the elimination of two kinds of interference: ECG signal frequency interference and BW interference. The MIT-BIH ECG database and the real ECG data collected by a miniature ECG collector in the laboratory were used to validate the algorithm and analyze the results in detail.

Adaptive Noise Cancellation Based on LMS Algorithm
The basic principle of the adaptive noise canceller is to use the noise source to output, then to digitally filter [15], to estimate the noise most accurately, and then to subtract the estimated noise from the original input, thus achieving the separation of the pure useful signal from the noise. Figure 4 shows a block diagram of an adaptive noise canceller based on Wiener filtering [16], wherein the main input signal is X(n), which consists of the useful signal s(n) and the background interference signal v0(n), and these two are not related. The reference input signal v1(n) must be the input signal associated with the interfering signal v0(n). Because the reference signal v1(n) is correlated with the interference portion v0(n) in the main input, the filter will remove this correlation at its output. This is achieved by generating an estimate of the interference in the main input signal from the noise of the reference channel and subtracting the estimated interference value from the main input to obtain the final output of the system as an estimate of the wanted signal. In summary, the specific steps for implementing adaptive noise cancellation based on LMS can be summarized as follows: Because the reference signal v 1 (n) is correlated with the interference portion v 0 (n) in the main input, the filter will remove this correlation at its output. This is achieved by generating an estimate of the interference in the main input signal from the noise of the reference channel and subtracting the estimated interference value from the main input to obtain the final output of the system as an estimate of the wanted signal. In summary, the specific steps for implementing adaptive noise cancellation based on LMS can be summarized as follows:

1.
The initial value is set to start the default weight coefficient vector.

2.
Calculate the output signal of the adaptive FIR filter, wherein the order is L − 1: 3.
Estimate the error of the current time n: 4.
Use the steepest descent LMS algorithm to adjust the weight vector of the filter continuously:

5.
Verify whether the standard deviation of the standard error has been satisfied. If it is, immediately stop iteration; otherwise, continue to the following operation.

NLMS Algorithm Based on Symbol Function
The NLMS algorithm is a kind of adaptive algorithm that is extended and improved based on LMS algorithm. The improvement of the algorithm is to use the variable step method, thus reducing the time required for full convergence, which corresponds to the weight coefficient update formula: Therefore, the variable step size can be expressed as: Here, the step size is a fixed factor that controls the speed of convergence of the algorithm. The parameter p prevents the denominator from being too small. When the step size parameter is too large, the p value is generally a small positive number [17].
One of the major drawbacks of the adaptive algorithm extended by the basic LMS algorithm is that the excess mean square error is too large to cause distortion of the filtered signal. Thus, Muhammad proposed an error NLMS (ENLMS) algorithm with a variable step size proportional to the square of the error signal in the adaptive algorithm for removing the ECG signal power frequency interference. The corresponding iterative adjustment formula of the algorithm is as follows: Therefore, in the LMS algorithm, the variable step size is expressed as: The parameters µ and p have the same meanings as above. Compared to the NLMS algorithm, ENLMS in the step-length selection is no longer dependent on the input signal; thus, for the convergence rate and steady-state error, ENLMS should perform better.
However, according to the formula of the variable step size, the ENLMS algorithm needs additional computation to obtain the variable step size compared to the traditional LMS algorithm. Therefore, to further reduce the amount of computation without affecting the quality of the filtered signal, a sign function is introduced in the weight coefficient updating Equation (9).
The symbolic function sgn(x) is defined as follows: An NLMS algorithm based on the symbolic function is obtained. Therefore, the final weight coefficient iterative adjustment formula is as follows:

Normalized BLMS Algorithm Based on Symbol Function
From the NLMS algorithm based on symbol function proposed in the previous section, the concept of block processing can be introduced to further reduce the computational complexity of the algorithm.
The basic idea of the widely used BLMS algorithm [11] is that, unlike the basic LMS algorithm, the filter coefficients are recalculated and updated for each sample value. The block-processing algorithm is implemented in each block region, that is, every k points to a weight coefficient update [18]. Therefore, the filter weight vector iterative adjustment formula of the block-processing algorithm is as follows: Then, the time-averaged gradient vector is: The filter coefficient vector based on the BLMS algorithm is adjusted once per k sampling points, and the coefficient update is based on the average gradient vector of the k sampling points. It can be deduced that the BLMS algorithm also converges to the Wiener solution, but this does not mean that it will achieve the final result sooner than the LMS.
The block processing is introduced into the NLMS algorithm based on symbol function proposed in the previous section, that is, the input signal is processed in blocks (10), and then the absolute value of the error signal in each block region of length L is selected. The value is used to obtain the variable step size. Thus, the weight coefficient updating formula becomes: Then, we obtain the weight coefficient update formula of the normalized BLMS algorithm based on symbol function, which is further simplified, where e L i = max |e k |, k ∈ Z i , Z i = {iL, iL + 1, . . . , iL + L − 1}, i ∈ Z, and if e L i = 0, Equation (12) becomes: 3. Implementation

Adaptive Interference Cancellation to Remove Power Frequency Interference
In the following, we use the MIT-BIH public library's record file and the data collected by the minicollector to compare and validate the ECG signal's interference elimination performance.
First of all, for the pure ECG signal from the MIT-BIH public library, artificially joining the same sampling rate of 50 Hz power frequency interference will add interference after the signal as the main filter input, the reference input, and select interference with the same frequency cosine [14]. Figure 5 shows the pure ECG signal and the waveform after superimposed PLI. Figure 6 shows the spectrum of ECG with PLI. It is clear that there is a strong 50 Hz noise.   Figure 7 shows the output of adaptive interference cancellation. Figure 8 shows the convergence of the statistical mean square error of the three adaptive interference cancellation algorithms.     Figure 7 shows the output of adaptive interference cancellation. Figure 8 shows the convergence of the statistical mean square error of the three adaptive interference cancellation algorithms.   Figure 7 shows the output of adaptive interference cancellation. Figure 8 shows the convergence of the statistical mean square error of the three adaptive interference cancellation algorithms.   Figure 7 shows the output of adaptive interference cancellation. Figure 8 shows the convergence of the statistical mean square error of the three adaptive interference cancellation algorithms.   Based on the algorithms of ECG data acquisition in the MIT-BIH public library, the ECG data of a classmate were processed using a mini-ECG collector. Figure 9 shows the original ECG waveforms and the waveforms after adding PLI. Figure 10 is its spectrum.   Based on the algorithms of ECG data acquisition in the MIT-BIH public library, the ECG data of a classmate were processed using a mini-ECG collector. Figure 9 shows the original ECG waveforms and the waveforms after adding PLI. Figure 10 is its spectrum. Based on the algorithms of ECG data acquisition in the MIT-BIH public library, the ECG data of a classmate were processed using a mini-ECG collector. Figure 9 shows the original ECG waveforms and the waveforms after adding PLI. Figure 10 is its spectrum.   Based on the algorithms of ECG data acquisition in the MIT-BIH public library, the ECG data of a classmate were processed using a mini-ECG collector. Figure 9 shows the original ECG waveforms and the waveforms after adding PLI. Figure 10 is its spectrum.    Figure 11 shows the output of adaptive interference cancellation. Figure 12 shows the average mean square error convergence curve for 100 simulation simulations of the three adaptive interference cancellation algorithms.  Figure 11 shows the output of adaptive interference cancellation. Figure 12 shows the average mean square error convergence curve for 100 simulation simulations of the three adaptive interference cancellation algorithms. Figure 11. Output of the three adaptive interference cancellation algorithms.

Adaptive Interference Cancellation Removes BW
First of all, for the pure ECG waveform sampled from the MIT-BIH common library, the baseline drift interference in the common library with the same sampling rate is superimposed on the pure ECG waveform, and then the mixed signal is used as the main input and the reference input is used as the artificial input of the baseline drift interference. Thus, the correlation between the reference input and the interfering signal in the main input is 1, and interference cancellation is most effective. Figure 13 shows the pure ECG waveform and the waveform after adding the baseline drift. Figure 14 is the spectrum of the waveform after adding the baseline drift. It can be seen that the baseline drift interference mostly concentrates on the low-frequency band near the zero frequency.  Figure 11 shows the output of adaptive interference cancellation. Figure 12 shows the average mean square error convergence curve for 100 simulation simulations of the three adaptive interference cancellation algorithms. Figure 11. Output of the three adaptive interference cancellation algorithms.

Adaptive Interference Cancellation Removes BW
First of all, for the pure ECG waveform sampled from the MIT-BIH common library, the baseline drift interference in the common library with the same sampling rate is superimposed on the pure ECG waveform, and then the mixed signal is used as the main input and the reference input is used as the artificial input of the baseline drift interference. Thus, the correlation between the reference input and the interfering signal in the main input is 1, and interference cancellation is most effective. Figure 13 shows the pure ECG waveform and the waveform after adding the baseline drift. Figure 14 is the spectrum of the waveform after adding the baseline drift. It can be seen that the baseline drift interference mostly concentrates on the low-frequency band near the zero frequency.

Adaptive Interference Cancellation Removes BW
First of all, for the pure ECG waveform sampled from the MIT-BIH common library, the baseline drift interference in the common library with the same sampling rate is superimposed on the pure ECG waveform, and then the mixed signal is used as the main input and the reference input is used as the artificial input of the baseline drift interference. Thus, the correlation between the reference input and the interfering signal in the main input is 1, and interference cancellation is most effective. Figure 13 shows the pure ECG waveform and the waveform after adding the baseline drift. Figure 14 is the spectrum of the waveform after adding the baseline drift. It can be seen that the baseline drift interference mostly concentrates on the low-frequency band near the zero frequency.   Figure 15 shows the output of adaptive interference cancellation. Figure 16 shows the convergence curve of the statistical mean square error of the three adaptive interference cancellation algorithms.   Figure 15 shows the output of adaptive interference cancellation. Figure 16 shows the convergence curve of the statistical mean square error of the three adaptive interference cancellation algorithms.  Figure 15 shows the output of adaptive interference cancellation. Figure 16 shows the convergence curve of the statistical mean square error of the three adaptive interference cancellation algorithms.  After verifying the waveforms of the central bank of the public library, the ECG waveforms of a certain classmate are collected for processing using a minicollector. Figure 17 shows the actual measurement of the signal obtained. Figure18 shows the spectrum.   After verifying the waveforms of the central bank of the public library, the ECG waveforms of a certain classmate are collected for processing using a minicollector. Figure 17 shows the actual measurement of the signal obtained. Figure18 shows the spectrum. After verifying the waveforms of the central bank of the public library, the ECG waveforms of a certain classmate are collected for processing using a minicollector. Figure 17 shows the actual measurement of the signal obtained. Figure 18 shows the spectrum.   Figure 19 shows the output of adaptive interference cancellation. Figure 20 shows the convergence curve of the statistical mean square error of the three adaptive interference cancellation algorithms.   Figure 19 shows the output of adaptive interference cancellation. Figure 20 shows the convergence curve of the statistical mean square error of the three adaptive interference cancellation algorithms.  Figure 19 shows the output of adaptive interference cancellation. Figure 20 shows the convergence curve of the statistical mean square error of the three adaptive interference cancellation algorithms.

Conclusions and Analysis
The basic LMS algorithm, the NLMS algorithm based on symbol function, and the normalized BLMS algorithm based on symbol function are shown in Table 1 for comparison of the computational complexity per L sample points.

Conclusions and Analysis
The basic LMS algorithm, the NLMS algorithm based on symbol function, and the normalized BLMS algorithm based on symbol function are shown in Table 1 for comparison of the computational complexity per L sample points.

Conclusions and Analysis
The basic LMS algorithm, the NLMS algorithm based on symbol function, and the normalized BLMS algorithm based on symbol function are shown in Table 1 for comparison of the computational complexity per L sample points.

Algorithm Name Times of Multiply-Add Operation Times of Division
Basic LM Salgorithm L + 1 0 NLMS algorithm based on symbol function 1 1 Normalized BLMS algorithm based on symbol function 1 1 As shown in Tables 2 and 3, these three algorithms can effectively filter out the PLI and obtain the pure ECG waveform at the output. The improved NLMS algorithm and its block-processing algorithm based on symbol function are compared to the LMS algorithm get a higher signal-to-noise ratio (SNR) value.  Table 4 shows the variation of SNR before and after the interference cancellation. It can be seen that the interference cancellation of the three algorithms improves the SNR by 12.5809, 15.8217, and 15.8337 dB, respectively, when the initial SNR is −3.2003 dB.  Table 5 shows the change of SNR before and after the interference cancellation. It can be seen that, under the strong baseline drift interference with the initial SNR of −2.7754 dB, the three adaptive interference cancellation algorithms increase the signal SNR by 13.9228, 16.6120, and 16.6158 dB, respectively.
In summary, the improved symbol-based NLMS algorithm and its block-processing algorithm both improve the SNR both for the central database of the public library and for the analysis of signals from the mini-ECG. Its convergence is reached earlier and eliminating the signal noise interference is better with frequency variation. The improved symbol-based NLMS algorithm has achieved a higher enhancement.