A MATLAB implementation of a visual Steady-State Visually Evoked Potential (SSVEP) Brain-Computer Interface (BCI) task using Psychtoolbox. This project simulates a classic SSVEP paradigm with four flickering targets and real-time visual feedback.
This task presents four visual stimuli (squares) flickering at distinct frequencies (8, 10, 12, and 14 Hz). A central circle provides real-time feedback by smoothly moving toward the selected target upon mouse click. The implementation is designed for BCI prototyping, neuroscience education, and SSVEP mechanism demonstration.
- Four flickering targets positioned at cardinal directions (0°, 90°, 180°, 270°)
- Precise flicker control using monitor refresh rate and frame counting
- Smooth visual feedback with animated central circle movement
- Interactive selection via mouse click (simulating BCI command)
- Configurable parameters: frequencies, positions, colors, speeds
- Robust error handling and clean screen management
├── SSVEP_Task_4Targets.m # Main task script (4-target version)
├── SSVEP_Task_8Targets.m # Extended 8-target version (if available)
└── README.md
- MATLAB R2019b or later
- Psychtoolbox-3 installed and configured
- Clone this repository.
- Open MATLAB and navigate to the project folder.
- Run the main script:
SSVEP_Task_4Targets - Click on any flickering square to see the feedback circle move toward it.
- Press any key to exit.
| Parameter | Default Value | Description |
|---|---|---|
| Frequencies | [8, 10, 12, 14] Hz | Flicker frequencies for each target |
| Radius | 200 px | Distance of targets from center |
| Square Size | 80 px | Size of each flickering square |
| Background | Gray (50%) | Screen background color |
| Move Speed | 12 px/frame | Speed of feedback circle |
- Frame-based flicker timing: Uses
Screen('Flip')and frame counting for accurate frequency control. - Vector-based animation: Smooth interpolation for circle movement.
- Modular structure: Easy to extend (e.g., to 8 targets or different layouts).
Feel free to fork and extend this project. Possible improvements:
- Add EEG triggering via parallel port or TCP/IP.
- Implement dynamic frequency/position configuration.
- Integrate with actual BCI classification pipeline.
This project is provided for educational and research purposes.