[Eeglablist] why is the result of coherence not between 0~1?

wu xiang rwfwu at ustc.edu
Wed Sep 21 08:14:11 PDT 2005

Dear all:

I have write a script to caululate coherence (not the event related
coherence of eeglab) according to some papers (e.g. Sarnthein, J.
Synchronization between prefrontal and posterior association cortex
during human working memory. pnas, 95,12,0792-7096,1998). But the result
is not between 0~1. So I ask here.

The following is the simple discription of coherence:
Coherence is the frequency domain equivalent to the cross-covariance
function, which measure the similarity of two signals in frequency domain.

The folowing is the simple discription of calculation of coherence:
For signals x(i),y(i)from two electrodes, i=1:n trials.
%----------------------------
step 1: Every single trials are fourier transformed, X(i) = fft( x(i) ),
Y(i) = fft( y(i) ).
step 2: cross power spectra Sxy(i) = X(i) .* conj( Y(i) ).
(auto) power spectra Sxx(i) = X(i) .* conj( X(i) ), and Syy(i) = Y(i) .*
conj( Y(i) )
step 3: average cross power spectra and power spectra across trials
AvSxy = ( Sxy(1) + ... Sxy(i) + ... Sxy(n) ) / n
AvSxx = ( Sxx(1) + ... Sxx(i) + ... Sxx(n) ) / n
AvSyy = ( Syy(1) + ... Syy(i) + ... Syy(n) ) / n
step 4: coherence Cxy = abs(AvSxy).^2 / (AvSxx .* AvSyy)
%-----------------------------

But the result is not between 0~1.
It's interesting that for every single trials, the coherence is between
0~1. for example:
abs(Sxy(i)).^2 / (Sxx(i) .* Syy(i)). Sure, average such "single trial
coherence" across trial will results in 0~1, while it is different from
the method discribed above -- in which, the cross power spectra and
power spectra are averaged first(see step 3).

Could some one tell me what's wrong?

--
wu xiang
Cognitive neuroscience lab of life school of university of science and technology of china
Hefei, anhui, P.R.China. 230027
web-page:http://202.38.64.10/~rwfwu
You can mail to: rwfwu at ustc.edu or rwfwuwx at gmail.com