Here are some tutorial files that show how to use Matlab for fMRI. Please feel more than free to use the code for teaching, and if you do, please mail me with comments and feedback.
The code has lots of comments in it, which attempt to explain the concepts as explicitly as possible. No prior knowledge of Matlab or linear algebra is assumed.
hrf_tutorial.m - This program is a good place to start. It shows the basic shape of a Haemodynamic Response Function (HRF), how to convolve an HRF with a time-series of stimulus onsets in order to produce a predicted fMRI signal, and how to plot the results in Matlab. The program also shows what happens when closely-spaced stimuli produce HRFs which overlap in time and linearly sum.
math_of_convolution.m - This program shows how convolution works, going through all the steps of exactly what gets added up and multiplied with what. It also explains from the ground-up how to do for-loops in