## 2 Materials and Methods
### Synthetic ECG Generation and Modification  
The normal ECG consists of a typical pattern of waves and segments. The initial small, positive deflection is called the P wave, which represents atrial depolarization, typically lasting no more than 0.1-0.11 s. Deviations in presence, shape, and duration of the P wave might be indicators of pathologies of either the sinus node, the primary intrinsic cardiac pacemaker, or the atrial conduction system. Following the P wave, the ECG trace then returns to the isoelectric baseline (PR segment) before continuing with a short and small negative deflection (Q wave), followed by a sharp positive deflection (R wave), eventually followed by a final negative deflection (S wave). This so-called QRS complex reflects the depolarization of the ventricles. Duration of the QRS complex is defined as the time interval between the beginning of the Q wave and the end of the S wave, and its duration under normal and physiologic conditions is <0.12 s. A prolonged or deformed QRS complex is an indicator of pathologies of the intraventricular electrical conduction system due to ischemia, inflammation, or degenerative processes. Immediately after ventricular depolarization, the ECG trace remains isoelectric (ST segment), before changing its vector to a final positive deflection, the T wave, representing fast ventricular repolarization. Deviations in shape, height, or vector of deflection are indicators of different cardiac pathologies (e.g., negative T waves in myocardial ischemia or positive peaked T waves in hyperkalemia).  
The standardized McSharry algorithm was used to generate a realistic synthetic ECG trace [15]. This algorithm reflects a data-driven approach to modeling the heart's electrical activity by generating a trajectory in a three-dimensional space. Distinct points of the ECG trace, such as the P, Q, R, S, and T waves, are described by events corresponding to negative and positive attractors/repellers in the direction [15]. Using this algorithm, one single ECG beat with a sampling frequency of 256 Hz was generated as a baseline for all further analyses.  
Based on the original publication by [PERSON] et al., the dynamical equations of motion are defined by three different equations [15]:  
\[\dot{x} =\alpha x-\omega y\] \[\dot{y} =\alpha y+\omega x\] \[\dot{z} =-\sum_{i\in\{P,Q,R,S,T\}}a_{i}\Delta\theta_{i}\text{exp}\left(- \frac{\Delta\theta_{i}^{2}}{2b_{i}^{2}}\right)-(z-z_{0})\]  
where \(\alpha=1-\sqrt{x^{2}+y^{2}}\), \(\Delta\theta_{i}=(\theta-\theta_{i})\text{mod}2\pi\), \(\theta=\text{atan}2(y,x)\) (the four-quadrant arctangent of the real parts of the elements of \(x\) and \(y\), with \(-\pi\leq\text{atan}2(y,x)\leq\pi\)), and \(\omega\), as its moving around the limit cycle, is defined as the angular velocity of trajectory.  
Additionally, as mentioned by [PERSON] et al. [15], a numerical integration was added to the abovementioned algorithm using a fourth-order Runge-Kutta method at a fixed time step [16].  
In a second step, further ECG beats were generated with an increase in the P, Q, R, S, and T wave amplitudes by 0.01, 0.02, 0.03, 0.04, 0.05, and 0.06 mV, respectively. The magnitude of these changes is so small that none can be detected easily by a cursory visual analysis of the signal, especially in noisy signals. Subsequently, to simulate the typical noise of a clinical ECG trace, each of these 30 distinctive ECG beats (6 different amplitudes for each wave) was duplicated 100 times with an identical jitter (0.1 mV, 0.2 mV, 0.3 mV, respectively), resulting in three sets of 100 beats of identical features but different individual shapes for each of the 30 distinctive ECG signals. Finally, after variation of relevant features of the ECG beats and deconstruction of the initial synthetic ECG, each of the 30 groups of similar ECG beats underwent classification against the beats of the baseline ECG trace. In total, 3100 ECG beats were analyzed in this way.