Electrocardiogram estimation using Lagrange interpolation

An electrocardiogram records activity of cardiac which is collected through the electrodes positioned on speciﬁc locations on the human body. These signals are required for cardiac-related issues. Electrocar- diogram signals are quasi-stable signals and are often contaminated by artefacts. The magnitude and frequency of these artefacts are differ- ent, and thus their effect on electrocardiogram is also variable. These artefacts must reduce to a signiﬁcantly optimum level to make them in- terpretable. This paper proposes an algorithm to estimate electrocardiogram signals from the MIT-BIH database signal using Lagrange inter- polation through Chebyshev nodes. The performance evaluation of the proposed method has been assessed through standard estimation tools. Performance parameters revealed that the algorithm is suitable for signal estimation irrespective of the characteristic of artefact introduced to the signal.

A continuously varying function f (x) in the same interval can be obtained at n + 1 nodes by a polynomial of degree n. Let f (x k ), 0 ≤ k ≤ N be the samples of ECG of length N in [− 1,1]. Then, these samples can be uniquely interpolated by a polynomial of order p which is n ≤ N, that is, p(x k ) ≈ f (x k ) for each k.
Considering the interpolating function as p n (x) = c 0 + c 1 x + c 2 x 2 + · · · + c n−1 x n−1 + c n x n (3) then, we require c 0 + c 1 x k + c 2 x 2 k + · · · + c n−1 x n−1 In matrix form, (4) can be rewritten as The system (4) will have a unique solution when the Vandermonde determinant of (5) on the extreme left should be non-singular [18]. The determinant of (5) is equal to the product of the terms (x i − x k ) for i > k, therefore the points x 0 , . . . , x n should be distinct for the determinant to be non-zero.
From the interpolated values f (x k ), 0 ≤ k ≤ n, we can write p n (x) of degree n using Lagrange's interpolation [19] as where l n k are (n + 1) Lagrange polynomials of degree ≤ n.
Let us now consider f (x) is n + 1 times continuously differentiable in [−1, 1], then the interpolation error is [20] f We can minimise the product (x − x k ) can be easily minimised. The interpolating points also ensure uniform convergence over the nodes of T n+1 (x) [21]. The same can be estimated by the following theorem.
Theorem. If f (x) is a polynomial passing through x 0 , x 1 , . . . , x n points, let p n (x) be a Lagrange interpolating polynomial to interpolate f (x). The interpolation points utilised to interpolate p n (x) are the n + 1 nodes of T n+1 (x), given by (2). Then, The interpolation problem for f (x) on [a, b] can be transferred to f (y) on y ∈ [−1, 1] using Accordingly, the Chebyshev nodes in the same interval can be obtained as Thus, the interpolation points in the same interval (11) would be derived as The E n (x) for the same interval can be obtained from Delving deeper into the advantages of using Chebyshev interpolating nodes, we observe that Runge phenomenon does not occur with the effect that the error tends to decrease with the increasing degree of the Lagrange Chebyshev interpolating polynomial, whereas the same may not be true for equally spaced nodes.
The nth degree interpolating polynomial p n (x) in the interval x ∈ [−1, 1] can be expressed as [22] where c k can be obtained as with θ j = (2 j+1)π 2(n+1) . Replacing f (cos θ ) by a periodic function g(θ ), Thus, c k is the discrete approximation to the Fourier series Applying the trapezoidal rule approximation which is same as (17) for c k . Thus, the Chebyshev interpolation can be effectively utilised by replacing the Fourier transform c S k by discrete fourier transform c k .

Methods and results:
Here Lagrange-Chebyshev interpolants are used to estimate ECG signals. The data used for testing the algorithm is taken from Physionet repository. The records considered in this article are 10 seconds duration consisting of multiple QRS complexes. The sampling rate is fixed to 360 Hz. However, sampling rate may be varied and its effect can also be observed for estimation algorithms. The records utilised has resolution of 11 bits per sample. All the algorithms are performed in MATLAB environment. The performance parameters utilised are signal-to-noise ratio (SNR), Correlation Coefficient, Mean Absolute Error (MAE), Root Mean Square Error (RMSE) and Percentage Root Mean Square Difference (PRD).
Let y(n) be the actual signal and x(n) be the estimated ECG signal of having length as N. Then, the difference that is, error between the signals is evaluated as The assessment tools for the proposed algorithm is then obtained as: Mean Absolute Error MAE measures mean absolute difference between the actual signal and estimated ECG signal.
Root Mean Square Error RMSE calculates root of mean of the square differences between the actual signal and estimated ECG signal. The parameter is utilised in case where there are large variations in the error.
Percentage Root-Mean-Square Difference PRD is calculated by where y is the mean of y(n). Through this parameter, the extent of baseline/DC level reduced in estimated signal can be obtained. Signal to Noise Ratio SNR calculates signal strength over noise.

Correlation Coefficients
This parameter determines the degree to which two signals are correlated in their time-domain characteristics. Value near to 1 indicates close resemblance between the actual signal and estimated ECG signal.
SNR and CC are positive-oriented parameters and algorithms producing higher values are considered to be better. Other parameters are negatively oriented and algorithms producing lower values are better. Details about the performance parameters can be obtained from [23]. The proposed estimation model constructs p n (x) using (6) with N ECG samples using the Chebyshev nodes obtained from 2. It may happen that the ECG data may not be available at all the Chebyshev nodes, in such case we can utilise the adjacent ECG samples. We continue increasing the order until our error criterion derived in (13) is met. This Lagrange-Chebyshev signal estimation can be summarised as: 1. Fix the order n of the Chebyshev polynomial and the tolerance ε level for the Lagrange-Chebyshev polynomial estimation. 2. Obtain the Chebyshev nodes x j using (2)in the interval [a, b].
3. Calculate f (x j ) using simple linear interpolation through the two adjacent samples around x j . 4. Construct p n (x) using (6) and (7). 5. Find error E n (x) in the same interval using (13). 6. If E n (x > ε, then n = n + 1 and go to step 2.
In order to estimate one cycle of ECG signal, high-order polynomials were required, which increases computation time also. The interpolation errors for this approach was very high. So, to reduce the computation time and error, the whole signal irrespective of the location of P, QRS, T and U waves, divided into sections using the Bottom-up segmentation method. This method is a recursive algorithm which segments the original signal into large number of small length segments. These small  segments then consequently combined into more significant segments until the stopping criteria is achieved [24]. In order to improve estimation results of Lagrange-Chebyshev polynomial, the segmentation of the signal has to be done before interpolation. Also, selection of optimum number of sections for interpolation is to be carefully finalised. Once the segments are interpolated within the tolerance, the final estimated signal is obtained by sequentially appending the segments.
Here, the signals for interpolation are divided into 100 segments, and then the individual segments are interpolated by 50th order Lagrange-Chebyshev interpolants. Table 1 shows the performance metrics for the proposed estimation technique over signals of MIT-BIH database. Figure 1 shows the original record and record estimated by the proposed estimation algorithm.
Although the number of segments has been kept same for all the signals, all the segments cannot be approximated by a single polynomial because they are of unequal sample lengths due to the variable shape of ECG within and across patients. Here our interest is to estimate the signal while retaining its characteristics. So, the number of segments is not so significant.
The MAE obtained is up to order of 10 −6 which is very less. Also the RMSEs for all signals are very low, that is, 10 −4 . PRD for good estimation algorithms is expected to be less than 5 and is medically accepted. However, for the proposed model, it is even less than 1. CC values are also nearly equal to 1, indicating the close resemblance with the actual signal. The performance parameters may be further improved either by increasing the order of interpolating polynomial or by segmenting the signal into more number of segments at the cost of estimation time.
In [25], various ECG signals were approximated by Chebyshev polynomials of degree 2000, and obtained PRDs varying from 2.74 to 10.64. Jokic et al [26] estimated ECG signals from the same database using polynomial function by segmenting one cycle of ECG signal into seven segments. The PRD reported for the record 119 is 5.3; however, we could estimate the same record with PRD as 0.0014. Sandryhaila et al. in [27] found Hermite functions more suitable than transformation techniques to estimated QRS complex with a CR of 11 with 25% approximation error.
Conclusion: ECG signal records voltage potentials of cardiac activity. Various types of noises often contaminate these signals. ECG signals are estimated using the Lagrange interpolation method. The Chebyshev nodes are used as interpolation points to increase convergence and accuracy. The results obtained are quite convincing and are superior to those reported in the existing literature. The results can be further improved with increment in order of the Chebyshev polynomial or number of segments. Although the method produces convincing results, order of the polynomial is high. The order can also be further reduced by segmenting the signal into suitable number of segments.