matlab

Wavelet Coherence

Wavelet transform coherence (WTC) is a method for analyzing the coherence and phase lag between two time series as a function of both time...
Xu Cui
1 min read

MatLab surface lighting

Here are some parameters in matlab lighting. I first use patch command to plot the surface, then use camlight to shed some light on...
Xu Cui
7 sec read

SVM regression with libsvm

SVM is mostly commonly used for binary classifications. But one branch of SVM, SVM regression or SVR, is able to fit a continuous function...
Xu Cui
1 min read

Brain surface plot with MatLab

This is an example of brain activation plotted on surface. In many circumstances surface view is much more straightforward than a slice view. Here...
Xu Cui
1 min read

tcpip connection with pnet

We use TCP/UDP/IP Toolbox 2.0.5 to read and write data from/to a TCPIP port. It’s fast and reliable. The version we use is 2.0.5....
Xu Cui
1 min read

3D Rotation

Assume you have a vector (x,y,z) and you want to rotate it to, say x-axis, you can multiply the rotation matrix to the vector....
Xu Cui
46 sec read

Reference slice in slice timing in SPM

I saw at least two web pages saying that the reference slice can be chosen during slice timing correction. For example, http://www.fil.ion.ucl.ac.uk/spm/doc/manual/spatial.htm. I disagree....
Xu Cui
1 min read

Some formulas of linear regression

y: dependent variable X: independent variable r: residual $$y=X\beta+r$$ $$\beta=inv(X’*X)*X’*y$$ $$\sigma^2=r’*r/df$$ $$df=N-rank(X)$$ $$\sigma_\beta^2=\sigma^2inv(X’X)$$ $$T_\beta=\beta/\sigma_\beta$$ $$contrast variance = c’*\sigma_\beta^2*c$$ $$T_{contrast}=c’\beta/\sqrt{contrast variance}$$ $$r=\beta\frac{std(x)}{std(y)}$$ $$\beta=r\frac{std(y)}{std(x)}$$ $$var(y) =...
Xu Cui
14 sec read

spm_get, spm_select, and char

The mostly used functions I use in SPM is spm_get (for spm2) and spm_select (spm5 and 8).  These two functions are used to get...
Xu Cui
1 min read

E-prime vs MatLab (+Psychophysics Toolbox)

Both E-prime and MatLab are popular tools for presenting stimuli for fMRI, NIRS and behavioral experiments. Here are a comparison between them. E-Prime MatLab...
Xu Cui
12 sec read