Brian Roach Brian.Roach at YALE.EDU
Sat Oct 7 00:04:01 CEST 2006


I appreciate this answer, but I would like to clarify some of your points
to be sure I have completely absorbed them.  Here is my example:
1000Hz sample rate for the acquired data
4000ms epochs centered on an event (-2000ms before the event to 1999 after
the event)

cfg =

     output: 'pow'
     method: 'wltconvol'
        foi: [1x60 double]
      width: 6
     gwidth: 3
        toi: [1x1000 double]

where foi is 1 to 60Hz (in 1Hz steps), and toi is -.5s to .5s (in 1ms steps)

I like that 1Hz is not plotted (NaN) values, since you cannot get 6 cycles
of 1Hz data in my 4s epoch size.  Having run this, I am still uncertain
about how gwidth influences the data.  Does a smaller gwidth just widen the
bell curve of the gaussian envelope?  Is there a trend, such as the higher
the gwidth, the better the time resolution (because the wavelet has a
sharper rise and fall time)?

In my case, does sf = 2Hz/6Hz or 1/3Hz?  I don't think I have these values
right, and since they influence temporal domain and spectral bandwidth, it
is important that I know what is right.  It seems like if my interpretation
of your e-mail is correct, then each frequency bin consists of that
frequency +/-.167 or (1/6) Hz.  In my example above, my 2Hz value would
then consist of data from 1.8333 to 2.1667Hz.  This would mean that there
are gaps in the spectral data and a smaller number of cycles or smaller
width would lead to larger bandwidth (i.e. decreasing frequency
resolution).  What do you think?

Also, does fieldtrip have a function that gives "phase locking factor" or
inter-trial coherence (ITC)?

Thank you very much for your help.


At 03:59 AM 10/2/2006, Markus Siegel wrote:
>Dear Brian,
>cfg.width determines in cycles the width of the Morlet-wavelet as the
>standard deviation of the underlying gaussian (often termed "q"). One
>can either use a fixed q for all frequencies by giving only one
>number in cfg.width, or one can use a different q for each frequency
>of interest with a vector in cfg.width of the same length as cfg.foi.
>"help freqanalysis_wltconvol" gives you the relationship between
>cfg.width (width) , the frequency of interest (f0) and the standard-
>deviation (resolution) of the wavelet-transform in the temporal (st)
>and spectral (sf) domain:
>The standard deviation in the frequency domain (sf) at frequency f0 is
>defined as: sf = f0/width
>The standard deviation in the temporal domain (st) at frequency f0 is
>defined as: st = width/f0 = 1/sf
>The spectral bandwidth (in standard deviations, Hz) of the time- frequency
>transform can thus be computed as:
>bw = cfg.foi ./ cfg.width;
>The parameter cfg.gwidth determines the length of the wavelet-kernel
>used in standard deviations of the underlying gaussian. In other
>words, it specifies over how many standard deviations the gaussian is
>estimated for the morlet-wavelet in both directions. This does in
>principle not influence the spectro-temporal resolution of the
>transform, but determines its precision because the gaussian is non- zero
>at the edges. Therefore, small values (e.g. <2) lead to edge
>effects in the transform. The full length of the 'longest' wavelet at
>the lowest frequency cfg.foi(1) is thus computed as:
>2 * cfg.gwidth (cfg.width(1) ./ cfg.foi(1))
>In freqanalysis_wltconvol, the wavelet transform is implemented by
>multiplication in the frequency domain which is computationally more
>efficient than convolution in the temporal domain. However,
>technically the transform is well described as a convolution of the
>time-series with a complex Morlet-wavelet (complex sinusoid with a
>gaussian envelope) as e.g. provided in Tallon-Baudry et al., J
>Neurosci 1997.
>Am 29.09.2006 um 18:52 schrieb Brian Roach:
>>Dear FieldTrip users,
>>I have been playing with the freqanalysis_wltconvol function in
>>hopes of using the morlet wavelet time frequency analysis on some
>>eeg data.  I have been able to get it running, and I find that it
>>works very quickly, which is great.  However, I am hoping some
>>users or F.T. programmers can explain some of the function inputs
>>and processing.  The cfg example is as follows:
>>% cfg.method         = 'wltconvol';
>>% cfg.foi            = 1:1:100;
>>% cfg.width          = 7;
>>%  or
>>% cfg.width          = linspace(5,10,length(cfg.foi));
>>% cfg.toi            = 0:0.1:2;
>>% cfg.gwidth         = 3;
>>I believe that the cfg.width specifies the number of wave cycles
>>used in each frequency's wavelet analysis (so at 2Hz, 7 cycles
>>spans 3500ms of data, right?).  Maybe this is not correct, because
>>I do not seem to get the frequencies as low as I would expect given
>>my data epoch length.  Perhaps this has to do with the cfg.gwidth
>>parameter, which I do not think I completely understand - what is it?
>>Also, we do not have the matlab wavelet toolbox, and it appears
>>that it is not required, but how is the morlet wavelet
>>implemented?  As I look through the code I see calls to fft, ifft,
>>and fftshift, but I wonder how I can give a good technical
>>description of this process if I find results in a larger data set.
>>Finally, is there a function or a way to compute the frequency
>>bandwidth based on the cfg inputs, or is there a fix frequency
>>bandwith for each foi here?  I am sure I am confusing a number of
>>things here, so no response is too simple.
>>Thanks for any advice, please let me know if there is more
>>information I can give or if I can clarify my questions.

More information about the fieldtrip mailing list