Synthetic P-QRS-T waveforms · Arrhythmia presets · Heart rate control
This simulator generates synthetic 12-lead ECG traces by modelling the cardiac cycle as a sequence of Gaussian-shaped waveform components: the P wave (atrial depolarisation), QRS complex (ventricular depolarisation) and T wave (ventricular repolarisation). Each lead views the heart from a different electrical angle, producing the characteristic morphology used by clinicians to diagnose arrhythmias, ischaemia and conduction abnormalities.
Willem Einthoven invented the string galvanometer in 1903 and recorded the first clinical ECG. He won the Nobel Prize in 1924. The standard 12-lead system uses only 10 electrodes placed on the limbs and chest — the remaining leads are mathematically derived. A single ECG costs just a few dollars yet remains one of the most powerful diagnostic tools in medicine, capable of revealing heart attacks, arrhythmias and even electrolyte disorders within seconds.
This tool synthesises a six-lead electrocardiogram in real time, building each cardiac cycle from overlapping Gaussian pulses that stand in for the P wave, the Q-R-S deflections and the T wave. Every lead projects that beat onto its own electrical axis using a cosine weighting, so the same underlying event looks different in Lead II, aVR or V1. Adjustable rate, wave amplitudes and noise let you watch how morphology and timing intervals respond.
Each heartbeat is a sum of Gaussian curves: a P wave near phase 0.12, a Q-R-S triple at phase 0.28-0.34 and a T wave at phase 0.55. Lead output is that beat multiplied by cos(angle − 60°), with V1 inverting the QRS. Samples stream at 250 Hz into a scrolling buffer drawn on a green ECG-style grid.
Pick a rhythm preset (Normal Sinus, Sinus Tachy/Brady, A-Fib, V-Fib, V-Tach). Sliders set Heart Rate (30-200 bpm), P, QRS and T wave amplitudes, and Noise level. The Vitals panel reports derived HR, PR, QRS, QT and rhythm. Pause freezes the sweep; Reset clears the buffers and restores Normal Sinus.
The standard clinical 12-lead ECG uses only 10 electrodes — the six limb leads are mathematically derived from three measured potentials, which is why this model can synthesise many lead views from a single beat function.
It produces synthetic electrocardiogram traces, not recordings from a real patient. Each beat is assembled from mathematical Gaussian pulses representing atrial depolarisation (P wave), ventricular depolarisation (QRS complex) and ventricular repolarisation (T wave), then displayed across six lead views.
A single cardiac cycle runs over a normalised phase from 0 to 1. The model places Gaussian curves at fixed phases — P at 0.12, Q/R/S around 0.28 to 0.34, and T at 0.55 — and sums them. Each lead then scales the result by cos(angle − 60°) to mimic projection onto that lead axis, with V1 flipping the QRS polarity.
Heart Rate sets the RR interval between beats. The P, QRS and T amplitude sliders change the height of each wave component, and Noise adds random jitter to mimic electrode artefacts. Presets load typical values for rhythms such as tachycardia, bradycardia, atrial fibrillation and ventricular fibrillation, with A-Fib also randomising the RR interval.
The numbers are illustrative rather than diagnostic. PR is scaled from a 160 ms baseline by heart rate, QRS is fixed at 90 ms (140 ms for V-Tach), and the QT figure is rate-corrected with a Bazett-style square-root of the RR interval. They show the right trends but are simplified for teaching, not measurement.
In a real heart, each lead records the same electrical event from a different angle, so the projected voltage differs. Here that is reproduced by the cosine weighting on each lead axis, which can shrink, enlarge or invert the visible deflection — for example V1 shows an inverted QRS — even though every lead derives from one shared beat function.
This interactive ECG simulator models the electrical activity of the human heart by generating synthetic 12-lead electrocardiogram traces in real time. The simulation constructs each cardiac cycle from overlapping Gaussian pulses representing the P wave (atrial depolarisation), QRS complex (ventricular depolarisation), and T wave (ventricular repolarisation), then projects each beat onto six standard lead axes using cosine weighting to replicate how different electrode positions record the same underlying event. Users can observe how heart rate, waveform amplitudes, and noise affect ECG morphology, and explore common arrhythmias including atrial fibrillation and ventricular fibrillation.
Electrocardiography has been a cornerstone of clinical cardiology since Willem Einthoven recorded the first practical ECG in 1903. Today, 12-lead ECG interpretation is taught in every medical school and used billions of times annually worldwide to diagnose heart attacks, conduction abnormalities, and life-threatening arrhythmias within seconds.
An electrocardiogram is a graphical record of the electrical voltages generated by the heart with each beat, captured by electrodes placed on the skin. The characteristic P-QRS-T waveform reflects the orderly spread of electrical depolarisation through the atria and ventricles followed by ventricular repolarisation. Clinicians use the timing, amplitude, and shape of these waves to detect arrhythmias, heart attacks, and structural abnormalities.
Select a Rhythm Preset — Normal Sinus, Sinus Tachycardia, Sinus Bradycardia, Atrial Fibrillation, Ventricular Fibrillation, or Ventricular Tachycardia — to load clinically typical parameters. Use the Heart Rate slider (30–200 bpm) to change the RR interval, and the P, QRS, T amplitude sliders to simulate conditions such as hypertrophy or electrolyte disturbances. The Noise slider adds electrode artefact, and the Vitals panel reports derived PR, QRS, and QT intervals in real time.
In normal sinus rhythm at 60–100 bpm, the PR interval is 120–200 ms, the QRS duration is 70–100 ms, and the corrected QT interval (QTc) is under 440 ms in men and 460 ms in women. This simulator targets a PR of 160 ms and QRS of 90 ms at 72 bpm for the Normal Sinus preset, and adjusts the QT with a Bazett-style rate correction, giving a representative picture of typical values used in teaching.
The standard 12-lead ECG uses four limb electrodes (RA, LA, RL, LL) and six precordial chest electrodes (V1–V6). From the three independent limb potentials, six limb leads are derived mathematically: Leads I, II, and III form Einthoven's triangle, while aVR, aVL, and aVF are augmented unipolar leads obtained by inverting the average of the other two limb electrodes. This means all 12 leads share the same underlying electrical event — they simply project it onto different spatial axes, which is why this simulator can reproduce six lead views from a single beat function multiplied by cos(lead angle).
In atrial fibrillation (A-Fib), the organised electrical activation of the atria breaks down into chaotic, rapid firing from multiple micro-reentry circuits. On the ECG this abolishes the discrete P wave and replaces it with a fine fibrillatory baseline. The AV node receives impulses irregularly, producing a characteristically irregular ventricular rhythm — the hallmark diagnostic feature. The simulation reproduces this by randomising the RR interval and replacing the P wave with small random noise, generating the irregular pattern visible in the A-Fib preset.
These are related but distinct devices. A standard 12-lead ECG captures a brief 10-second snapshot using all 12 lead views and is used for immediate diagnosis. A cardiac monitor (bedside or telemetry) continuously displays one or two leads and alerts clinicians to arrhythmias in real time. A Holter monitor records a continuous 24–48-hour ECG on a wearable device to capture intermittent arrhythmias that would not appear on a short resting ECG. All use the same underlying electrode principle, but differ in duration, lead count, and clinical purpose.
The Dutch physiologist Willem Einthoven developed the string galvanometer in 1901–1903, which was sensitive enough to record the tiny voltages produced by the heart. He published the first systematic description of normal and abnormal ECG waveforms and introduced the P-Q-R-S-T letter notation still used today. Einthoven also defined Einthoven's triangle describing the geometry of the three limb leads. He was awarded the Nobel Prize in Physiology or Medicine in 1924 for this work, which laid the entire foundation of clinical electrocardiography.
In ST-elevation myocardial infarction (STEMI), the classic ECG finding is a raised ST segment in the leads facing the affected territory of the heart, indicating ongoing myocardial injury from complete coronary artery occlusion. Reciprocal ST depression appears in opposite leads. As the infarct evolves over hours, the T waves invert and pathological Q waves develop, marking permanent myocardial necrosis. Emergency guidelines worldwide mandate that a STEMI diagnosis on ECG triggers immediate reperfusion therapy — either thrombolysis or primary percutaneous coronary intervention — within minutes, making the 12-lead ECG a true life-saving diagnostic tool.
This ECG simulator pairs naturally with the MRI / NMR Physics simulation, which models nuclear magnetic resonance in tissue — the physics behind cardiac MRI used to assess myocardial structure and function. The Lung Mechanics simulation covers pulmonary physiology, which is closely linked to cardiac physiology in conditions such as heart failure and pulmonary hypertension. For a deeper mathematical context, the on-site article on Mathematical ECG and Heart Models discusses how Gaussian-based and differential-equation models (such as the van der Pol oscillator and the FitzHugh-Nagumo model) are used to simulate cardiac electrical activity at higher fidelity than this interactive demonstration.
Deep learning models trained on millions of ECG recordings can now detect atrial fibrillation, predict left ventricular dysfunction, identify early-stage cardiomyopathy, and even estimate a patient's biological age and sex from raw waveform data — all from a standard 12-lead ECG acquired in 10 seconds. FDA-cleared AI ECG tools are already deployed in hospitals and wearable devices such as the Apple Watch, which records a single-lead ECG on the wrist. Current research frontiers include using ECG-derived AI to screen for structural heart disease before symptoms appear and integrating ECG signals with genomic and imaging data for precision cardiology.