Matlab and psychtoolbox programming for cognitive


Matlab and Psychtoolbox programming for Cognitive Neuroscience Summative Assignment

The summative assignment has two parts; modifying an experiment function with Matlab and Psychtoolbox functions, and analyzing data with custom Matlab functions. You can make the assignment by modifying/writing code and commenting extensively. You can either write one piece of code with all the steps or save a new file for each task, depending on what's most appropriate. You can write a separate text file to explain how do did the steps although this is not necessary if it's clear from the code what you did.

Part 1: Matlab and Psychtoolbox programming

The first assignment is based on the MyOrientationDiscriminationExp, which you will be modifying based on the tasks below.

1. Make the size of the fixation dot a variable and give it the size of 6x6 pixels. Make sure to change the size everywhere in the script.

2. The function MyOrientationDiscriminationExp.m accepts two arguments - the reference orientation as a double variable, and the presentation mode as the second input argument. Improve the function by testing that the 2) orientation varies between -90 and 90 and that 2) 1) the second argument is a string variable. Display an error if these constraints are not met. See 'help error' if you are unsure about how to generate an error message.

3. Now modify the function to allow the following specifications for the second argument: it should either be 'simultaneous' or 'successive', and for any other input, the function should generate an error message.

4. Modify the function to show the two gabors in succession if the input is 'successive' (as it is now) and to show the two gabors next to each other (on both sides of the fixation dot at a distance of +/-30 pixels from the fixation dot), if the input is 'simultaneous'. Tip: you will need to define the 'rect' for the two stimulus locations to do this.

Part 2: Data analysis using Matlab

The assignment is based on data from one subject doing an experiment similar to MyOrientationDiscriminationExp. The data is stored in the file assingmentData.mat. Write a script that does the steps below and comment it to show your thinking. You will hand this script in with the plots and analysis results. You can also write a separate text file to explain what you did but it's not necessary if the script is self-explanatory.

5. Load in the data and plot the response times as a function of trial number. Use a dashed line for plotting and a 'diamond' for the point. Add horizontal and vertical labels, as well as a title to the plot. If you are unsure about how to do some of this make sure to use the help function for 'plot'.

6. Calculate the mean and standard deviation of the reaction times, but make sure to first remove any NaN values. Also test if the average reaction time is significantly different than 0.900 s (ttest).

7. Perform a linear regression (regress) with the log-reaction times as the dependent variable and the interstimulus interval and trial number as the independent variables. That is for trial i, the log-response time is modeled as log (RTi ) ∼ βlinear xi,trialISI xi,ISI + βdiff xi,diff + β0

Interpret the results, including the confidence intervals around the beta variables.

8. We now want to perform linear regression using fminsearch function instead. Write a function that sums the squared difference between the log-RT and the linear function:

errFnc=∑i(log(RTi ) - (βlinear xi,linear + βISI xi,ISI + βdiff xi,diff + β0))2

and minimize this function. Note that the function has 4 parameters, βlinear, βISI, βdiff, β0. The fminsearch function therefore has to find the four parameter values (or vector of length four) that minimize this function. Comment on the found beta values and whether they differ from the values found in the problem above.

Solution Preview :

Prepared by a verified Expert
MATLAB Programming: Matlab and psychtoolbox programming for cognitive
Reference No:- TGS02887556

Now Priced at $32 (50% Discount)

Recommended (94%)

Rated (4.6/5)