🧠 Neural Oscillators
Simulate brain oscillatory dynamics: delta, theta, alpha, gamma rhythms. Model coupled Kuramoto oscillators showing synchronisation, and E-I balanced networks producing gamma oscillations.
About Neural Oscillators
The Kuramoto Model
The Kuramoto model describes N coupled oscillators each with a natural frequency ωᵢ drawn from a distribution g(ω). Coupling K drives phases together: dθᵢ/dt = ωᵢ + K/N·Σsin(θⱼ−θᵢ). The order parameter r = |1/N·Σe^(iθⱼ)| measures synchrony: r≈0 is incoherent, r≈1 is fully synchronised. A phase transition occurs at the critical coupling K_c = 2/(πg(0)) — analogous to a magnetic phase transition.
Brain Rhythms
The brain generates characteristic oscillatory patterns measurable by EEG. Delta (1-4Hz) dominates deep sleep; theta (4-8Hz) appears during memory encoding and REM sleep; alpha (8-13Hz) reflects relaxed wakefulness; beta (13-30Hz) accompanies active thinking; gamma (30-80Hz) correlates with perception and consciousness. These rhythms emerge from synchronised neuronal populations — much like the Kuramoto model.
Gamma and E-I Balance
Gamma oscillations (30-80Hz) arise from a balance between excitatory (AMPA, NMDA) and inhibitory (GABA) synaptic currents. Fast-spiking interneurons provide precisely timed inhibition that paces excitatory cells into synchrony. This Excitatory-Inhibitory (E-I) balance is critical: too much excitation causes epileptic seizures; too much inhibition suppresses all activity. Disruption of gamma is implicated in schizophrenia and Alzheimer's disease.
About this simulation
This simulation shows how a population of Kuramoto oscillators — each with its own natural frequency — spontaneously lock into a shared rhythm as the coupling strength between them increases. It is the same synchronisation mechanism believed to underlie brain rhythms like delta, theta, alpha, beta and gamma, measured live here with an order parameter and a power spectrum of the population's mean field.
🔬 What it shows
N phase oscillators sit on a ring, each evolving by dθᵢ/dt = ωᵢ + K/N·Σⱼsin(θⱼ−θᵢ) plus optional noise, where ωᵢ is drawn from a spread σ around a mean frequency f0. The order parameter r = |1/N·Σe^(iθⱼ)| tracks synchrony from 0 (incoherent) to 1 (fully locked), and a live DFT of the mean field reveals which brain-rhythm band — δ, θ, α, β or γ — the population is oscillating in.
🎮 How to use
Adjust N oscillators (5–80), Coupling K (0–10), Frequency spread σ (0.1–5) and Noise level (0–2), or jump straight to the five presets: Desynchronised, Theta (6Hz), Alpha (10Hz), Gamma (40Hz) and Deep Sleep (δ). Watch the phase diagram's dots cluster together and the resultant vector (the order parameter arrow) grow as K rises past the critical value; the Order r(t) and Power Spectrum panels update live underneath.
💡 Did you know?
The Kuramoto model has an exact phase transition at critical coupling K_c = 2/(π·g(0)), where g(0) is the natural-frequency distribution's density at its mean — below K_c the oscillators drift independently, above it a fraction spontaneously synchronise, just like coupled pendulum clocks or flashing fireflies. Gamma-band synchrony (30–80Hz) in real cortex is thought to depend on a similar balance, but between excitatory and inhibitory (E-I) neurons rather than a single coupling constant.
Frequently asked questions
What is the Kuramoto model?
It is a mathematical model of N coupled phase oscillators, each with its own natural frequency ωᵢ drawn from a distribution. Every oscillator's phase θᵢ evolves according to dθᵢ/dt = ωᵢ + K/N·Σⱼsin(θⱼ−θᵢ), so each oscillator is pulled toward the average phase of all the others with strength proportional to the coupling constant K. It is one of the simplest solvable models of spontaneous synchronisation and is used across physics, biology and neuroscience.
What does the order parameter r actually measure?
r = |1/N·Σe^(iθⱼ)| treats each oscillator's phase as a unit vector on the complex plane and averages them. If phases are scattered randomly the vectors cancel out and r stays near 0; if oscillators lock into the same phase the vectors add up and r approaches 1. The simulation draws this resultant vector directly on the phase-diagram ring, so you can watch synchrony build in real time as K increases.
Why do the oscillators suddenly synchronise once K passes a threshold?
The Kuramoto model has an analytically derived critical coupling K_c = 2/(π·g(0)), where g(0) is the value of the natural-frequency distribution at its centre. Below K_c the spread in natural frequencies σ dominates and oscillators drift apart, keeping r near 0. Above K_c a growing fraction of oscillators lock to a common frequency, and r rises sharply — a phase transition mathematically similar to magnetisation appearing in a ferromagnet as temperature drops.
How do the presets map onto real brain rhythms?
Each preset sets a mean frequency f0 and a coupling/spread combination tuned to sit in a classic EEG band: Theta targets 6Hz (memory encoding, REM sleep), Alpha targets 10Hz (relaxed wakefulness), Gamma targets 40Hz (perception, high coupling K=8 for tight synchrony), and Deep Sleep targets 2Hz with strong coupling and low spread, mimicking the highly synchronised slow-wave activity of deep non-REM sleep. The Desynchronised preset uses low K and high σ so the population never locks, illustrating an incoherent baseline state.
How is the dominant frequency and band detected from the simulation?
The simulation keeps a rolling history of the population's mean field (the real part of the order-parameter vector) and runs a discrete Fourier transform over the most recent 512 samples. The frequency bin with the largest magnitude becomes the "dominant frequency" readout, which is then classified into a band — δ below 4Hz, θ below 8Hz, α below 13Hz, β below 30Hz, or γ above that — mirroring how neuroscientists classify EEG power spectra into canonical rhythm bands.
Kuramoto oscillators phase-lock into brain rhythms: flip between Theta (6Hz), Alpha (10Hz) and Gamma (40Hz) presets and watch synchrony shift.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install