freqanalysis_wltconvol.m

Markus Siegel m.siegel at UKE.UNI-HAMBURG.DE
Mon Oct 2 09:59:01 CEST 2006


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.

Best,
Markus

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.
>
> Brian
>



More information about the fieldtrip mailing list