Professional Documents
Culture Documents
Web Guides
http://mathworld.wolfram.com/LinearAlgebra.html
http://www.maths.surrey.ac.uk/explore/emmaspages/option1.html
http://www.inf.ed.ac.uk/teaching/courses/fmcs1/
Online introduction:
- http://www.khanacademy.org/video/introduction-to-
matrices?playlist=Linear+Algebra
What Is MATLAB?
- And why learn about matrices?
Zero-dimentional matrix
A Scalar - a single number is really a 1 x 1 matrix in Matlab! 4
1 dimentional matrix
A vector is a 1xn matrix with 1 row [1 2 3]
n
m 2 7 4
A matrix is an mxn matrix
3 8 9
2 7 4
A = [2 7 4]
2
A = [2; 7; 4] 7
4
; separates the different rows
2 7 4
A = [2 7 4; 3 8 9] 3 8 9
: separates collums
Matrix formation in MATLAB
X = [1 2 3; 4 5 6; 7 8 9] = 1 2 3
4 5 6
7 8 9
Submatrices in MATLAB
Subscripting each element of a matrix can be addressed with a pair
of numbers; row first, column second
X(2,3) = 6
X(3,:) = ( 7 8 9 )
1 2 3
X( [2 3], 2) = 5
4 5 6
7 8 9 8
Matrix addition and subtraction
Addition
Subtraction
Matrix Multiplication I
Scalar multiplication
n l
k
Matrix multiplication rule: m a11 a12 a13 b11 b12
Matrixes need the exact same m a31 a32 a33 b31 b32
In Matlab: AT = A
Identity matrices
Tool to solve equation
This identity matrix Is a matrix which plays a similar role as the
number 1 in number multiplication
1 0 0
0 1 0
0 1
0
Worked example 1 2 3 1 0 0 1+0+0 0+2+0 0+0+3
A In = A 4 5 6 X 0 1 0 = 4+0+0 0+5+0 0+0+6
for a 3x3 matrix: 7 8 9 0 0 1 7+0+0 0+8+0 0+0+9
2 -1 2+1 -1 + 1
1 1 X = = 1 0
3 3 3 3 3 3
1 1 -2+ 2 1+2
-1 2 0 1
3 3 3 3 3 3
2 3 x1 5
In matrix form 1 2 x2 1 AX = B
Need to find determinant of matrix A (because X =A-1B)
a b
From earlier det( A) ad bc
c d
2 3
(2 x -2) (3 x 1) = -4 3 = -7 1 2
So determinant is -7
To find A-1:
1 1 2 3 1 2 3 1
A
(7) 1 2 7 1 2
4
if B is
1 2 3 1 1 14 2
X
7 1 2 4 7 7 1 So
scalars, vectors and matrices in
SPM
Scalar: Variable described by a single
number e.g. intensity of each voxel in MRI scan
x1
v
v
n x 2
v
e
xn
Eigenvectors of a square matrix are non-zero vectors, after being multiplied by the matrix, remain
parallel to the original vector. For each eigenvector, the corresponding eigenvalue is the factor by
which the eigenvector is scaled when multiplied by the matrix.
All eigenvalues and eigenvectors satisfy the equation Ax = x for a given square matrix A. i.e.
Matrix A acts by stretching
the vector x, not changing its direction, so x is an
eigenvector of A.
One can represent eigenvectors of A as a
set of orthogonal vectors representing different
dimensions of the original matrix A.
(Important in Principal Component Analysis, PCA)
Matrix Representations of Neural
Connections
Can create a mathematical model of the
connections in a neural system
Activity of Neuron 3 1
1 1. (11) (1 1) (1) (1) 0
Input x weight 1
Cancels out! But it is more
complicated than this!
How are matrices relevant to fMRI data?
Basics of MR Physics
Angular Momentum: Neutrons, protons and electrons spin about their axis.
The spinning of the nuclear particles produces angular momentum.
Time
Each voxel is considered as
independent observation
So, we analysis of individual voxels
over time, not groups over space
Intensity
Explanatory variables Solve equation for
These are assumed to be tells us how
Response variable
measured without error. much of the BOLD
A single voxel sampled
May be continuous, indicating signal is explained
at successive time points.
levels of an experimental by X
Each voxel is considered as
factor.
independent observation.
a
m
b3
N of scans
b4
= b5
+
b6
b7
b8
b9
Y = X b + e
Observed Predictors
Pseudoinverse
In SPM, design matrices are NOT
square matrices (more lines than
columns, especially for fMRI).
Statistical RFT
Normalisation Inference
Anatomical p <0.05
reference Parameter estimates
In Practice
Estimate MAGNITUDE of signal changes and
MR INTENSITY levels for each voxel at various
time points
Relationship between experiment and voxel
changes are established
Calculation require linear algebra and matrices
manipulations
SPM builds up data as a matrix.
Manipulation of matrices enables unknown
values to be calculated.
Thank you!
Questions?