Skip to main content

ECG signal decomposition using Fourier analysis

Abstract

This paper explores the Fourier decomposition method to approximate the decomposition of electrocardiogram (ECG) signals into their component waveforms, such as the QRS-complex and T-wave. We compute expansion coefficients using the \(\ell _1\) Fourier transform and the traditional \(\ell _2\) Fourier transform. Numerical examples are presented, and the analysis focuses on ECG signals as a real-world application, comparing the performance of the \(\ell _1\) and \(\ell _2\) Fourier transforms. Our results demonstrate that the \(\ell _1\) Fourier transform significantly enhances the separation of ECG signal components, such as the QRS-complex and T-wave. This improvement is attributed to a notable reduction in the Gibbs phenomenon introduced by the Fourier-series expansion when using the \(\ell _1\) Fourier transform, as opposed to the traditional \(\ell _2\) Fourier transform.

1 Introduction

The Fourier-series expansion represents a signal as a linear combination of sinusoidal basis functions [1,2,3]. In order to know what frequencies are present in the signal, we need to compute the expansion coefficients. The process of computing the expansion coefficients is known as Fourier analysis (transform). The celebrated Fourier transform computes the expansion coefficients by correlating the signal with the corresponding Fourier basis functions. As shown in [4], it is defined based on the \(\ell _2\)-norm minimization of the model error, i.e., the error between the time-series data and the Fourier-series expansion, and the so-called \(\ell _2\) Fourier transform. The traditional \(\ell _2\) Fourier transform has been widely used in many signal and image processing applications [5, 6]. However, its performance is significantly decreased for the application of decomposing a signal into slow and fast components, especially when the fast components contain outliers. In this context, the idea is to filter the signal with a low-pass filter to obtain an estimate of the slow components. The problem is that in the \(\ell _2\) Fourier transform, each component of the error (i.e., fast components) is squared. When a set of error values are squared and then summed together, the sum is most sensitive to the largest error values. It means that the fast components or outliers have more weighting so it can skew results. As a result, some parts of the outliers are mixed with the slow components, which is due to the fact that the \(\ell _2\)-norm minimization corresponds to Gaussian distribution while the outliers have non-Gaussian distribution. Therefore, the \(\ell _2\) Fourier transform performance decreases in applications where the Gaussian distribution assumptions of the model errors do not hold in practice. In particular, when dealing with perceptually important signals, such as electrocardiogram (ECG), audio, image, speech, medical, and ocean engineering, we observe non-Gaussian (impulsive and Laplace) noises [7].

The \(\ell _2\) Fourier transform is not the only way to calculate the Fourier coefficients. An alternative approach to compute the Fourier transform has been recently reported in [4] which is based on the calculation of the Fourier coefficients using other norm spaces (i.e., \(\ell _p\)-norm minimization of the model error, \(p = 1,\ 2,\ 3,\ \cdots ,\ \infty\)). It is worth noting that the celebrated \(\ell _2\)-norm minimization which is used in the past for computing the Fourier transform is simple, parameter free, and inexpensive to compute. It satisfies many important properties, such as convexity, symmetry, and differentiability [8]. This might be the reason why other \(\ell _p\)-norm optimization methods were overlooked for such a long time. Among other \(\ell _p\) Fourier transforms, the \(\ell _1\) Fourier transform is an efficient tool for computing the Fourier coefficients which improves the Fourier-series expansion of time-series data such as reducing the effect of Gibbs phenomena in the truncated Fourier expansion of a signal with a jump discontinuity [4]. This method is based on the \(\ell _1\)-norm minimization of the error between the signal and its Fourier-series expansion and so called \(\ell _1\) Fourier transform. Compared to the traditional \(\ell _2\) Fourier transform, the benefits of the \(\ell _1\) Fourier transform include that it reduces the Gibbs effect in truncated Fourier-series expansion and filters the impulsive noises (outliers) in signals and images [4]. In \(\ell _1\)-norm minimization, the absolute value of the error is considered which corresponds to impulsive/Laplace distribution. Therefore, \(\ell _1\) Fourier transform decreases the weights of the outliers in reconstructed signal. That is why the \(\ell _1\) Fourier transform improves the Fourier-series expansion in filtering the impulsive noise from the data. Although other norm spaces can also be considered for computing the Fourier transform, they mostly produce performances in between \(\ell _1\)- and \(\ell _{\infty }\)-norm minimization [4].

According to the above discussion, the question naturally arises as to whether the beneficial filtering properties of the \(\ell _1\) Fourier-series expansion would improve decomposition of ECG signals into their depolarization and repolarization component waveforms. Roughly speaking, it is well known that the Fourier-series expansion (or frequency domain filtering) is unable to decompose signals with overlapping spectra. Therefore, it fails to separate the signal components that overlap in frequency domain. The ECG is an example of such signals. ECG is a rich source of information for cardiac diagnoses which makes it an important tool for assessing the cardiac health status. Every ECG beat is composed of different waves, classically labeled as P, Q, R, S and T, which reflect, at the body surface, the electrophysiological activity of the heart. Each ECG component reflects depolarization or repolarization of the heart: P-wave corresponds to depolarization of the atria, while QRS-complex and T-wave correspond to ventricular depolarization and repolarization. Separating ventricular depolarization and repolarization using Fourier-series expansion is a challenging task. It is well known that these ECG components (QRS-complex and T-wave) overlap in frequency domain. It is usually stated in the literature [9] that the content of T-wave lays mostly within a range of \([0,\ 10]\) Hz. The content of QRS-complex lays within a range of \([8,\ 50]\) Hz frequencies. Note that estimation of the frequency content of these ECG components typically employs the \(\ell _2\) Fourier transform. That is why the spectra of the ECG components (QRS-complex and T-wave) overlap with each other and as such cannot be recovered by Fourier decomposition or frequency domain filtering.

In this paper, we show that this frequency overlap is due to the traditional method (i.e., \(\ell _2\) Fourier transform) typically used for computing Fourier-series coefficients. Considering the fact that the changes in T-wave are slower than the changes in QRS-complex, the overlap between the spectra of these two components decreases if we use the \(\ell _1\) Fourier transform to compute the Fourier coefficients. Especially, the QRS-complex is an impulsive component (but not a Gaussian component) when a truncated Fourier-series expansion is used to low-pass filtering the signal to obtain an estimate of the slow component (i.e., T-wave). That is why the traditional \(\ell _2\) Fourier transform is not able to separate T-wave and QRS-complex. We show that the truncated Fourier-series expansion of an ECG signal, when the \(\ell _1\) Fourier transform is used to compute the expansion coefficients, produces a more accurate estimate of the T-wave and rejects the QRS-complex.

2 Fourier-series expansion-based signal representation

Fourier-series expansion decomposes a signal into oscillatory components. In this method, a given signal x[n], \(n = \{0,\ 1, \cdots ,\ N-1\}\) is represented as a linear combination of exponential basis functions:

$$\begin{aligned} x_M[n] = \sum _{k=0}^{M-1} c_k \phi _k[n] , \end{aligned}$$
(1)

where \(M \le N\), \(\phi _k[n] = \exp (i\frac{2\pi k}{N}n)\) and \(i = \sqrt{-1}\). In vector notation, (1) can be expressed as

$$\begin{aligned} \varvec{x}_M = \varvec{\Phi } \varvec{c} , \end{aligned}$$
(2)

where \(\varvec{\Phi }\) is an \(N \times M\) matrix, \(\varvec{x}_M = (x_M[0],\cdots ,\ x_M[N])^T\) is a length-N vector, and \(\varvec{c} = (c_0,\cdots ,\ c_{M-1})^T\) is a length-M vector. The Fourier transform is the process of computing the expansion coefficients \(\varvec{c}\). It can be calculated by different \(\ell _p\)-norm minimization of the model error, i.e., \(\varvec{e} = \varvec{x} - \varvec{x}_M\) [4]:

$$\begin{aligned} \ell _p\text { Fourier}\,\, \text{transform:} \qquad \underset{\varvec{c}}{\text {argmin}} \Vert \varvec{x} - \varvec{x}_M\Vert _p \end{aligned}$$
(3)

Among other norm spaces, we consider the Fourier transforms that compute the expansion coefficients by solving one of the following optimization problems:

$$\begin{aligned}&\ell _2\text { Fourier}\,\, \text {transform:}\qquad \underset{\varvec{c}}{\text {argmin}} \Vert \varvec{x} - \varvec{\Phi } \varvec{c}\Vert _2 \end{aligned}$$
(4a)
$$\begin{aligned}&\ell _1\text { Fourier}\,\, \text{transform:}\qquad \underset{\varvec{c}}{\text {argmin}} \Vert \varvec{x} - \varvec{\Phi } \varvec{c}\Vert _1 \end{aligned}$$
(4b)

In \(\ell _2\) Fourier transform, the expansion coefficients are analytically computed as

$$\begin{aligned} \varvec{c} = (\varvec{\Phi }^H \varvec{\Phi })^{-1} \varvec{\Phi }^H \varvec{x} , \end{aligned}$$
(5)

where \(\varvec{\Phi }^H\) is the complex conjugate transpose (Hermitian transpose) of \(\varvec{\Phi }\). Since the Fourier basis functions are orthogonal, the matrix \(\varvec{\Phi }^H \varvec{\Phi }\) becomes an identity matrix and (5) is simplified to \(\varvec{c} = \varvec{\Phi }^H \varvec{x}\). Unlike \(\ell _2\) Fourier transform, the solution to \(\ell _1\) Fourier transform cannot be written in explicit form. The solution can be found only by running an iterative numerical algorithm. In [4], a solution was obtained using majorization minimization (MM) approach which is summarized as follows. Using a majorizer for the absolute value and considering an initial value for \(\varvec{c}^{(0)}\), (4b) is converted to

$$\begin{aligned} \varvec{c}^{(r+1)} = \underset{\varvec{c}^{(r)}}{\text {argmin}} \left( \varvec{x} - \varvec{x}_M^{(r)}\right) ^T \varvec{\Lambda }_r^{-1} \left( \varvec{x} - \varvec{x}_M^{(r)}\right) + \frac{\gamma _r}{2} , \end{aligned}$$
(6)

where \(\gamma _r = \Vert \varvec{x} - \varvec{x}_M^{(r)}\Vert _1\), \(\varvec{x}_M^{(r)} = \varvec{\Phi } \varvec{c}^{(r)}\), \(\varvec{e}_r = \varvec{x} - \varvec{x}_M^{(r)}\) and

$$\begin{aligned} \varvec{\Lambda }_r = \begin{pmatrix} |\varvec{e}_r[0]| &{}\quad 0 &{}\quad \ldots &{} 0\\ 0 &{}\quad \ddots &{}\quad \ddots &{}\quad \vdots \\ \vdots &{}\quad \ddots &{}\quad \ddots &{}\quad 0\\ 0&{}\quad \ldots &{}\quad 0&{}\quad |\varvec{e}_r[N]| \end{pmatrix} , \end{aligned}$$
(7)

Taking the derivative of (6) with respect to the coefficients \(\varvec{c}^{(r)}\), we obtain:

$$\begin{aligned} \varvec{c}^{(r+1)} = \left( \varvec{\Phi }^H \varvec{\Lambda }^{-1}_r \varvec{\Phi }\right) ^{-1} \varvec{\Phi }^H \varvec{\Lambda }^{-1}_r \varvec{x} \end{aligned}$$
(8)

When \(M < N\), the Fourier-series (1) is known as a truncated Fourier-series expansion. The truncated Fourier-series expansion acts as a low-pass filter as it neglects high-frequency components by setting their coefficients to zero. In the following section, the Fourier-series decomposition methods are used for approximate decomposition of a signal to slow and fast components using numerical examples. We employ \(\ell _1\) and \(\ell _2\) Fourier transform to compute the expansion coefficients. The corresponding Fourier-series expansion is called \(\ell _1\) and \(\ell _2\) Fourier-series expansion. We compare these two methods for signal components separation. As a real application, we compare them for ECG signal analysis and waveform decomposition.

Fig. 1
figure 1

Truncated \(\ell _2\) and \(\ell _1\) Fourier-series expansion of sinc signals \(x_1[n] = sinc[n]\) and \(x_2[n] = x_1[15(n+2.5)]\) for \(M = 9\). The \(\ell _2\) and \(\ell _1\) Fourier transform of the signal is also shown at the bottom of each figure 

Fig. 2
figure 2

\(\ell _2\) and \(\ell _1\) Fourier-series expansion-based separation of the mixture of two sinc signals: \(x_1[n] = sinc[n]\) and \(x_2[n] = x_1[15(n+2.5)]\). a Truncated \(\ell _2\) and \(\ell _1\) Fourier-series expansion of a \(x_1[n] + x_2[n]\) for \(M = 8\) b \(x_1[n] + x_2[n] - {\hat{x}}_1[n]\) for \(M = 80\) where \({\hat{x}}_1[n]\) is an estimate of \(x_1[n]\) using the truncated Fourier-series either by \(\ell _2\) or \(\ell _1\) Fourier transform. The \(\ell _2\) and \(\ell _1\) Fourier transform of each signal is also shown via red color at the bottom of each figure. The \(\ell _2\) and \(\ell _1\) Fourier transform of \(x_1[n]\) and \(x_2[n]\) is also plotted via blue color for comparison

Fig. 3
figure 3

\(\ell _2\) and \(\ell _1\) Fourier-series expansion of two mixed Gaussian signals. a \(x_1[n]\) b \(x_2[n]\)

Fig. 4
figure 4

\(\ell _2\) and \(\ell _1\) Fourier-series expansion-based separation of two mixed Gaussian signals. a \(x_1[n] + x_2[n]\) b \(x_1[n] + x_2[n] - {\hat{x}}_1[n]\) where \({\hat{x}}_1[n]\) is the estimated \(x_1[n]\) using the truncated Fourier-series either by \(\ell _2\) or \(\ell _1\) Fourier transform. The Fourier transform obtained by \(\ell _2\) and \(\ell _1\) minimization is also shown at the bottom of each figure

3 Numerical examples

In the following section, we present some important functions that are widely used in signal processing literature to illustrate the properties of the Fourier transform.

3.1 Example 1

Let us consider a sinc function \(x_1[n] = sinc[n], n=0,\cdots ,\ 1000\) plotted via blue color in Fig. 1a. The reconstructed signals provided by a truncated \(\ell _2\) and \(\ell _1\) Fourier-series of \(x_1[n]\) using the first 9 harmonics (i.e., \(M = 9\)) are plotted via dashed red and dashed green, respectively. The \(\ell _2\) and \(\ell _1\) Fourier transform of the signal is also shown at the bottom of each figure using red and green color, respectively. \(x_1[n]\) is represented perfectly using a truncated \(\ell _2\) or \(\ell _1\) Fourier-series. It means that \(x_1[n]\) is a low-frequency component signal. Let us consider the same sinc function after it has undergone the transformation: \(x_2[n] = x_1[15(n+2.5)]\) shown via blue color in Fig. 1b. The reconstructed signals provided by a truncated \(\ell _2\) and \(\ell _1\) Fourier-series of \(x_2[n]\) using the first 80 harmonics (i.e., \(M = 80\)) are plotted via dashed red and dashed green, respectively. \(x_2[n]\) is also represented perfectly using a truncated \(\ell _2\) and \(\ell _1\) Fourier-series which means that it is also a low-frequency component signal. Note that \(x_1[n]\) is slower than \(x_2[n]\).

Now, consider another signal which is a summation of \(x_1[n]\) and \(x_2[n]\). The sum is plotted via gray color in Fig. 2a. Suppose that our objective is to estimate \(x_1[n]\) from the sum signal. In this case, the objective is to reconstruct \(x_1[n]\) and reject \(x_2[n]\). However, the frequency spectrum of \(x_2[n]\) overlaps with \(x_1[n]\) computed by either \(\ell _2\) or \(\ell _1\) Fourier transform (see their Fourier transforms in Fig. 1a, b). In Fig. 2a, we plot the reconstructed signal provided by \(\ell _2\) and \(\ell _1\) Fourier-series of \(x_1[n] + x_2[n]\) using the first 9 harmonics (i.e., \(M = 9\)) via dashed red and dashed green, respectively. The reconstructed signal using the truncated \(\ell _1\) Fourier-series is more close to \(x_1[n]\). The \(\ell _1\) Fourier transform of \(x_1[n] + x_2[n]\) is shown via red color at left bottom of Fig. 2a. The \(\ell _1\) Fourier transform of the sum is also shown via green color which is comparable to the \(\ell _1\) Fourier transform of \(x_1[n]\). It is seen that they are close to each other. However, the \(\ell _2\) Fourier transforms of \(x_1[n] + x_2[n]\) and \(x_1[n]\) are different. After subtracting the truncated Fourier-series of \(x_1\) (which was computed in the previous step) from the sum, the truncated \(\ell _2\) and \(\ell _1\) were again used to estimate \(x_2\) using the first 80 harmonics, \(M = 80\). The reconstructed signals provided by the truncated \(\ell _2\) and \(\ell _1\) Fourier-series of the residual using the first 80 harmonics are plotted via dashed red and dashed green in Fig. 2b. The reconstructed signal using the truncated \(\ell _1\) Fourier-series is more close to the reconstructed signal using the truncated \(\ell _2\) Fourier-series. Comparing to the \(\ell _2\) Fourier transform, the \(\ell _1\) Fourier transform of the residual is closer to the Fourier transform of \(x_2[n]\) as shown at the bottom of Fig. 2b. It means that \(\ell _1\) Fourier-series expansion separates these two sinc signals much better than the \(\ell _2\) Fourier-series expansion.

3.2 Example 2

Sum of Gaussian kernels are common in signal modeling, especially they become popular in ECG signal modeling, due to their morphological similarity with the ECG components waveform [10,11,12]. A sum of Gaussian model is defined as follows:

$$\begin{aligned} x[n] = \sum _{i=1}^{N} \alpha _i \exp \left[ -\frac{(nT_s - \mu _i)^2}{2b_i^2}\right] , \end{aligned}$$
(9)

where \(\alpha _i\), \(b_i\), and \(\mu _i\) are the amplitude, angular spread, and location of the Gaussian functions. Let us consider a sum of two Gaussian functions:

$$\begin{aligned} x[n] = x_1[n] + x_2[n] = \sum _{i=1}^{2} \alpha _i \exp \left[ -\frac{(nT_s - \mu _i)^2}{2b_i^2}\right] , \end{aligned}$$
(10)

where \(n=0,\cdots ,\ 1000\), \(\alpha _1 = 7,5\), \(b_1 = 0.4\), \(\mu _1 = 750\), \(\alpha _2 = 30\), \(b_2 = 0.05\) and \(\mu _2 = 500\). \(x_1[n]\) and its truncated \(\ell _2\) and \(\ell _1\) Fourier-series using the first 7 harmonics (i.e., \(M = 7\)) are plotted via blue color, dashed red and dashed green, respectively in Fig. 3a. \(x_1[n]\) is reconstructed perfectly using a truncated \(\ell _2\) or \(\ell _1\) Fourier-series which means it is a low-frequency component signal. In Fig. 3b, we plotted \(x_2[n]\) and its truncated \(\ell _2\) and \(\ell _1\) Fourier-series using the first 51 harmonics (i.e., \(M = 51\)) via blue color, dashed red and dashed green, respectively. \(x_2[n]\) is also reconstructed perfectly using a truncated \(\ell _2\) or \(\ell _1\) Fourier-series which means it is also a low-frequency component signal. The \(\ell _2\) and \(\ell _1\) Fourier transform is also shown at the bottom of each figure. Figure 4a shows the truncated \(\ell _2\) and \(\ell _1\) Fourier-series of \(x_1[n] + x_2[n]\) using the first 7 harmonics. The Fourier transforms are also shown at the bottom of the figure. The results show that the \(\ell _1\) Fourier transform of \(x_1[n] + x_2[n]\) is close to the \(\ell _1\) Fourier transform of \(x_1[n]\). However, the \(\ell _2\) Fourier transform of \(x_1[n]\) is far from the \(\ell _2\) Fourier transform of \(x_1[n] + x_2[n]\). The estimated \(x_2\) using truncated \(\ell _2\) and \(\ell _1\) Fourier-series is also plotted in Fig. 4b. The results of Figs. 3 and 4 show that the Fourier-series expansion of a mixture of Gaussian signals, when the \(\ell _1\) Fourier transform is used to identify the expansion coefficients, produces a more accurate estimate of its components.

Fig. 5
figure 5

Real ECG record s0017lrem from the PhysioNet PTB Diagnostic ECG Database (ptbdb)

Fig. 6
figure 6

T-wave and QRS-complex detection using truncated Fourier-series expansion (using rectangular, Blackman and Hanning window) and zero-phase Butterworth filter

4 ECG signal representation using Fourier-series expansion

As mentioned before, the \(\ell _2\)-norm corresponds to the Gaussian distribution and its performance decreases in non-Gaussian model errors. It is notable that the ECG is a sparse band-limited signal and the changes in T-waves are much slower than the changes in QRS-complex. In other words, for low-frequency (slow) components like T-wave, the distribution of the fast component (QRS-complex) is non-Gaussian. Therefore, the \(\ell _1\) Fourier transform (which is based on the \(\ell _1\)-norm minimization) would provide better ECG components separation (i.e., ventricular depolarization and repolarization) than the \(\ell _2\) Fourier transform. In this section, we analyze the ECG signal using \(\ell _2\) and \(\ell _1\) Fourier transform. We show that the Fourier-series expansion when the coefficients are computed using \(\ell _1\) Fourier transform, produces a more accurate estimate of its slow components (T-waves) and rejects the fast component (QRS-complex). Especially, the Gibbs phenomenon introduced by the truncated Fourier-series expansion is significantly decreased when the expansion coefficients are computed using \(\ell _1\) Fourier transform compared to the traditional \(\ell _2\) Fourier transform.

Fig. 7
figure 7

T-wave and QRS-complex detection using truncated \(\ell _1\) Fourier-series expansion

As a first example of the application of Fourier-series expansion, we consider the truncated Fourier-series expansion of a specific case (record s0017lrem from the PhysioNet PTB Diagnostic ECG Database (ptbdb) [13]) shown in Fig. 5. Each record of the database sampled at 1 kHz (\(f_s = 1000\)). In this example, we consider a portion of the ECG record with 4000 samples, i.e., \(N = 4000\). We represent the ECG signal using a truncated Fourier-series expansion with \(M < N\). In this case, the truncated Fourier-series expansion acts as a low-pass filter that passes the low-frequency components with frequencies less than \(M/N \times f_s\) Hz and rejects the high-frequency components with frequencies greater than it. We compare the Fourier-series expansion of the ECG signal when the coefficients are computed using \(\ell _2\) and \(\ell _1\) Fourier transform. The question is which Fourier transform type better separates ventricular repolarization (T-wave) and ventricular depolarization (QRS-complex). The result of ECG representation using the truncated \(\ell _2\) Fourier-series expansion, i.e., \(x_{32}[n]\), is shown in Fig. 6a via red curve. Selecting \(M = 32\) means that the cutoff frequency is 8 Hz. The residual is QRS-complex component which can be computed using Fourier-series expansion when the frequencies are greater than 8 Hz. The extracted QRS-complex is shown via yellow curve. The truncated \(\ell _2\) Fourier-series expansion is unable to accurately extract the T-wave and reject the QRS-complex. The Gibbs phenomenon is evident in the truncated \(\ell _2\) Fourier-series expansion as shown by arrows in Fig. 6a. A method to reduce the Gibbs phenomena is multiplication by a tapered window (e.g., Blackman, Hanning, Kaiser), versus a rectangular window. We also employed the Blackman and Hanning window for computing the truncated \(\ell _2\) Fourier-series expansion. The results of \(\ell _2\) Fourier analysis using Blackman and Hanning window are shown in Fig. 6b, c, respectively. Although the Gibbs phenomena is reduced using these tapered windows, it causes that some parts of T-waves are wrongly extracted and mixed with QRS-complexes.

It is mentionable that the zero-phase LTI filters are the standard and simple choice for ECG signal preprocessing, as they impose little assumptions on the signals and preserve their phase contents. Therefore, a naive third order zero-phase low-pass Butterworth filter with cutoff frequency 8 Hz was also used to extract the T-waves in the ECG signal. The T-waves and QRS-complexes provided by zero-phase low-pass Butterworth filter are, respectively, shown via red and yellow curve in Fig. 6d. As shown by arrows, we observe that the zero-phase Butterworth filter which is commonly used in the literature does not perfectly reject the QRS-complex. Finally, we model the same ECG record using a truncated \(\ell _1\) Fourier-series expansion. In order to compute the expansion coefficients, we set \(M=32\) (cutoff frequency is 8 Hz), and the number of iterations to 100, i.e., \(x^{(100)}_{32}[n]\). Figure 7 shows the results of T-waves detection using \(\ell _1\) Fourier-series expansion. The truncated \(\ell _1\) Fourier-series expansion extracts the T-waves and rejects the QRS-complexes much better than the truncated \(\ell _2\) Fourier-series expansion and zero-phase Butterworth filter.

Fig. 8
figure 8

Abnormal ECG record 8378m from MIT-BIH Atrial Fibrillation Database

Fig. 9
figure 9

ECG components separation using truncated Fourier-series expansion a T-wave detection using truncated \(\ell _2\) Fourier-series expansion b P and QRS-complex detection using truncated \(\ell _2\) Fourier-series expansion c T-wave detection using truncated \(\ell _12\) Fourier-series expansion d P and QRS-complex detection using truncated \(\ell _1\) Fourier-series expansion

In the second example, we consider the truncated Fourier-series expansion of an abnormal case (record 08378m from MIT-BIH Atrial Fibrillation Database [13]). This record is shown in Fig. 8. We consider a portion of the ECG record with 2500 samples, i.e., \(N = 2500\). We model the ECG signal using a truncated Fourier-series with \(M = 60\). Figure 9a–d shows the results of ECG representation using the truncated \(\ell _2\) Fourier-series expansion and \(\ell _1\) Fourier-series expansion, respectively. \(\ell _2\) Fourier-series expansion leads to the distortion of T-waves before premature ventricular contractions (PVC), while \(\ell _1\) Fourier-series expansion does not, as highlighted using arrows. The Gibbs phenomenon is also evident in the truncated \(\ell _2\) Fourier-series expansion. A PVC is a heartbeat which is autonomously triggered in the ventricles, and not in the sinus node. PVCs are common events which do not necessarily imply a negative heart condition [14].

5 Simulation results

For evaluating the performance of the \(\ell _1\) Fourier analysis, we applied it on simulated data, which permit to quantify the decomposition error directly. The single-channel synthetic data were obtained using the ECG dynamical model (EDM) proposed in [10]. The original ECG components are also needed for quantifying the decomposition error. To this purpose, we used the extended version of EDM proposed by Sayadi et al. for generating ECG characteristic waveforms (CWs) [15]. Seven Gaussian kernels were employed to model ECG beats, corresponding to each of the ECG components (P-wave, QRS-complex, and T-wave), and for modeling asymmetries two Gaussian kernels were used for P- or T-waves (indicated by \({~}^{+}\) and \({~}^{-}\) superscripts), leading to:

$$\left\{ \begin{aligned} & \dot{\theta } = \omega \\ & \dot{P} = - \sum\limits_{{i \in \{ P^{ - } ,P^{ + } \} }} {\alpha _{i} } \omega \frac{{\theta - \theta _{i} }}{{b_{i}^{2} }}\exp \left[ { - \frac{{(\theta - \theta _{i} )^{2} }}{{2b_{i}^{2} }}} \right] \\ & Q\dot{R}S = - \sum\limits_{{i \in \{ {\text{Q, R, S}}\} }} {\alpha _{i} } \omega \frac{{\theta - \theta _{i} }}{{b_{i}^{2} }}\exp \left[ { - \frac{{(\theta - \theta _{i} )^{2} }}{{2b_{i}^{2} }}} \right], \\ & \dot{T} = - \sum\limits_{{i \in \{ T^{ - } ,T^{ + } \} }} {\alpha _{i} } \omega \frac{{\theta - \theta _{i} }}{{b_{i}^{2} }}\exp \left[ { - \frac{{(\theta - \theta _{i} )^{2} }}{{2b_{i}^{2} }}} \right] \\ & x = P + {\text{QRS}} + T \\ \end{aligned} \right.$$
(11)

We set the sampling rate to 250 Hz and generated 1000 synthetic series with 10s long. We allowed the RR interval durations to have a random fluctuation of up to \(5\%\) in each beat to make the synthetic ECGs more realistic. We added the random noise to synthetic ECGs. The signal-to-noise ratio (SNR) was modulated from 10 to 50 dB.

The \(\ell _2\) and \(\ell _1\) Fourier transforms were used to analyze the ECG signals. We compared the efficiency of the \(\ell _2\) and \(\ell _1\) Fourier transform in extracting the ECG components. To quantify the performances of the methods, we used the measures of improvement given by the normalized mean absolute error (MAE):

$$\begin{aligned} \text{MAE} = \frac{\sum _k \left| x_k - {\hat{x}}_k\right| }{\sum _k |x_k|} , \end{aligned}$$

where \(x_k\) and \({\hat{x}}_k\) denote the original and the estimated components (either using \(\ell _2\) or \(\ell _1\) Fourier transforms). The mean of MAE at different input SNRs is plotted in Fig. 10. \(\ell _1\) Fourier analysis outperforms zero-phase Butterworth filter and \(\ell _2\) Fourier analysis.

Fig. 10
figure 10

Mean values of MAE as a function of SNR

6 Conclusion

The \(\ell _1\) Fourier transform improves the Fourier-series expansion of time-series in reducing the effect of Gibbs phenomena and filtering the impulsive noise from the data. In this method, the Fourier coefficients are computed by minimizing the \(\ell _1\)-norm of the error between the time-series and its Fourier-series expansion. This paper presented the application of Fourier transform to decompose an ECG signal to its components waveform as a real application. We showed that the Fourier-series expansion of an ECG signal, when the \(\ell _1\) Fourier transform is used to identify the expansion coefficients, produced a much accurate estimate of its components waveform (e.g., QRS-complex and T-wave). Especially, the Gibbs phenomenon introduced by the Fourier-series expansion is significantly decreased when the expansion coefficients are computed using \(\ell _1\) Fourier transform compared to the traditional \(\ell _2\) Fourier transform. The efficiency of \(\ell _1\) Fourier analysis was compared with the traditional \(\ell _2\) Fourier transform and zero-phase Butterworth filter. The \(\ell _1\) Fourier transform significantly improves the Fourier-series expansion to decompose a signal to slow and fast components. Based on our assessments, the P-wave is indistinguishable with either the T-wave or QRS-complex in the frequency spectrum, as demonstrated in Figs. 9, 11 and 12, even when employing the \(\ell _1\) Fourier transform. Our future research will examine the utilization of the \(\ell _p\) Fourier transform for values of p between 0 and 1, aiming at further reducing the Gibbs effect and thus being able to better separate signals which do not strongly overlap in frequency.

Fig. 11
figure 11

Abnormal ECG record 8455m from MIT-BIH Atrial Fibrillation Database

Fig. 12
figure 12

ECG components separation using truncated Fourier-series expansion a T-wave detection using truncated \(\ell _2\) Fourier-series expansion b P and QRS-complex detection using truncated \(\ell _2\) Fourier-series expansion c T-wave detection using truncated \(\ell _12\) Fourier-series expansion d P and QRS-complex detection using truncated \(\ell _1\) Fourier-series expansion

Data availability

No datasets were generated or analyzed during the current study.

References

  1. J.F. James, A Student’s Guide to Fourier Transforms: With Applications in Physics and Engineering, Student’s Guides, 3rd edn. (Cambridge University Press, Cambridge, 2011). https://doi.org/10.1017/CBO9780511762307

    Book  Google Scholar 

  2. K.R. Rao, D.N. Kim, J.-J. Hwang, Fast Fourier Transform-Algorithms and Applications, 1st edn. (Springer, Berlin, 2010)

    Book  Google Scholar 

  3. M. Rahman, Applications of Fourier Transforms to Generalized Functions (WIT Press, Boston, 2011)

    Google Scholar 

  4. A. Kheirati Roonizi, Fourier analysis: a new computing approach. IEEE Signal Process. Mag. 40(1), 183–191 (2023)

    Article  Google Scholar 

  5. A.V. Oppenheim, R.W. Schafer, Discrete-Time Signal Processing (Pearson Education, London, 2011)

    Google Scholar 

  6. R.C. Gonzalez, R.E. Woods, Digital Image Processing (Prentice Hall, Upper Saddle River, 2008)

    Google Scholar 

  7. S. Kotz, T. Kozubowski, K. Podgorski, The Laplace Distribution and Generalizations: A Revisit with Applications to Communications, Economics, Engineering, and Finance Progress in Mathematics. (Birkhäuser, Boston, 2001)

    Book  Google Scholar 

  8. Z. Wang, A.C. Bovik, Mean squared error: Love it or leave it? A new look at signal fidelity measures. IEEE Signal Process. Mag. 26(1), 98–117 (2009)

    Article  Google Scholar 

  9. L.G. Tereshchenko, M.E. Josephson, Frequency content and characteristics of ventricular conduction. J. Electrocardiol. 48(6), 933–937 (2015). https://doi.org/10.1016/j.jelectrocard.2015.08.034

    Article  Google Scholar 

  10. P.E. McSharry, G.D. Clifford, L. Tarassenko, L.A. Smith, A dynamic model for generating synthetic electrocardiogram signals. IEEE Trans. Biomed. Eng. 50, 289–294 (2003)

    Article  Google Scholar 

  11. E. Kheirati Roonizi, R. Sameni, Morphological modeling of cardiac signals based on signal decomposition. Comput. Biol. Med. 43, 1453–1461 (2013)

    Article  Google Scholar 

  12. E. Kheirati Roonizi, R. Sassi, A signal decomposition model-based bayesian framework for ECG components separation. IEEE Trans. Signal Process. 64(3), 665–674 (2016). https://doi.org/10.1109/TSP.2015.2489598

    Article  MathSciNet  Google Scholar 

  13. A.L. Goldberger, L.A.N. Amaral, L. Glass, J.M. Hausdorff, P.C. Ivanov, R.G. Mark, J.E. Mietus, G.B. Moody, C.-K. Peng, H.E. Stanley, PhysioBank, PhysioToolkit, and PhysioNet. Circulation 101(23), e210–e215 (2000). https://doi.org/10.1161/01.cir.101.23.e215

    Article  Google Scholar 

  14. L.E. Hinkle, S.T. Carver, D.C. Argyros, The prognostic significance of ventricular premature contractions in healthy people and in people with coronary heart disease. Acta Cardiol. Suppl 18, 5–32 (1974)

    Google Scholar 

  15. O. Sayadi, M.B. Shamsollahi, A model-based Bayesian framework for ECG beat segmentation. Physiol. Meas. 30, 335–352 (2009)

    Article  Google Scholar 

Download references

Acknowledgements

This research was supported by the MUSA - Multilayered Urban Sustainability Action - project, funded by the European Union - NextGenerationEU, under the National Recovery and Resilience Plan (NRRP) Mission 4 Component 2 Investment Line 1.5: Strengthening of research structures and creation of R &D “innovation ecosystems”, set up of “territorial leaders in R &D”.

Author information

Authors and Affiliations

Authors

Contributions

Arman Kheirati Roonizi wrote the main manuscript and all authors reviewed the manuscript.

Corresponding author

Correspondence to Arman Kheirati Roonizi.

Ethics declarations

Competing interests

The authors declare no competing interests.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Kheirati Roonizi, A., Sassi, R. ECG signal decomposition using Fourier analysis. EURASIP J. Adv. Signal Process. 2024, 79 (2024). https://doi.org/10.1186/s13634-024-01171-x

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1186/s13634-024-01171-x

Keywords