❤️ Heart Rhythm — Cardiac Action Potential
Simulate cardiac pacing via FitzHugh-Nagumo excitable medium on a 2D grid. SA node fires, signal propagates through atria, AV delay, then ventricular depolarisation with a live ECG-like trace. Adjust pacing rate, conduction velocity, and refractoriness.
About this simulator
This simulation models the electrical activity of the human heart using the FitzHugh-Nagumo (FHN) equations, a canonical model of excitable media. The heart is represented as a 2D grid divided into anatomical zones: SA node (upper right), atria, an AV node barrier with configurable delay, and ventricles. Each cell obeys
dv/dt = v(v−a)(1−v) − w + I + D·∇²v and dw/dt = ε(v − γw),
where v is the fast membrane voltage variable, w is the slow recovery (refractory) variable, D is the diffusion coefficient controlling conduction velocity, and ε governs refractoriness. The SA node is driven by a periodic current I at the user-selected pacing rate. The impulse travels through the atria, pauses at the AV barrier, then spreads through the ventricular mass via faster conduction analogous to the His-Purkinje system.
The ECG-like trace below the grid is generated by spatially integrating the activator variable over atrial cells (producing the P wave), then over ventricular cells (producing the QRS complex and T wave). This approximates the body-surface potential in a single lead. You can explore clinically relevant rhythms using the preset buttons: reducing refractoriness allows re-entrant spiral waves analogous to atrial flutter; further reducing it with low conduction velocity generates multiple chaotic wavelets resembling fibrillation. Increasing the AV delay above 300 ms mimics a third-degree AV block, decoupling atrial and ventricular rhythms entirely.
FitzHugh-Nagumo excitable medium models cardiac pacing, conduction and an ECG-like trace.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install