🧠 Brain-Signal Decoder Lab: How Well Can a Machine "Read" Imagined Movement?

2D interactive simulation · educational model
The science

What is being measured. Scalp EEG picks up the summed activity of millions of neurons through bone and skin. Over the motor cortex, a 8-12 Hz "mu" rhythm shrinks when you imagine moving the opposite hand (event-related desynchronisation, ERD). Imagining the right hand lowers mu power at electrode C3 (left hemisphere), the left hand at C4.

Decoder. For each 1 s window the band power is taken with a Goertzel filter at 9, 10 and 11 Hz, P = Σ|X(f)|², and the feature is log P per channel. A linear discriminant (LDA) is trained on calibration trials: w = S⁻¹(μ₁ − μ₀), decide class 1 if w·x + b > 0.

Expected accuracy. If both classes are Gaussian with equal covariance, the best possible accuracy is Φ(Δ/2) where Δ is the Mahalanobis distance between class means. The page compares the measured accuracy on fresh trials with this prediction, and checks that with zero ERD the decoder is at chance (50%), i.e. noise alone carries no "thoughts".

Honest limits. This simulates one narrow, trained, two-choice task. Real systems cannot read free-form thoughts, private memories or intentions; they need a cooperating user, calibration, and still make many errors. The signal model is synthetic (sinusoid with random phase plus coloured noise), artefacts such as blinks, muscle and mains hum are not modelled, and the accuracy numbers are illustrations, not a benchmark of any device.