# freqanalysis_wltconvol.m

Jan Mathijs Schoffelen Jan.Schoffelen at FCDONDERS.RU.NL
Wed Oct 18 09:47:45 CEST 2006

```Dear Brian,

>Regarding phase-locking factor/ITC, couldn't I try to use the complex data
>within the freqanalysis_wltconvol to calculate these data in a similar
>method to that in the Tallon-Baudry et. al. '97 gamma paper?  The wltconvol

>function is so similar to that paper's analysis already, it seems like I
>would only need to divide the complex data by its absolute value.  The
>paper refers to taking the "modulus of this complex value," where the
>complex value is:
>Pi(f,f0) = w(t,f0) X si(t,f0)/ | w(t,f0) X si(t,f0)

I would implement the ITC as follows:

itc = abs(mean(x./abs(x)));

in which x is a vector of complex numbers representing your single-trial
observations (in a single channel and a single frequencybin). Markus pointed
out that you could use freqanalysis_mtmfft with cfg.output = 'fourier' to
obtain these complex numbers, but apparently freqanalysis_wltconvol gives
you a complex output as well.

The above formula is how it is for example done in Tallon-Baudry '97

>I read this as the dividing the imaginary, sine wave, portion of the
>wavelet (representing phase angle) at any given time and frequency by its
>absolute value.

Beware: a complex number can be represented as:
B(cos*x+isin*x), or as A*exp(phi*i).
The imaginary part you refer to is indeed the 'sine wave' but is not the
whole story about the phase. The phase phi is determined both by the sine
part and the cosine part.
By normalizing with the absolute value, you divide the complete complex
number by its amplitude, i.e. also the cosine part. If you think of it as a
polar notation (A*exp(phi*i)), you divide the number by A, leaving a unit
vector pointing in a particular direction (as determined by phi).

>Does modulus have the same functionality/meaning as the
>C++ mod or matlab rem function?

The modulus of a complex number is its absolute, i.e. |x|, the corresponding
matlab-function is abs(). The functions mod (also exists in matlab) and rem,
are concerned with remainders after division, and modulo-stuff, which is
similar to remainders

>Is there interest in phase-locking values in the FieldTrip user community?
>I am interested in trying to implement what is described above, but it
>would be nice to have others see the code and test it to be sure I have
>calculated phase-locking values correctly.

I guess so, hopefully you now have a handle of doing it yourself.

Yours,

Jan-Mathijs

```