Drifting gratings generator for visual stimulation

Generator of visual stimulation protocol of basic drifting gratings using Psychtoolbox and output voltage signal to record stimulation time.
436 Downloads
Updated 28 Jul 2020

View License

Use two screens: one for visual stimulation, and one to set and control the visual stimulation protocol.

1. Select the screen for visual stimulation.
2. Turn on the app switch to initialize the monitor (using Psychtoolbox functions).
3. Set the parameters of the drifting gratings: directions, size and frequency.
4. Set if you want a random sequence and if you want sinusoidal gratings.
5. (Optional) Select an output voltage channel of a NI-DAQ for recording the type and time of the stimulation.
6. Set the duration of the stimulus, the duration of gray screen between stimulus and the number of repetitions.
7. Preview the visual stimulation protocol and the total time on the right panel.
8. Press Run to start the protocol.

You need a NI-DAQ to send an analog output to record the type and time of visual stimulation. Output voltage of 0 V means no visual stimulation (gray screen), different values mean different directions. For example, if you choose 8 different directions (0º, 45º, 90º, 135º, 180º, 225º, 270º and 315º) the output voltage will use 8 different levels of voltage in order to identify them (0.5, 1, 1.5, 2, 2.5, 3, 3.5 and 4 V).

Cite As

Jesus Perez (2024). Drifting gratings generator for visual stimulation (https://www.mathworks.com/matlabcentral/fileexchange/78670-drifting-gratings-generator-for-visual-stimulation), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2019b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: Psychtoolbox-3

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0