Problems with frequency analysis...

Carina Graversen cgra05 at HST.AUC.DK
Thu Jun 12 14:00:35 CEST 2008


Hi Jan.

Thanks for your reply - that helped quite a lot  :o).

However, now I have another problem, when I want to plot the
time-frequency results. I use the code below, and as you will notice I
just load an .avg file, and overwrite all the data in the file to be a
single sinusoid with a frequency of 5 Hz.

However, the results I get from multiplotTFR doesn't look as expected :o(

The data I put in dataFIC.trial for all channels can be watched at:
http://www.hst.auc.dk/~cgra/fieldtrip_timeplot.jpg

And the result from multiplot TFR can be seen at:
http://www.hst.auc.dk/~cgra/fieldtrip_multiplotTFR.jpg

- where I of course would have expected to have high power for all time
instances at a frequency of 5 Hz. So I was wondering if anyone can tell
which parameter to change in my configuration variables :o).

Best regards, Carina







function [] = diabetestest()

close all
clear all
clc

cfg1                                    = [];
cfg1.datafile                           = 'diabetestest.avg'
cfg1.headerfile                         = 'diabetestest.avg'

dataFIC                                 = preprocessing(cfg1);

% *************************************************************************
% ------------------------------ DEBUG CODE ------------------------------
% *************************************************************************

test_frequency   =    5;      % Test frequency
sample_frequency = 1000;      % Sample frequency

% Generating the dummy signal:
for i = 1:301
     dummy_signal(i)= 5*sin(2*pi*test_frequency*i/sample_frequency);
end

for i = 1:1:68
  dummy_matrix(i, :) = dummy_signal;  end

dataFIC.trial{1} = dummy_matrix;

figure(101)
plot(dummy_matrix(1, :), 'r')

% *************************************************************************
% --------------------------- END OF DEBUG CODE ---------------------------
% *************************************************************************

cfg2                                    = [];
cfg2.method                             = 'wltconvol'; %= 'mtmconvol';
cfg2.output                             = 'pow';
cfg2.channel                            = 'all';
cfg2.foi                                = 0.1:0.05:20;
cfg2.toi                                = 0.050:0.001:0.300
cfg2.width                              = 0.0005;

TFRhann                                 = freqanalysis(cfg2, dataFIC);

% -------------------------------------------------------------------------

cfg3.zparam     = 'powspctrm';
cfg3.xlim       = [0.050 0.300];
cfg3.ylim       = [1 10];
cfg3.layout     = 'testlay_64.lay';
cfg3.showlabels = 'yes';

multiplotTFR(cfg3, TFRhann)

% -------------------------------------------------------------------------

% cfg4 = [];
% cfg4.channel   = 'FP1';
% clf
% % singleplotTFR(cfg4, TFRhann);

----------------------------------
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 http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/fcdonders/fieldtrip.



More information about the fieldtrip mailing list