Matlab Programming (Psych 114M)

Instructor: Mark Steyvers (mark.steyvers@uci.edu)
Office hours: Friday 3-3:50pm (SBSG2316)

Teaching Assistants:
Irina Danileiko (idanilei@uci.edu
Kier Groulx (kgroulx@uci.edu)

Optional Discussion/Lab Section: Wed 3:30-4:20pm SBSG240 (Led by TAs)

Course Summary:  this course is designed as a first-course in programming using Matlab as the primary language.  The course will provide a background in the rudiments of programming, including syntax, program control, input/output management, debugging techniques and graphics. During the course, we consider applications to problems encountered in the social sciences such as data visualization, data analysis, and stimulus generation.

Syllabus: information for students

Screen casts: a basic Matlab introduction is given in a number of screen casts available through UCI replay as well as YouTube (see this playlist).

Textbook:  Matlab for Psychologists (2012), Borgo, M., Soranzo, A., Grassi, M. Available online for free as an e-book. This might not work outside of the UCI network (click on free preview):  http://www.springer.com/psychology/book/978-1-4614-2196-2. You can also try this direct link: http://link.springer.com/book/10.1007/978-1-4614-2197-9/page/1

Tutorials: you also might find it useful to look at various tutorials on the web:
https://www.mathworks.com/support/learn-with-matlab-tutorials.html
https://matlabacademy.mathworks.com/
http://www.antoniahamilton.com/matlab_for_psychologists.pdf

Help within Matlab program:
type in Doc in command window to bring up documentation and a "getting started" guide

Matlab Software: the classroom computers have Matlab installed. Having your own laptop computer with Matlab installed allows you to continue to work outside the classroom -- helpful, but certainly not required. A free student version of Matlab apparently is available by following these instructions: http://laptops.eng.uci.edu/software-installation/matlab

Required Material & Assignments

Lesson Concepts Reference Material Screencasts Assignments
1
  • User Interface
  • Matlab as a calculator
  • Variables
  • Matrices
  • Chapter 1: basic operations
    Skip "A brick for an experiment". Note: The book has an error on page 9. There are 3 matrices shown. The one on the far left is not labeled correctly. It is a 4x3 matrix, not a 3x4 matrix.

 

  • Note: you can take the EEE quizzes only once -- make sure you have gone through all the material in this section 
2
  • Logical Indexing and Operators
  • Strings
  • Keyboard input
  • NaN
  • Structures
  • Cell arrays
  • Import/Export
  • Chapter 2: data handling
    Skip: dynamic field names
    Skip: "A brick for an experiment"

 

3
  • Basic plots
  • Customizing plots
  • Multiple graphs
  • Graphics handles
  • Chapter 3: plotting
    Skip: "A brick for an experiment"
4
  • m-scripts and functions
  • Control flow
  • For loops
  • While loops
  • Breaking loops
  • Try/catch
  • Functions
  • Scope of variables
  • Chapter 4: Programming concepts
    Up to page 87 excluding "Change the number of inputs and outputs"

 

5
  • Import/export
  • Good programming style

 

 

6
  • Random numbers
  • Random permutations
  • Sound / Images
  • Exporting data
  • Dates and times
  • Random numbers (11 min)
  • Loading/saving Matlab data (10 min)
  • Matlab programming style (6 min)

 

7
  • Loading data
  • Data analysis
  • Read parts of Ch. 7
  • Matlab documentation of the dir function
 
8
  • Subfunctions
  • Nested loops
  • Debugging
     
 

       

 

Optional Assignments

Lesson Concepts Reference Material / Data Assignments
1
  • Graphical User Interfaces
  • Callback functions
  • Chapter 8: The Charm of Graphical User Interfaces
  • Section 13.4 of "Matlab: a practical approach" book
  • Matlab documentation on uicontrol
2
  • PsychToolbox
  • Chapter 9: PsychToolbox (video)
  • Chapter 10: PsychToolbox (Sound, Keyboard and Mouse)
  • Example program "bounce.m" that demonstrates how to set up a field of moving ovals. You can use this program as a basis for your own program.
  • Example video that shows how the Motion Tracking Task could like (flash mp4)
  • Basic illustration of the MOT task
  • More demonstrations and background reading of the MOT task
  • PsychToolbox