Motor-Imagery BCI: Mu/Beta ERD Decoder Simulator

This simulator models a real motor-imagery brain-computer interface end to end. Three synthetic EEG channels — C3, Cz and C4 — are generated sample by sample from superposed mu (~10 Hz) and beta (~20 Hz) oscillators plus noise. Triggering imagined left- or right-hand movement smoothly suppresses the mu/beta rhythm over the corresponding motor cortex channel — event-related desynchronization (ERD), a genuine, well-documented EEG phenomenon. A sliding-window Goertzel analysis continuously computes real band power per channel, and a laterality-index decoder classifies which hand was imagined from that live computed feature, reporting a confidence score and running decode accuracy across trials.