Each of the recorded units has a fixed preferred direction θpref and a cosine-shaped tuning curve, the model established for primary motor cortex by Georgopoulos et al. (1982): a neuron fires fastest when the intended reach matches its preferred direction and slowest for the opposite direction.
rate(θ) = baseline + gain·sharpCos(θ_target − θ_pref, κ)
sharpCos(Δ, κ) = sign(cosΔ)·|cosΔ|^κ (κ=1 → the textbook cosine model)
noisy = max(0, rate + N(0,1)·noiseLevel·√rate) (Poisson-like spike variance)
decoded = atan2( Σᵢ (rateᵢ − baseline)·sinθᵢ , Σᵢ (rateᵢ − baseline)·cosθᵢ )
Summing every recorded neuron's preferred-direction vector, weighted by how far above baseline it fires, is the population-vector algorithm (PVA) — the decoding method behind the earliest BMI robot-arm and cursor demonstrations. It is derived assuming exactly cosine tuning (κ=1); a single noisy neuron says little, but averaging many independent, noisy cosine-tuned units cancels most of the spike noise.
A light exponential-smoothing filter (toggle it off to see the raw, jittery population vector) trades responsiveness for stability, the same trade-off real BMI decoders make with a Kalman filter. The 2-link arm uses planar inverse kinematics to reach for the smoothed decoded direction.
- Recorded neurons — more simultaneously recorded units shrink the standard error of the population-vector estimate roughly as 1/√N, directly lowering decode error — verified here: 16 units average well above 8° raw error, 64 units settle near 4°.
- Neural noise — per-spike variability; pushing it from 1.0 to 4.0 roughly doubles the measured raw decode error in this simulator.
- Tuning sharpness κ — the PVA formula above is exact only for κ=1, the value actually measured in motor cortex. Moving κ away from 1 changes how much weight the sum implicitly puts on near-preferred vs. off-preferred units and measurably shifts decode error, which is why real BMI decoders are built around the empirically observed cosine law rather than an arbitrarily sharper one.
- Decode update rate — how often (Hz) the population is resampled and the arm re-targeted; lower rates make the arm's motion visibly step and lag even when the underlying decode is otherwise accurate.
Real-world relevance: this sense → decode → act pipeline is the same one used by clinical BMI trials (e.g. BrainGate) that let paralyzed participants move a robotic arm using only recorded motor-cortex activity.