Problems with frequency analysis...

Carina Graversen cgra05 at HST.AUC.DK
Thu Jun 5 14:13:34 CEST 2008


I have a problem regarding the function "freqanalysis", that I hope
some of you can help me with.

I have a Neuroscan .avg file called testdata.avg, and I would like to
see a time-frequency plot of all the 64 channels.

In order to do this, I try the following:

cfg1                                    = [];
cfg1.datafile                           = 'testdata.avg'
cfg1.headerfile                         = 'testdata.avg'
dataFIC                                 = preprocessing(cfg1);

This gives me the data in dataFIC, and if I look at the data in
dataFIC.trial{1} I get the correct data for all the 64 channels, so no
problem here :o).

The next I try is:

cfg2                                    = [];
cfg2.output                             = 'pow';                            = 'all';
cfg2.method                             = 'mtmconvol';
cfg2.taper                              = 'hanning';
cfg2.foi                                = 2:2:30;
cfg2.t_ftimwin                          = ones(length(cfg2.foi),1).*0.5;
cfg2.toi                                = 0.050:0.005:0.500;

TFRhann                                 = freqanalysis(cfg2, dataFIC);

I would have expected to get the time-frequency coefficients in the
TFRhann.powspctrm, but all I get is a lot of NaNs :o(.

Am I doing something wrong, and should I set more parameters for the cfg2 ???

When the problem with the freqanalysis is solved, I expect to be able
to make the plots this way - does it look right (the testlay_64.lay
file is one I have generated myself, and if I just run the code with
the TFRhann with all the NaNs, at least the electrodes appear at the
right location in the plot.

cfg3.zparam     = 'powspctrm';
cfg3.xlim       = [0 0.5];
cfg3.ylim       = [1 29];
cfg3.zlim       = [-3e-27 3e-27];
cfg3.layout     = 'testlay_64.lay';
cfg3.showlabels = 'yes';

multiplotTFR(cfg3, TFRhann)

I look forward to all suggestions regarding the problems with "freqanalysis".

Best regards,
Carina Graversen
Ph.D student at Aalborg Hospital, Denmark

The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also and

More information about the fieldtrip mailing list