This interactive simulation builds intuition for excitability, limit cycles, and refractory periods using the FitzHugh–Nagumo (FHN) two-variable neuron model. The FHN model reduces the full Hodgkin–Huxley dynamics to a fast variable v (membrane potential–like) and a slow recovery variable w.
Math behind the Simulation
1. Model equations
dv/dt = v − v³/3 − w + I
dw/dt = ε(v + a − b w)
v: membrane potential–like (fast). w: recovery variable (slow). I: external input current. ε: time-scale separation (w evolves slowly when ε is small). a, b: parameters that control the nullcline shapes and fixed-point location.
2. Nullclines
V-nullcline (dv/dt = 0): w = v − v³/3 + I. Cubic in v; it moves vertically as I changes.
W-nullcline (dw/dt = 0): w = (v + a)/b. Straight line.
The intersection is the fixed point. For subthreshold I it is stable; beyond a threshold, the system can spike (excitability) or enter a limit cycle (tonic spiking).
3. Excitability and refractoriness
A short pulse can push the state across the cubic’s “knee”; the trajectory makes a large excursion (spike) then returns via the slow branch (refractory period). A second pulse during refractoriness may fail to elicit a spike. With constant suprathreshold I, the fixed point loses stability and the system oscillates (limit cycle).
4. Integration
The simulation uses RK4 (Runge–Kutta 4th order) with step size smaller than the display frame rate; multiple physics steps are performed per animation frame.
Usage
Follow these steps to explore the FitzHugh–Nagumo model:
- Phase plane (left): Axes are v and w. The blue curve is the V-nullcline (w = v − v³/3 + I); it shifts vertically when you change I. The orange line is the W-nullcline. The cyan dot is the current state; the faint trail shows the trajectory. When v > 1, the panel border flashes (spike).
- Time series (right): Cyan = v, orange = w. The bottom subplot shows input I vs time. Use a rolling time window.
- Controls: Adjust I, ε, a, b via sliders. Choose Stimulus mode (Constant, Pulse, Sine, Noise). Run/Stop toggles the simulation; Step Fwd / Step Bwd advance or undo one step when stopped. Reset restores initial state and clears history. Use the Preset dropdown and Apply to load a preset; Apply injects the same impulse even during run.
- Presets:
- Sub-threshold: Small pulse. The trajectory makes a small loop but does not cross the cubic “knee”; no spike.
- Action potential: Larger pulse. The state crosses the knee, spikes, and returns along the slow branch (refractory).
- Tonic spiking: Constant I. The fixed point is unstable; the system enters a limit cycle and oscillates.
- Refractory fail: Two pulses close together. The first causes a spike; the second arrives during refractoriness and fails to spike.
Tips: Compare sub-threshold vs action-potential pulses in the phase plane to see the “knee” crossing. Use tonic spiking to observe the limit cycle. Try varying ε to see how slower w affects the shape of the spike and the refractory period.
Parameters
- I: External input current. Range −0.5 to 1.5 (default 0).
- ε: Time-scale separation (slow/fast). 0.001–0.1 (default 0.08). Smaller ε makes w slower.
- a, b: Nullcline shape and fixed-point position. Defaults 0.7 and 0.8.
- Stimulus: Constant I; Pulse (configurable via presets); Sine; Noise.
Interpreting the FHN Model
Interpreting the FitzHugh–Nagumo (FHN) model is all about understanding the "dance" between two variables: one that wants to move fast (Voltage) and one that reacts slowly (Recovery).
Here is a guide to interpreting the visual output of your simulation, specifically focusing on the Phase Plane (the box on the left), which is the most powerful tool for understanding non-linear dynamics.
1. The Characters (Variables)
- v (The Fast Actor): This represents the membrane voltage. It wants to change instantly. In the plots, horizontal movement is v.
- w (The Slow Actor): This represents "recovery" (like potassium channels opening). It reacts sluggishly. In the plots, vertical movement is w.
2. The Landscape (Phase Plane)
The Phase Plane is a map of all possible states. The most important lines on this map are the Nullclines.
- The Blue Curve (V-Nullcline): The "Cubic" or "N-shaped" curve.
- Meaning: Everywhere along this line, the voltage v stops changing (dv/dt = 0).
- Interpretation: This curve defines the "terrain." The right branch is the "excited" state (high voltage); the left branch is the "resting" state (low voltage). The dip in the middle is the Threshold or "Knee."
- The Orange Line (W-Nullcline): The straight diagonal line.
- Meaning: Everywhere along this line, the recovery variable w stops changing (dw/dt = 0).
- The Intersection (Fixed Point):
- Where the two lines cross, the system stops moving completely.
- Stable: If the dot sits here comfortably, the neuron is "at rest."
- Unstable: If the lines cross in a way that pushes the dot away, the neuron will fire continuously (oscillate).
3. Reading the "Motions" (Trajectories)
When you run the simulation, you see a dot moving. Here is how to translate that movement into biological concepts:
A. Sub-threshold (The Failed Spark)
- Visual: The dot is nudged to the right but hits the "wall" of the blue curve's middle branch. It loops back to the start without making a big circle.
- Biology: A small stimulus depolarized the cell, but not enough to open the sodium channels fully. The cell returns to rest.
B. The Spike (Action Potential)
- Visual: The dot crosses the "Knee" of the blue curve. Suddenly, it has "clear air" to the right, so it shoots horizontally (fast!) to the right branch. This is the Upstroke.
- Refractory Period: Once on the right, the dot drifts upward (slowly) because w is catching up. Eventually, it falls off the top edge of the curve and shoots left (repolarization). It then hugs the bottom of the curve as it creeps back to the start.
- Biology: The cell fired. While it is creeping back along the bottom/left, it is "refractory"—it cannot fire again immediately because the slow recovery variable w is still suppressing it.
C. Limit Cycle (Tonic Spiking)
- Visual: The dot never settles. It traces a large, repeated loop around the phase plane.
- Biology: The input current I is high enough that the "resting state" is no longer stable. The neuron acts like a pacemaker, firing rhythmically.
4. Interpreting the Controls
Input (I): The Elevator
- Effect: Changing I moves the Blue Cubic curve vertically.
- Interpretation:
- Low I: The curve sits low. The intersection is on the stable left branch (Rest).
- High I: The curve lifts up. The intersection moves to the unstable middle section. The system begins to oscillate (fire continuously).
Epsilon (ε): The Speed Ratio
- Effect: Determines how slowly the dot moves vertically compared to horizontally.
- Interpretation:
- Small ε: The separation is extreme. The dot snaps horizontally (fast spike) and crawls vertically. This creates classic, sharp nerve spikes.
- Large ε: The dot moves diagonally and sluggishly. The "spike" looks more like a slow wave (like in some smooth muscle cells).
Summary Table
| Feature |
Phase Plane Visual |
Biological Meaning |
| Resting Potential | Intersection of lines on the left | Neuron is silent and waiting. |
| Threshold | The "Knee" (dip) of the blue curve | Point of no return; if crossed, a spike occurs. |
| Depolarization | Fast horizontal movement to the right | Sodium channels open; voltage spikes. |
| Refractory Period | Slow movement along the top/left branch | Potassium channels open; neuron resets and ignores input. |
| Oscillation | Continuous looping (Limit Cycle) | Pacemaker activity (repetitive firing). |
Interpreting the Time Series Plot
In the time sequence plot (the "Time Series" panel on the right), you are watching a race between a sprinter and a marathon runner. This plot unravels the "loops" you see in the Phase Plane into a linear timeline.
Here is how to interpret the interplay between the Blue Curve (v) and Orange Curve (w):
1. The Cast of Characters
- Blue Curve (v – Voltage): This is the Exciter. It represents the neuron's membrane potential. It is fast, reactive, and dramatic. It wants to jump up instantly when stimulated.
Biology: Think of this as Sodium (Na) channels opening.
- Orange Curve (w – Recovery): This is the Suppressor. It represents the recovery mechanism. It is slow, heavy, and persistent. Its job is to drag the Blue curve back down.
Biology: Think of this as Potassium (K) channels opening or Sodium channels inactivating.
2. The Play-by-Play of a Spike
When you trigger an Action Potential, watch the curves interact in this specific order:
Phase 1: The Head Start (Upstroke)
- What happens: The Blue curve shoots up almost vertically. The Orange curve barely moves at first.
- Why: The Blue variable (v) is "fast." It reacts immediately to the input. The Orange variable (w) has a high inertia (controlled by ε), so it lags behind.
- Visual: You see a sharp Blue peak while the Orange line is still flat or just starting to slope up.
Phase 2: The Chase (Peak & Reversal)
- What happens: The Blue curve hits its ceiling. Meanwhile, the Orange curve is finally rising steadily.
- The Interplay: As the Orange line gets higher, it exerts a negative force on the Blue line (remember the equation: dv/dt = … − w + …).
- Visual: The Blue curve starts to crash downward because the Orange curve has risen high enough to suppress it.
Phase 3: The Refractory Period (The Critical Lag)
- What happens: This is the most important part to observe. The Blue curve has crashed back down to the bottom (resting level or lower). However, the Orange curve is still high.
- The Interplay: The Orange curve is slow to rise, but also slow to fall. It is "stuck" in the high position for a while.
- Result: While the Orange line is hovering above the Blue line, the neuron cannot fire again. The high Orange value is actively suppressing any new attempts by the Blue curve to rise.
- Visual: You see the Blue line flat at the bottom, while the Orange line slowly glides back down like a parachute. This gap is the Refractory Period.
3. Visualizing "Tonic Spiking" (Oscillation)
If you increase the Input (I) until the system oscillates, the time plot changes from a single event to a continuous "Predator–Prey" cycle:
- Blue jumps up (escapes).
- Orange rises to catch it.
- Orange catches Blue and drags it down.
- Blue stays down until Orange falls low enough to release the pressure.
- Blue escapes again.
Summary Checklist
When watching the plot, verify the theory by looking for these features:
- The Lag: Does the Orange peak happen after the Blue peak? (It always should.)
- The Crossing: Notice that the Blue curve usually starts falling exactly when the Orange curve is getting strong.
- The Gap: Look at the time after the spike. If Orange is above Blue, the system is "tired" (refractory).