matlab

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 is how I created such a plot using MatLab and SPM. Environment and Tools: Windows XP MatLab (v7.6) SPM
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. Below is a matlab sample script showing how to connect to another computer (called ETG-4000) with TCPIP : %Connect
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. First, make the vector a column vector and append 1 to the end. It becomes a 4×1 matrix: v = x y z 1 Then, convert the
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. Let’s take the first volume as example. Assume TR=2 and
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
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 files (usually image files). Frankly speaking I like spm_get much better as it’s intuitive and easy to use. Here is h
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 + psychophysics toolbox price ~$1000 MatLab cost, $50-500 easy to use easy moderate need co
Xu Cui
12 sec read

xjView Tutorial Videos

FDR function, English version FDR function, Chinese version 普通话 Mandarin FDR function, Chinese versi
Xu Cui
2 sec read

Tower of sqrt(2)

What is the limit of this infinite exponential? Solution 1: $$x=\sqrt{2}^x$$ This leads to x=2 or 4 Solution 2: $$x=^x$$ This leads to x not equal to 2 or 4 Solution 3: MatLab simulation of series $$\sqrt{2}, \sqrt{2}^\sqrt{2}, [\s
Xu Cui
14 sec read