Skip to main content
Biomimetics logoLink to Biomimetics
. 2024 May 18;9(5):300. doi: 10.3390/biomimetics9050300

Modeling the Electrical Activity of the Heart via Transfer Functions and Genetic Algorithms

Omar Rodríguez-Abreo 1, Mayra Cruz-Fernandez 2, Carlos Fuentes-Silva 2, Mario A Quiroz-Juárez 1,*, José L Aragón 1,*
Editors: Ameer Hamza Khan, Shuai Li, Danish Hussain
PMCID: PMC11118079  PMID: 38786509

Abstract

Although healthcare and medical technology have advanced significantly over the past few decades, heart disease continues to be a major cause of mortality globally. Electrocardiography (ECG) is one of the most widely used tools for the detection of heart diseases. This study presents a mathematical model based on transfer functions that allows for the exploration and optimization of heart dynamics in Laplace space using a genetic algorithm (GA). The transfer function parameters were fine-tuned using the GA, with clinical ECG records serving as reference signals. The proposed model, which is based on polynomials and delays, approximates a real ECG with a root-mean-square error of 4.7% and an R2 value of 0.72. The model achieves the periodic nature of an ECG signal by using a single periodic impulse input. Its simplicity makes it possible to adjust waveform parameters with a predetermined understanding of their effects, which can be used to generate both arrhythmic patterns and healthy signals. This is a notable advantage over other models that are burdened by a large number of differential equations and many parameters.

Keywords: modeling, ECG, transfer function, genetic algorithm, metaheuristic optimization

1. Introduction

Mathematical models have become indispensable across many disciplines for predicting the dynamic behaviors of complex systems at different scales. Generally, these models are described by a set of differential equations that represent the variation in the system with respect to certain independent variables, typically time. Recently, there has been a notable advancement in the precision of mathematical models, particularly in the realm of biological phenomena. In the last century, these advancements were unattainable because of computational resource constraints. This progress has enabled the simulation of intricate biological processes with unprecedented accuracy, thereby revolutionizing our ability to understand and manipulate biological systems [1].

The human heart is one of the most intriguing biological systems and studied from various perspectives. The complexity inherent in this analysis demands the integration of biological, medical, and engineering disciplines to understand the dynamics of cardiac function. Many efforts have been made to understand the characteristics of the heart’s function, from its physiology [2] to its interactions with various systems and organs of the body, including the brain [3]. However, there are still many open questions that need to be answered. One such question revolves around the mechanisms underlying certain cardiac pathologies such as arrhythmias or heart failure. Importantly, diseases associated with the heart are considered primary causes of death worldwide [4]. Addressing investigations along this line not only holds the promise of improving diagnostic and therapeutic approaches but also deepens our fundamental understanding of cardiac function and paves the way for more effective interventions and treatments of these diseases in the future.

Although complete cardiac studies can be complicated or expensive, various experimental methods allow heart analysis, such as electrophysiological studies and optical imaging of the electrical activity of the heart. Electrocardiograms (ECG) are the most common analysis method [5], through which a wide variety of heart diseases can be detected in a non-invasive manner. ECG signals are captured through electrodes strategically placed on various parts of the body. These electrodes collect electrical information from different angles, leading to so-called “leads” that offer different perspectives on the heart’s electrical activity. These signals reflect transmembrane ionic currents in the heart [6]. Typically, a healthy heartbeat manifests in two phases: systole, corresponding to contraction, and diastole, which is indicative of relaxation. Given the accessibility and minimal risk to patients, coupled with the valuable information it provides, ECGs remain a cornerstone tool for diagnosing heart conditions [7,8].

As previously mentioned, comprehending electrical activity behavior from a mathematical standpoint is crucial for diagnosing heart conditions [9]. To this end, various mathematical models have been proposed [10] to detect arrhythmias or other pathologies, comprehend the defibrillation process, and analyze the impact of electrical disturbances on the heart [11]. Remarkably, incorporating all variables affecting the electrical activity of the heart results in a complex model that is impractical for real-world applications. Furthermore, certain variables or parameters of the model may be challenging or impossible to measure. Examples of these models include the bidomain model and the EMI model, which takes its name from the extracellular space (E), cell membrane (M), and intracellular space (I) [12]. Although these models offer high precision, they incur substantial computational costs [13]. Other research efforts have focused on proposing mathematical models to reproduce the electrical activity of the heart at a macroscopic level through ECG signals, allowing a balance between simplicity and precision [14,15]. The purpose of modeling is to provide simplified representations of complex phenomena. Each model adapts differently to the real characteristics of a phenomenon. A novel model of the heart’s electrical activity can offer fresh insights into its functioning. Regarding clinical use, the construction of a new model is an alternative that allows for generating a comparative database of synthetic ECG signals used to train arrhythmia and heart disease detection systems and make them more robust.

On the other hand, research on artificial intelligence (AI), including evolutionary computation, has witnessed exponential growth in recent years, largely attributed to a remarkable surge in computing power. This has facilitated the resolution of problems across numerous scientific domains that lack exact solution methods or are computationally infeasible owing to their complexities. Currently, there is a growing trend in the use of AI tools to diagnose cardiac issues by analyzing ECGs [7]. However, AI can also be used to assist in creating models that more accurately represent the dynamics of heartbeats through metaheuristic algorithms. An illustrative example is presented in [16], where a mathematical model was developed using metaheuristic algorithms.

In this study, we introduce a dynamical model, grounded in transfer functions [17,18], which describe the heart’s electrical activity at a macroscopic level. Our model comprises three low-order transfer functions coupled with time delays whose parameters are obtained through metaheuristic algorithms, specifically genetic algorithms (GA). Using a database of real electrocardiograms as reference signals, our model can be tailored to various ECG waveforms, a novel approach that has not been previously explored in the literature to our knowledge. Through minimization of the integral square error, the GA determines the parameter range for healthy ECGs, as well as for ECGs exhibiting arrhythmias. The results demonstrated that our model effectively captured real ECG signals, with a root mean square error (RMSE) of 4.7% for healthy signals and an average RMSE of 7.2% for arrhythmia signals. Finally, we compared our model with existing proposals, highlighting its distinctiveness in allowing each electrocardiogram wave to be independently adjusted, with parameters obtained through evolutionary computation rather than manual tuning. Thus, our study underscores the utility of AI-guided transfer function modeling as a practical and valuable tool for investigating ECG signals.

2. Background and Related Works

An ECG is a recording of the electrical activity of the heart through electrodes placed on the skin. These electrodes collect the voltage changes caused by the depolarization and repolarization processes that occur with every heartbeat. The peaks and valleys of the ECG signal are labeled as the P wave, QRS complex, and T wave, as shown in Figure 1.

Figure 1.

Figure 1

Ideal ECG for a healthy heart.

As depicted in Figure 1, an ECG is composed of segments, intervals, and waves. The P wave originates from the depolarization of the atria. In contrast, the QRS complex originates from contraction of the lower chambers of the heart (depolarization of the ventricles). The T-wave originates from the repolarization of the ventricles. The PR segment moves from the beginning of the P-wave to the beginning of the QRS complex, representing conduction through the atria. Finally, the QT interval extends from the start of the QRS complex to the final T wave, containing information on the processes of ventricular depolarization and repolarization. We refer the reader to ref. [19] for a detailed explanation.

Several models have been developed to represent electrical cardiac dynamics. The best-known model is the bidomain model, which is a set of mathematical equations that describe the electrical properties of cardiac tissue [20]. This model is widely used when maximum precision is required in numerical simulations and the computational cost is not important. However, mathematical modeling requires a balance between detail and tractability; thus, more manageable models have been proposed, which are briefly discussed below.

2.1. Ring of Three-Coupled Oscillators

One of the first ideas for obtaining simplified models of the heart was to consider a set of nonlinear oscillators. A notable example is a model consisting of a ring of three oscillators coupled with delays, which was developed by employing a set of six ordinary differential equations. In this model, each oscillator corresponded to a natural pacemaker in the heart [21]. The equations governing this model are as follows:

x˙1=x2,x˙2=aSAx2(x1ωSA1)(x1ωSA2)+ρSAsin(ωSAt)x1(x1dSA)(x1eSA)KSAAV(x1x3τSAAV)kSAHP(x1x5τSAAV),x˙3=x4,x˙4=aVAx4(x3ωAV1)(x3ωAV2)+ρAVsin(ωAVt)x3(x3dAV)(x1eAV)KAVSA(x3x1τAVSA)kAVHP(x3x1τSAAV),x˙5=x6,x˙6=aHPx6(x5ωHP1)(x5ωHP2)+ρHPsin(ωHPt)x5(x5dHP)(x5eHP)KHPSA(x5x1τHPSA)kHPAV(x3x3τSAAV), (1)

where anode,ωnodei,dnode, and enode are parameters of the system, and node=SA,AV,HP, stand for sinoatrial, atrioventricular, and His–Purkinje nodes, respectively. τ is the time delay, ρnode is the amplitude of the external stimulus, and ωnode is its frequency. Finally, the ECG signal can be determined by

ECG(t)=(α0+α1x1+α3x3+α5x5)βG, (2)

where αi, i=1,2,3, are parameters weighting each system variable and βG is used as a global scaling factor.

2.2. Heterogeneous Nonlinear Oscillators

Heterogeneous nonlinear oscillators consist of modified Van Der Pol and FitzHugh–Nagumo oscillators, which capture the action potentials of primary natural pacemakers and the electrical responses of cardiac muscle tissues (atrial and ventricular muscles) [22]. Subsequently, this model was adapted to represent ventricular fibrillation as an instance of chaos [23]. The equations governing natural pacemakers in this model are as follows:

x˙i=yi,y˙i=aiyi(x1ui)fixi(xi+ei)+Knode(yi1τnodeyi). (3)

The sinoatrial node corresponds to i=1, the atrioventricular node corresponds to i=2, and the His–Purkinje term corresponds to i=3. Coefficients ai,fi,ui,di, and ei are the parameters of each oscillator. Finally, a complete description of the ECG signal is given by

ECG(t)=z0+α1z1α2z2+α3z3+α4z4, (4)

where z0 adjusts the baseline of the ECG signal and zi corresponds to the depolarization and repolarization processes represented by the P-wave (i=1), Ta-wave (i=2), QRS complex (i=3), and T-wave (j=4), which are defined as follows:

z˙j=kj(cjzj(zjωj1)(zjωj2)bjvjgjvjzj+Ij),v˙j=kjhj(zjvj), (5)

where kj is a scaling factor; cj governs the amplitude of the pulse; bj and gj modify the rest state; and hj, ωj1, and ωj2 control the duration of the action potential, the excitation threshold, and excited state of each oscillator, respectively. Ij is the magnitude of the stimulation current that couples the natural pacemakers to the cardiac muscles.

2.3. Reaction–Diffusion Model

The Reaction–diffusion spatially discretized model is a set of three nonlinear oscillators obtained from the spatial discretization of a reaction-diffusion model [24]. This model generates normal ECGs and cardiac arrhythmias. The set of ordinary differential equations that describe the model is as follows:

x˙1=x1x2Cx1x2x1x22,x˙2=Hx13x2+Cx1x2+x1x22+β(x4x2),x˙3=x3x4Cx3x4x3x42,x˙4=Hx33x4Cx3x4x3x42+2β(x2x4), (6)

where β is the coupling parameter between the oscillators, and H and C are parameters that control the dynamics of the system. The ECG signal is obtained using the following linear combination of variables:

ECG(t)=α1x1+α2x2+α3x3+α4x4, (7)

where the parameters αi and i=1,2,3 are the weights.

2.4. Extended Dynamical Model Based on a Quasi-Periodic Motion

Originally developed in ref. [25], this model consists of a set of three coupled ordinary equations that can generate simple ECG signals for both normal heartbeats and arrhythmias, with simple parameter variations. The original equations for this model are as follows:

x˙=αxωy,y˙=αyωx,z˙=i(P,Q,R,S,T)aiΔθiexpΔθi22bi2(zz0), (8)

where α=1x2+y2, Δθi=(θθi) mod 2π, θ=arctan(y,x), and ω is the angular velocity. z0=Asin(2πf2t) is the baseline, where A is the amplitude and f2 represents the respiratory frequency. Here, the z variable yields a synthetic ECG waveform.

Subsequently, a Gaussian wavelet-based state space was developed using (8). In this modified model, characteristic waves, such as atrial and ventricular complexes, can be controlled individually [26], and it was shown that this model can accurately represent a human heartbeat. The modified model is described by the equations

x˙=αxωy,y˙=αyωx,P˙=iϵ(P,P+)aiΔθiexpΔθi22bi2(PP0),C˙=iϵ(Q,R,S)aiΔθiexpΔθi22bi2(CC0),T˙=iϵ(T,T+)aiΔθiexpΔθi22bi2(TT0). (9)

Finally, the synthetic ECG is obtained as

ECG(t)=P(t)+C(t)+T(t). (10)

2.5. Periodically Kicked Network of RLC Oscillators

This linear model is based on two RLC linear oscillators excited by a pulse signal train, including a time delay to account for the delay in the electrical transport from the atria to the ventricles [27]. This model has the advantage that analytical solutions can be obtained when a single impulse is applied. A critical feature of this model is that each parameter modifies a specific waveform characteristic of the synthetic ECG signals produced. Although this model has some limitations, it can show that the main signals of an ECG can be reproduced using linear models. The equation describing the ECG is as follows:

ECG(t)=2Aγω02eα+α24ω022u(tτ)etτα24ω021u(tτ)α24ω02+eα2sinhα24ω022tα24ω02eα2(1+CXω0)tsinhα24ω02(1+CXω0)2(1+CXω0)tα24ω02(1+CXω0), (11)

where α=1RC denotes the damping factor, ω0=1LC denotes the natural frequency, and γ denotes the input pulse width. R, C, and L denote the resistance, capacitance, and inductance, respectively.

3. Materials and Methods

Here, we will show that a set of three second-order transfer functions (one function per repolarization and depolarization process) can generate waveforms that resemble clinical ECGs. The model is stimulated by a cyclical impulse signal.

Second-order transfer functions have two basic polynomial representations: standard and non-standard forms. In this study, the non-standard form was used, since investigations like [28] explained that if the variations of a phenomenon can be measured or predicted theoretically, then they can be represented by a non-standard transfer function. Additionally, non-standard transfer functions allow the use of proper transfer functions; that is, with a polynomial in the numerator a degree lower than the polynomial of the numerator. Therefore, non-standard transfer functions can present much more complex dynamics than standard second-order transfer functions, adding parameters such as the coefficient of the zero in the numerator, which is not considered within a standard function. This explanation was added in Section 3. Subsequently, we use time delays to couple the different transfer functions. The model for reproducing a heartbeat (HB) is described by the sum of the three transfer functions, as follows:

HB(s)=i=13kierisaisbis2+cis+di, (12)

where the transfer functions corresponding to i=1, 2, and 3 represent the P-wave, the QRS complex, and the T-wave, respectively. a,b,c,d,r, and k are the model parameters. In particular, k is a gain that allows controlling the response amplitude, a represents the position of the zero in the transfer function, r is the time delay associated with the coupling of every signal, c is a parameter that allows controlling the damping factor, and d and b are related to the natural frequency of the system.

Equation (12) is driven by a periodic pulse train, which represents the rhythmic nature of heartbeats. Hence, the entire ECG output can be defined as

ECG(s)=i=13kieris1esfaisbis2+cis+di, (13)

where f denotes the pulse train frequency. The next task is to find the parameter values for (12) and (13) to reproduce the particular synthetic ECG waveforms. Given the complexity of estimating multiple coefficients, metaheuristic algorithms have emerged as plausible choices. These algorithms exhibit versatility in addressing various problems across different domains, as evidenced by their widespread application [29]. Metaheuristic algorithms have the advantage of easily adapting to any problem and running in parallel when the processing time increases. However, it is essential to note that metaheuristic algorithms do not guarantee a global optimum, implying that they may not always converge to the best solution. Nevertheless, by appropriately configuring the algorithm, solutions that satisfy the constraints of the problem can be obtained.

Genetic algorithms (GA) stand out as one of the most widely used and well-known metaheuristic algorithms [30]. Inspired by natural selection, a GA mimics the process of selecting the most advantageous genes for inheritance by successive generations. The various versions of this algorithm can yield different results. Nonetheless, a fundamental phase common to most GA iterations is selection, in which a fitness function assesses all potential initial random solutions to identify the best-performing ones. Mutation introduces random variations in the solutions to prevent convergence to local maxima, whereas crossover facilitates the combination of two strong solutions.

We used a GA to explore the parameters of (12) and (13) to generate an ECG signal that closely resembles a real signal. Algorithm 1 is the pseudocode describing the GA utilized in this study. Note that elitism was employed to ensure descent of the most suitable genes.

Algorithm 1 Pseudocode for the used GA
  • 1:

    Begin

  • 2:

    Select hyperparameters

  • 3:

    Set the initial population P; each individual is a vector with random coefficients corresponding to Equation (12).

  • 4:

    while fitness function ≤ 30,000 do

  • 5:

        Calculate fitness of each individual of P, defined by the Integral Square Error.

  • 6:

        Selection of P members with lower fitness value, according to biological pressure.

  • 7:

        Crossover parents with lowest fitness, using a random single point to create the union.

  • 8:

        Random change of a value in individuals (mutation).

  • 9:

        Generate a new generation of individuals P using elitism and the members with the lowest fitness.

  • 10:

    end while

  • 11:

    Keep the best solution (minimum fitness)

  • 12:

    end

The GA starts with a random population and assigns a "fitness" value to each random solution. A fitness function is selected to define the performance of each solution, with the most common being the mean square error (MSE), root mean square error (RMSE), and integral square error (ISE). For this study, the ISE was used as the fitness function, as follows:

ISE=ε(t)2dt, (14)

where ε is defined as

ε(t)=ECGreal(t)ECGsimulated(t) (15)

The selection was carried out using a tournament of size 3, and the remaining parameters of the GA are summarized in Table 1.

Table 1.

Parameter values of the Genetic Algorithm.

GA Hyperparameters Value Details
Population 5000 Numbers of vectors with random coefficients
Upper search limit [300 300 80,000 80,000 300 0.2 0.6 0.8 5] Maximum values allowed for parameters 
ai,bi,ci,di,ki,r1,r2,r3, and f, respectively (parameters with subscript i indicate that they share the same limit for the 3 values of i).
Lower search limit [−300 0 0 0 −300 0.001 0.2 0.4 1] Minimum values allowed for parameters ai,bi,ci,di,ki,r1,r2,r3, and f, respectively
Generations 6 Stop condition
Fitness function ISE=ε2dt Function for evaluate the performance of each individual (integral square error)
Elitism 10% Numbers of individuals in the search
Biological pressure 70% Percentage of individuals that reproduce
Mutation probability 30% Probability of random mutation occurs

Once the fitness function and parameter values of the GA are defined, the parameter values of the proposed model itself must be fine-tuned using clinical ECG registers as reference waveforms. In this study, the publicly available database PhysioNet [31,32] was used. This extensively used database grants access to 12-lead ECGs and encompasses 310 electrocardiogram records from 90 individuals, comprising 46 women and 44 men aged between 13 and 75 years. The database comprises two channels: the first channel contains RAW data, and the second channel contains filtered data. Each ECG recorded in this database has a resolution of 12 bits and a range error rate of ±10 mV. Labeled as patients with normal ECGs, each ECG signal was stored for 20 s and digitized at a sample rate of 500 Hz. This database was selected owing to its widespread recognition, extensive acquisition of details, and comprehensive nature.

The heartbeats from each individual in the study were manually segmented using the filtered channel. The system exhibited improved performance with noise-free signals. Nonetheless, this enabled the assessment of the method’s efficacy against a complex database encompassing variations that can be expected in real ECGs. Upon segmentation of the data, one of the 90 patients selected from the database was randomly chosen to initiate the model parameterization. Subsequently, the range of each parameter was defined so that it could be better adjusted to the database.

After completing the process for a single patient, the results were replicated for the remaining 89 patients, to determine the range of variation for each parameter. The simulations were conducted in a MATLAB-Simulink environment. MATLAB utilizes a genetic algorithm to produce coefficients assessed in the transfer functions built in Simulink. Subsequently, Simulink returned the simulated ECG signals, and MATLAB continued to evaluate the fitness using the remainder of the genetic algorithm. The model was solved using a fixed step of 0.0001 s and an automatic solver selection. The simulation times were selected based on the ECG signals used. All simulations were conducted on a computer with the following specifications: an 11th generation Intel(R) Core(TM) i7-1165G7 processor running at 2.8 GHZ, with 16 GB of RAM.

4. Results and Discussion

To synthesize a single heartbeat, the model parameters were adjusted by executing the GA (Algorithm 1 and the parameters of Table 1), using a clinical heartbeat as a reference waveform. As mentioned above, a real heartbeat from a randomly selected patient in the database (randomly selected) was used. The numerical results of the adjustment are presented in Table 2, and the resulting signal is shown in Figure 2.

Table 2.

Results of the genetic algorithm for estimating the coefficients in a heartbeat.

Parameter i = 1 i = 2 i = 3
r 0.0794 0.192 0.28
a 0 −0.465 0
b 40.92 349.96 35.12
c 120.22 223.35 38.90
d 0.85 × 103 48.3 × 103 2.28 × 103
k 50.11 94.81 57.57

Figure 2.

Figure 2

Comparison between a heartbeat obtained from the database and a heartbeat generated by the transfer function Model (13) tuned by a genetic algorithm.

The cost graph per iteration is shown in Figure 3. Standard statistical metrics were used to analyze the behavior of the method. The statistical results for this model compared to the actual heartbeat had an RMSE of 0.0471, R2 of 0.7153, and an MBE of −0.0204.

Figure 3.

Figure 3

Cost evolution for each evaluation of the fitness function.

These results show that the proposed model could represent an ECG signal. However, the algorithm needed to be evaluated with more patients to determine the range of parameters in which a healthy ECG signal can be generated by our model. Therefore, we ran the algorithm for each of the 90 patients in the database, and the same procedure as shown in Algorithm 1 was executed, where a set of random solutions were proposed for each patient. Subsequently, the performance of each random solution was evaluated with Equation (14). The best solutions had a crossover and mutation stage, and, finally, a new selection of the best solutions was made. This procedure was repeated until the number of proposed iterations in Table 1 was completed. Once the algorithm had been executed for a heartbeat per patient, a set of 90 vectors were obtained with coefficients that fit each patient’s ECG with the model wave. The mean in each parameter and their standard deviation were registered in Table 3. Additionally, we calculated statistical indicators for the 90 patients, obtaining the following average values: RMSE of 0.0543, R2 of 0.6913, and MBE of −0.0407.

Table 3.

Range of parameter values in transfer function model for healthy ECG signals.

Parameter i = 1 i = 2 i = 3
mean SD mean SD mean SD
r 0.0801 0.0395 0.28 0.32 0.43 0.27
a 0.093 0.19 −0.53 0.27 0.076 0.08
b 42.87 19.76 310.49 62.11 24.58 12.56
c 106.65 31.21 218.77 22.65 55.43 44.45
d 3.5 × 103 5.8 × 103 35.1 × 103 25.2 × 103 6.7 × 103 8.4 ×103
k 51.29 44.77 88.9 31.5 44.9 21.5

Although the algorithm performed correctly and the model could generate a heartbeat, a series of quasi-cyclic heartbeats determined the periodic nature of the ECG signal. Therefore, we added a frequency parameter f to (13). The normal frequency of a healthy adult at rest is 60–90 beats per minute (bpm). Therefore, for the parameters listed in Table 2, a frequency of 1.11 Hz was added. This parameter value resulted in a cardiac frequency of 66 bpm. The periodic behavior of the ECG with the model based on the transfer functions is shown in Figure 4.

Figure 4.

Figure 4

Response of the proposed model to a periodic impulse input.

Notably, the natural frequency of the model was regulated by a single parameter, thereby simplifying the adjustment of the heart rate. The primary goal of this study was to ensure that the model effectively controlled the signal dynamics, producing ECGs representative of common heart conditions. To achieve this, four typical heart problems were modeled: sinus tachycardia, atrial flutter, atrial flutter, and ventricular Flutter.

Sinus tachycardia is an elevation in heart rate, even when an individual is at rest. Although the normal value depends on factors such as age and physical activity, a value greater than 100 bpm in healthy adults at rest is indicative of tachycardia. Therefore, a higher frequency is required for this type of pathology. To achieve this, we configured f at 2 Hz, resulting in a heart rate of 120 bpm, as shown in Figure 5.

Figure 5.

Figure 5

Synus Tachycardia signal obtained with the proposed model, with an input frequency of 2 Hz.

The other arrhythmias considered in this work imply changes in the waveform, so the system parameters were readjusted to reproduce them. By employing the same methodology based on a GA, we determined the correct combination of parameters to produce ECG waveforms resembling cardiac arrhythmias. For this purpose, the public database MIT-BIH Arrhythmia Database was used, which is a set of more than 4000 long-term Holter records that were obtained by the Arrhythmia Laboratory of Beth Hospital [32,33].

This database contains 48 records with a duration of 30 min, corresponding to 25 men between 32 and 89 years old and 22 women between 23 and 89 years old. These records were selected to include a variety of rare but clinically essential phenomena that a small random sample would not represent well.

Signals were bandpass-filtered and digitized at 360 Hz using hardware built at the MIT Biomedical Engineering Center and BIH Biomedical Engineering Laboratory. The signals had a resolution of 11 bits in the range of ±5 mV. Therefore, the sample values ranged between 0 and 2047, where zero volts correspond to 1024.

After proper parameter adjustment, our model could reproduce atrial flutter, which indicates an abnormal heart rhythm that begins in the atrial chambers of the heart. It is generally associated with a rapid heart rate and is classified as supraventricular tachycardia. Atrial flutter is characterized by a frequency between 220 and 350 bpm. The rhythm can be regular, but P waves do not appear and are replaced by flutter (F) waves, which are more similar to sawtooth or triangular waves. A complex QRS usually lasts no more than 0.12 s. This type of pathology could be reproduced by the proposed model with the parameters listed in Table 4, and the resulting wave is shown in Figure 6.

Table 4.

Coefficients in the transfer function Model (13) used to generate an atrial flutter signal.

Parameter i = 1 i = 2 i = 3
r 0.0001 0.23 0.34
a −0.03 −0.1 −0.006
b 49.84 501.04 58.34
c 79.81 100.56 44.33
d 1.02 × 103 2.98 × 103 0.5 × 103
f 2.118
k 99.98 101.34 0.009

Figure 6.

Figure 6

Atrial flutter signal obtained with the proposed model with parameter values given in Table 4.

Additionally, our model can generate ventricular tachycardia, which is characterized by atypical electrical signals in the ventricles, which can last a few seconds or longer. When ventricular tachycardia occurs, the heart beats faster than 100 bpm. A disorderly heartbeat prevents the chambers of the heart from adequately filling with blood. Consequently, the heart may be incapable of pumping sufficient blood. The parameters listed in Table 5 were used to simulate this arrhythmia. The resulting ECG is shown in Figure 7.

Table 5.

Coefficients of the proposed model to generate a ventricular tachycardia signal.

Parameter i = 1 i = 2 i = 3
r 0.15 0.53 1.07
a 0.004 −14.23 −5.8
b 119.82 148.36 0.007
c 31.5 14.65 22.41
d 401.12 102.34 10.65
f 0.92
k 80.01 49.80 89.78

Figure 7.

Figure 7

Ventricular tachycardia signal obtained with the proposed model with parameter values given in Table 5.

The model was also tested to reproduce ventricular flutter waveforms. Ventricular flutter is a severe ventricular arrhythmia (originates in the lower chambers of the heart or ventricles). It manifests as rapid heart contractions exceeding 200 bpm. In the ECG recordings, a continuous sinusoidal pattern devoid of QRS complexes or T waves emerges. Utilizing the parameter values in Table 6, the model generated a ventricular flutter signal, as depicted in Figure 8.

Table 6.

Coefficients of the proposed model to generate a ventricular tachycardia signal.

Parameter i = 1 i = 2 i = 3
r 0.00095 0.068 0.2
a 0 0 0
b 10.2 9.78 10.02
c 23.02 22.91 22.97
d 300.12 299.88 300.09
f 4.01
k 500.11 599.11 149.34

Figure 8.

Figure 8

Ventricular flutter signal obtained with the proposed model with the parameters given in Table 6.

Thus far, we have shown that the model is capable of representing heartbeats, healthy electrocardiogram signals, and ECG signals for different diseased hearts.

Finally, it was adequate to compare the proposed model with other models with the same aim of generating ECG signals. This comparison is presented in Table 7.

Table 7.

Comparison of the proposed model with some other models with similar purposes.

Model Reference Number of Equations Number of Parameters Linearity Parameter Adjustment
Proposed here - 3 (transfer functions) 19 Yes CGA
Discretized reaction–diffusion [24] 4 (differential equations) 9 No Manual
Heterogeneous nonlinear oscillators [22] 4 (differential equations) 48 No Manual
Ring of three coupled oscillators [21] 6 (differential equations) 34 No Manual
Model based on a quasiperiodic motion [25] 5 (differential equations) 19 No Manual
Periodically kicked network of RLC oscillators [27] 4 (differential equations) 8 Yes Manual

From the comparison given in Table 7, we can conclude that the proposed model is linear and has a number of parameters similar to the model based on quasiperiodic motion [25], but the main advantage is the control of variables with parameter variations, which are determined by means of a GA, and no manual tuning is required. Each model may have advantages or disadvantages depending on the application and precision required.

5. Conclusions

In this study, we presented a mathematical model based on transfer functions to reproduce the electrical activity of the heart at the macroscopic level through ECG signals. Our model comprises a set of three transfer functions coupled with time delays with parameters adjusted via a GA. By fine-tuning the parameters with clinical ECG records as reference signals, we generated waveforms that resembled real ECG registers, with a root mean square error of 4.7% and an R2 value of 0.72. The simplicity of our model allows for easy adjustment of the waveform parameters, enabling the generation of both normal and arrhythmic signals. Despite its linear nature, the ability of our model to reproduce specific heartbeats makes it a valuable tool for assessing and testing ECG-monitoring equipment.

Compared to existing models, our approach closely aligns with periodically kicked RLC oscillator models, but with a simpler trigonometric function-based approach. Unlike the manual adjustment in most of the existing models, our method offers a systematic approach for automatically tuning parameters through a GA. However, it is worth mentioning that the linear representation of the model makes it impossible to capture the nonlinear complexities of cardiac electrical activity. Nonetheless, the structured nature of our transfer functions holds potential for future arrhythmia control initiatives.

In future work, generalization to include multi-lead ECGs and the representation of bundle branch blocks and ischemia, such as ST elevation, present exciting avenues for research. Additionally, exploring ECG classification through parametric estimation using AI-based multidimensional classifiers offers further opportunities for advancement in this field.

Acknowledgments

This work was supported by Consejo Nacional de Humanidades, Ciencias y Tecnologías (CONAHCyT) of Mexico under Grant CF-2023-I-1496. O.R.A would like to thank the support of Dirección General de Asuntos del Personal Académico (DGAPA)-National Autonomous University of Mexico (UNAM) by the postdoctoral fellowship DGAPA-UNAM. MAQJ would like to thank the support from DGAPA-UNAM under Project UNAM-PAPIIT TA101023.

Author Contributions

Conceptualization, O.R.-A., J.L.A. and M.A.Q.-J.; methodology, O.R.-A., J.L.A., M.A.Q.-J. and M.C.-F.; software, O.R.-A., C.F.-S. and M.C.-F.; validation, O.R.-A., M.A.Q.-J. and M.C.-F.; formal analysis, O.R.-A., J.L.A. and M.A.Q.-J.; investigation, O.R.-A., J.L.A. and M.C.-F.; resources, O.R.-A., J.L.A. and M.A.Q.-J.; data curation, O.R.-A., C.F.-S. and M.C.-F.; writing—original draft preparation, O.R.-A., J.L.A. and M.C.-F.; writing—review and editing, O.R.-A., J.L.A. and M.C.-F.; visualization, O.R.-A., C.F.-S. and M.C.-F.; supervision, O.R.-A., M.A.Q.-J. and J.L.A.; project administration, O.R.-A., J.L.A. and M.C.-F.; funding acquisition, O.R.-A., C.F.-S. and M.C.-F. All authors have read and agreed to the published version of the manuscript.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The database for healthy ECGs (ECG-ID database) is available at https://physionet.org/content/ecgiddb/1.0.0/ (accessed on 1 April 2024) and MIT-BIH Arrhythmia Database is available at: https://www.physionet.org/content/mitdb/1.0.0/ (accessed on 1 April 2024).

Conflicts of Interest

The authors declare no conflicts of interest.

Funding Statement

This work was Funding by Consejo Nacional de Humanidades, Ciencias y Tecnologías (CONAHCyT) of Mexico under Grant CF-2023-I-1496 and Dirección General de Asuntos del Personal Académico (DGAPA)-National Autonomous University of Mexico (UNAM) under Project UNAMPAPIIT TA101023 and the postdoctoral fellowship DGAPA-UNAM for O.R.A.

Footnotes

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

References

  • 1.Motta S., Pappalardo F. Mathematical modeling of biological systems. Briefings Bioinform. 2012;14:411–422. doi: 10.1093/bib/bbs061. [DOI] [PubMed] [Google Scholar]
  • 2.Michail M., Brown A.J. Physiology of the normal heart. Medicine. 2018;46:427–430. doi: 10.1016/j.mpmed.2018.05.001. [DOI] [Google Scholar]
  • 3.Silvani A., Calandra-Buonaura G., Dampney R.A.L., Cortelli P. Brain–heart interactions: Physiology and clinical implications. Philos. Trans. R. Soc. A Math. Phys. Eng. Sci. 2016;374:20150181. doi: 10.1098/rsta.2015.0181. [DOI] [PubMed] [Google Scholar]
  • 4.Nowbar A.N., Gitto M., Howard J.P., Francis D.P., Al-Lamee R. Mortality From Ischemic Heart Disease. Circ. Cardiovasc. Qual Outcomes. 2019;12:e005375. doi: 10.1161/CIRCOUTCOMES.118.005375. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 5.Kaplan Berkaya S., Uysal A.K., Sora Gunal E., Ergin S., Gunal S., Gulmezoglu M.B. A survey on ECG analysis. Biomed. Signal Process. Control. 2018;43:216–235. doi: 10.1016/j.bspc.2018.03.003. [DOI] [Google Scholar]
  • 6.Keener J., Sneyd J., editors. Mathematical Physiology: II: Systems Physiology. Springer; New York, NY, USA: 2009. The Heart; pp. 523–626. [DOI] [Google Scholar]
  • 7.Liu X., Wang H., Li Z., Qin L. Deep learning in ECG diagnosis: A review. Knowl.-Based Syst. 2021;227:107187. doi: 10.1016/j.knosys.2021.107187. [DOI] [Google Scholar]
  • 8.Houssein E.H., Kilany M., Hassanien A.E. ECG signals classification: A review. Int. J. Intell. Eng. Inform. 2017;5:376–396. doi: 10.1504/IJIEI.2017.087944. [DOI] [Google Scholar]
  • 9.Prusty M.R., Pandey T.N., Lekha P.S., Lellapalli G., Gupta A. Scalar invariant transform based deep learning framework for detecting heart failures using ECG signals. Sci. Rep. 2024;14:2633. doi: 10.1038/s41598-024-53107-y. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 10.Alonso S., dos Santos R.W. Cardiovascular Computing—Methodologies and Clinical Applications. Springer; Singapore: 2019. Modelling the Electrical Activity of the Heart; pp. 211–229. [DOI] [Google Scholar]
  • 11.Peirlinck M., Costabal F.S., Yao J., Guccione J.M., Tripathy S., Wang Y., Ozturk D., Segars P., Morrison T.M., Levine S., et al. Precision medicine in human heart modeling. Biomech. Model. Mechanobiol. 2021;20:803–831. doi: 10.1007/s10237-021-01421-z. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 12.Jæger K.H., Tveito A. Deriving the Bidomain Model of Cardiac Electrophysiology from a Cell-Based Model; Properties and Comparisons. Front. Physiol. 2022;12:811029. doi: 10.3389/fphys.2021.811029. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 13.Trudel M.C., Dube B., Potse M., Gulrajani R., Leon L. Simulation of QRST integral maps with a membrane-based computer heart model employing parallel processing. IEEE Trans. Biomed. Eng. 2004;51:1319–1329. doi: 10.1109/TBME.2004.827934. [DOI] [PubMed] [Google Scholar]
  • 14.Barrio R.A., Dominguez-Roman I., Quiroz-Juarez M.A., Jimenez-Ramirez O., Vazquez-Medina R., Aragon J.L. Mathematical Biology and Biological Physics. Springer; Singapore: 2019. Modelling the electrical activity of the heart; pp. 51–59. [DOI] [Google Scholar]
  • 15.Quiroz-Juárez M.A., Rosales-Juárez J.A., Jiménez-Ramírez O., Vázquez-Medina R., Aragón J.L. ECG Patient Simulator Based on Mathematical Models. Sensors. 2022;22:5714. doi: 10.3390/s22155714. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 16.Montoya-Santiyanes L.A., Chay-Canul A.J., Camacho-Pérez E., Rodríguez-Abreo O. A novel model for estimating the body weight of Pelibuey sheep through Gray Wolf Optimizer algorithm. J. Appl. Anim. Res. 2022;50:635–642. doi: 10.1080/09712119.2022.2123812. [DOI] [Google Scholar]
  • 17.Ogata K. Modern control engineering. Book Rev. 1999;35:1184. doi: 10.1115/1.3426465. [DOI] [Google Scholar]
  • 18.Kuo B.C. Automatic Control Systems. Prentice Hall PTR; Upper Saddle River, NJ, USA: 1987. [Google Scholar]
  • 19.Hampton J., Hampton J. The ECG Made Easy E-Book. Elsevier Health Sciences; Edinburgh, UK: 2019. [Google Scholar]
  • 20.Bueno-Orovio A., Britton O., Muszkiewicz A., Rodriguez B. Cardiac Modeling. In: Bradshaw R.A., Stahl P.D., editors. Encyclopedia of Cell Biology. Academic Press; Waltham, MA, USA: 2016. pp. 86–94. [DOI] [Google Scholar]
  • 21.Gois S.R., Savi M.A. An analysis of heart rhythm dynamics using a three-coupled oscillator model. Chaos Solitons Fractals. 2009;41:2553–2565. doi: 10.1016/j.chaos.2008.09.040. [DOI] [Google Scholar]
  • 22.Ryzhii E., Ryzhii M. A heterogeneous coupled oscillator model for simulation of ECG signals. Comput. Methods Programs Biomed. 2014;117:40–49. doi: 10.1016/j.cmpb.2014.04.009. [DOI] [PubMed] [Google Scholar]
  • 23.Quiroz-Juárez M., Vázquez-Medina R., Ryzhii E., Ryzhii M., Aragón J. Quasiperiodicity route to chaos in cardiac conduction model. Commun. Nonlinear Sci. Numer. Simul. 2017;42:370–378. doi: 10.1016/j.cnsns.2016.06.007. [DOI] [Google Scholar]
  • 24.Quiroz-Juárez M.A., Jiménez-Ramírez O., Vázquez-Medina R., Breña-Medina V., Aragón J.L., Barrio R.A. Generation of ECG signals from a reaction-diffusion model spatially discretized. Sci. Rep. 2019;9:19000. doi: 10.1038/s41598-019-55448-5. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 25.McSharry P., Clifford G., Tarassenko L., Smith L. A dynamical model for generating synthetic electrocardiogram signals. IEEE Trans. Biomed. Eng. 2003;50:289–294. doi: 10.1109/TBME.2003.808805. [DOI] [PubMed] [Google Scholar]
  • 26.Sayadi O., Shamsollahi M.B., Clifford G.D. Synthetic ECG generation and Bayesian filtering using a Gaussian wave-based dynamical model. Physiol. Meas. 2010;31:1309. doi: 10.1088/0967-3334/31/10/002. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 27.Quiroz-Juárez M., Jiménez-Ramírez O., Aragón J., Del Río-Correa J., Vázquez-Medina R. Periodically kicked network of RLC oscillators to produce ECG signals. Comput. Biol. Med. 2019;104:87–96. doi: 10.1016/j.compbiomed.2018.05.017. [DOI] [PubMed] [Google Scholar]
  • 28.Taff L. Expanding the scientific role of the hubble space telescope fine guidance sensors. Adv. Space Res. 1991;11:97–102. doi: 10.1016/0273-1177(91)90476-Z. [DOI] [Google Scholar]
  • 29.Agrawal P., Abutarboush H.F., Ganesh T., Mohamed A.W. Metaheuristic Algorithms on Feature Selection: A Survey of One Decade of Research (2009–2019) IEEE Access. 2021;9:26766–26791. doi: 10.1109/ACCESS.2021.3056407. [DOI] [Google Scholar]
  • 30.Bhoskar M.T., Kulkarni M.O.K., Kulkarni M.N.K., Patekar M.S.L., Kakandikar G., Nandedkar V. Genetic Algorithm and its Applications to Mechanical Engineering: A Review. Mater. Today Proc. 2015;2:2624–2630. doi: 10.1016/j.matpr.2015.07.219. [DOI] [Google Scholar]
  • 31.Lugovaya T.S. Ph.D. Thesis. Faculty of Computing Technologies and Informatics, Electrotechnical University “LETI”; Saint-Petersburg, Russia: 2005. Biometric Human Identification Based on Electrocardiogram. [Google Scholar]
  • 32.Goldberger A., Amaral L., Glass L., Hausdorff J., Ivanov P., Mark R., Stanley H., PhysioBank P. PhysioNet: PhysioBank, PhysioToolkit, and PhysioNet: Components of a new research resource for complex physiologic signals Components of a new research resource for complex physiologic signals. Circulation. 2000;101:e215–e220. doi: 10.1161/01.CIR.101.23.e215. [DOI] [PubMed] [Google Scholar]
  • 33.Moody G., Mark R. The impact of the MIT-BIH Arrhythmia Database. IEEE Eng. Med. Biol. Mag. 2001;20:45–50. doi: 10.1109/51.932724. [DOI] [PubMed] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Data Availability Statement

The database for healthy ECGs (ECG-ID database) is available at https://physionet.org/content/ecgiddb/1.0.0/ (accessed on 1 April 2024) and MIT-BIH Arrhythmia Database is available at: https://www.physionet.org/content/mitdb/1.0.0/ (accessed on 1 April 2024).


Articles from Biomimetics are provided here courtesy of Multidisciplinary Digital Publishing Institute (MDPI)

RESOURCES