Presets
Playback
Setup
Array
Neurons and noise
Intent and speed
Layers
Model check
The science
Cosine tuning of motor-cortex units
In the classic centre-out reaching experiments each recorded motor-cortex neuron fires fastest for one preferred movement direction and more slowly for others. The page uses the textbook model rate_i(theta) = b (1 + d s cos(theta - theta_i)): b is the baseline rate, d the modulation depth (0 to 1), s the movement speed (0 to 1), theta the intended direction and theta_i the preferred direction of unit i. Writing the depth as a fraction of the baseline keeps every rate non-negative, so no rectification is needed. Real neurons differ in baseline, depth and tuning width; here they share b and d so the formulas stay exact.
Poisson spikes
Spikes are generated as an inhomogeneous Poisson process: in every 5 ms step a live unit fires with probability 1 - exp(-rate dt). The count in a window T therefore has mean and variance rate T (Fano factor 1). Real cortical counts are often a little more variable (Fano 1 to 1.5); that would make every error below somewhat larger.
Population vector decoder
Each unit votes for its preferred direction with weight w_i = (n_i/T - b) / (b d), where n_i is its spike count. The decoded angle is the direction of sum w_i (cos theta_i, sin theta_i) and the decoded speed is 2 |sum| / N. With evenly spread preferred directions and no noise this returns the exact angle and speed. With noise, its angle variance is 2 / (N b d^2 s^2 T), so the error shrinks like 1/sqrt(N). With unevenly spread (clustered) preferred directions the vector is biased towards the crowded side, which is why real decoders are calibrated against recorded data.
Maximum likelihood and the Cramer-Rao bound
For Poisson counts the log-likelihood of an angle is sum n_i ln(1 + x cos(theta - theta_i)) - T b x sum cos(theta - theta_i) with x = d s; the page maximises it on a grid and refines it. The Fisher information of the angle is J = T b x^2 sum sin^2(theta - theta_i) / (1 + x cos(theta - theta_i)), and no unbiased decoder can have an angle variance below 1/J (the Cramer-Rao bound). For a uniform ring of N units the sum has the closed form J = T N b (1 - sqrt(1 - x^2)). The population vector sits only about 7 % above the bound at x = 0.5, which is why simple linear decoders worked so well in early brain-computer interfaces.
Dead channels
Electrodes silently lose signal over months. A decoder that does not know a channel is dead reads its zero count as a strongly negative vote and the estimate is pulled away from that unit's preferred direction. Telling the decoder which channels are dead (recalibration) removes the bias at the price of fewer units. The last graph compares both cases for both decoders.
The reaching task
In the centre-out task the intended velocity points from the hand to the target with a speed that falls near the target. Every window of T milliseconds the decoder reads the spikes and the hand moves by 1.25 x speed_hat x T in the decoded direction. Path efficiency is the straight-line distance divided by the distance actually travelled; a reach that takes much longer than the intended path signals a noisy or biased decoder.
Simplifications and a safety note
One neuron per electrode in the figures is not what real arrays record (typically a few well-isolated units plus multi-unit activity per channel); the layout of the array is a visual device. The model has no learning by the user, no feedback delays, no tuning drift, no neuron-to-neuron noise correlations (which can limit the benefit of adding units) and no arm dynamics. This is an educational model of decoding principles, not a design tool and not medical advice.
Independent checks on this page
(1) The Poisson generator has mean = variance on four rates. (2) The noise-free population vector returns the exact angle and speed. (3) The numerical Fisher information equals the closed form and doubles when the number of units doubles. (4) A Monte Carlo of 1200 random angles reproduces the Cramer-Rao bound for maximum likelihood and the predicted variance of the population vector. (5) The population-vector error falls with a log-log slope near -0.5 between 32 and 512 units.