fMRI tutorials with Matlab Live Scripts

This series of walkthroughs is designed to illustrate the principles of fMRI acquisition, design, and analysis. They use the CANlab Core interactive analysis tools. Code to run each walkthrough is included in the CANlab Core toolbox, and datasets are included or downloaded from Neurovault. See the main CANlab intro page for more on the philosophy behind the interactive analysis approach.

This is not a comprehensive introduction to Matlab. It’s assumed that you will use other resources to supplement your basic understanding how to work with Matlab, including:

  • Matlab’s comprehensive built-in examples (type “doc” within Matlab)
  • Function help (type “help my_fun”, where my_fun is the name of a function)
  • Matlab Academy (free!), including the “Matlab Onramp” module and others)
  • Other great resources, e.g., Michael X. Cohen’s YouTube lectures and Matlab book

These are didactic tutorials using Matlab live scripts. There is also a complementary set of code walkthroughs on using the CANlab object-oriented tools, with some overlap but unique information and code examples.

Basic signal processing 
1.1. T1 decay and basic Matlab orientationDownload Matlab Live Script
1.2. Sine waves and the Fourier TransformDownload Matlab Live Script
The General Linear Model and fMRI designs 
2.1. fMRI Design Matrices and inferenceDownload Matlab Live Script
2.2. fMRI Design Matrices: Multiple regressorsDownload Matlab Live Script
2.3. Efficiency, colinearity, and variance inflationDownload Matlab Live Script
2.4. High-pass FilteringDownload Matlab Live Script
2.5. Nuisance CovariatesDownload Matlab Live Script
First-level models with whole-brain data 
3.1. Setting SPM defaults - coming soonDownload Matlab Live Script
Get the Pinel localizer dataset used here 
3.2. Preprocessing basics using SPMDownload Matlab Live Script
3.3. First-level model using the SPM GUIDownload Matlab Live Script
3.4. First-level model using CANlab regress()Download Matlab Live Script
Second-level models with CANlab tools
See walkthroughs
Multivariate predictive models 
3.1. SVM on unpaired data using predict()Download Matlab Live Script
3.2. multivariate prediction with continuous outcomes 

Other tutorials

CANlab code walkthroughs