Question: The following must be answered using the MATLAB Psychtoolbox Write a clear, thoroughly commented Matlab program: The program should be divided into three major sections:
The following must be answered using the MATLAB Psychtoolbox
Write a clear, thoroughly commented Matlab program:
-
The program should be divided into three major sections: SETUP, DISPLAY TEXT, and EXIT. Use clear, prominent headings for these major sections, e.g.:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % SETUP %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Within each major section, use a standard commenting style.
-
The SETUP section should include the following:
-
Everything from General Setup for a Matlab Program in the Part 1 handout, including seeding the random number generator.
-
Suppress the Psychtoolbox welcome screen, skip synchronization testing, and get the screen number of the main screen (for all these operations, see Basic Setup for Visual Display in the Part 1 handout).
-
Open a full-screen window with a corn flower blue background.
-
Suppress keyboard output to the command window, hide the mouse cursor, set the blend function, get the dimensions of the screen, and get the horizontal and vertical midpoints of the screen (for all these operations, see Typical Additional Setup in the Part 1 handout).
-
-
The DISPLAY TEXT section should display text in Courier font, with a text-size approximately 1/20th the height of the screen. Dont just hard-code a number for the text-size; have Matlab compute it (IMPORTANT: The text-size must be a whole-number). The displayed text should include the following, all put on the screen at once:
-
The words RED TOP-LEFT (with the word RED positioned directly above the word TOP- LEFT) in red text, centered in the top-left quadrant of the screen.
-
The words GREEN TOP-RIGHT (with the word GREEN positioned directly above the word TOP-RIGHT) in green text, centered in the top-right quadrant of the screen.
-
The words BLUE BOTTOM-LEFT (with the word BLUE positioned directly above the word BOTTOM-LEFT) in blue text, centered in the bottom-left quadrant of the screen.
-
The words YELLOW BOTTOM-RIGHT (with the word YELLOW positioned directly above the word BOTTOM-RIGHT) in yellow text, centered in the bottom-right quadrant of the screen.
-
The words RANDOM GRAY CENTER (with the words RANDOM GRAY positioned directly above the word CENTER) in a randomly generated grayscale tone, centered on the screen. This textand only this textshould be bold.
-
4. The EXIT section should do the following:
-
Wait for the user to press a key.
IMPORTANT: You cant use the pause function for this when the keyboard output to the command window is suppressed; therefore, use the following command instead:
KbWait ; % wait for any key to be pressed
-
After the user presses a key, close the window and restore the mouse cursor (remember, you
can do both with a single command).
-
Restore normal keyboard function.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
