Mental Rotation Replication in Matlab
by Trystan on Sep.08, 2009, under Cognitive Science, Programming
I recently replicated a Shepard and Metzler (1971) style experiment in order to explore OpenGL programming under Matlab. Additionally, I wanted to manipulate certain variables, such as the
type(class) of object, to verify predictions made by emerging models of
top-down processes of human vision such as those mentioned in the previous post. This replication provided a convenient point to start.
In this implementation, the participant is shown a series of 3D object pairs. On some trials, the two objects are different. On other trials, one object is simply a rotation on the xy plane of the other object by a variable multiple of 20 degrees. The participant responds by pressing ’1′ to indicate the same object or ’2′ to indicate different objects while their response time is measured. Previous research shows that response time increases linearly relative to the number of degrees one object is rotated from the other (Shepard, Metzler 1971).
The image to the right below shows the stimuli for one trial. The image to the left depicts my own results for 100 trials. My response time is far less than the typical Shepard (1971) subject but I have years of experience working with 3D graphics and, of course, wrote the code for this experiment. I’ve posted the code as I think it provides a decent example of accessing OpenGL from Matlab and a good starting point for related experiments. The code is available for download here.
Shepard R., Metzler J. (1971). Mental Rotation of Three-Dimensional Objects. Science. 171.3972, 701-703.


June 11th, 2010 on 9:38 pm
Hello!
Any way you’d consider sharing your code for this task?
Thanks,
Julia
June 12th, 2010 on 12:48 am
There’s a link to the code in the last sentence of the post (the word ‘here’). Not the most noticeable thing
February 7th, 2011 on 9:08 pm
Hi Trystan –
I downloaded and ran the code. It works very well, while I’m running it. However, it’s not clear how to get the data. When it’s done, the command window just displays:
Callback: @DataBlack/Callback
Plot: @DataBlock/Plot
Data: @DataBlock/Data
I’m wondering where I can see the data.
Thanks!
Julia
February 7th, 2011 on 9:26 pm
Oh, never mind! I see the data were appearing on a figure that wasn’t pushed forward. Sorry!
Thanks for the script. It’s great.
Julia
May 15th, 2012 on 4:04 pm
Any chance you could make a set of screendumps (png jpg or other) of the stimuli available?
Thanks.
May 17th, 2013 on 6:51 pm
Hi Trystan,
I’m going through and getting PNG files for each of the different images, and I discovered that sometimes even if I set the code for diff=true, some of the images are the same anyway.
Do you know how to fix this?
Thanks,
Julia
May 19th, 2013 on 11:23 pm
Figured it out!
Added code that checked the objOrder to make sure that when diff=1, they are not the same.
Julia