# [FieldTrip] Power time Course (Re: fieldtrip Digest, Vol 12, Issue 13)

f.dipompeo at unich.it f.dipompeo at unich.it
Wed Nov 9 19:18:42 CET 2011

```Dear Eelke and Roemer,

thank you very much... Concerning your questions:

> Your question is not entirely clear to me. Do you want to estimate the
> timecourse of the total (i.e. non-frequency-resolved) power in your
> signal?

yes..

> Furthermore, the code you paste in your email seems valid to me. (You
> could possibly simplify it by using cfg.toi = comp.time{1}; to get an
> estimate of power at each time point in your signal. ) What does not
> seem to work, in your case?

The strange thing is that
while the 'powspctrm' output field of ft_freqanalysis contains "NaN" values,
I see its content by plotting it using ft_singleplotTFR..

Also summing up over all the frequencies in this way

cfg=[];
cfg.method = 'mtmconvol';
cfg.output = 'pow';
cfg.taper = 'hanning';
cfg.trials = 'all';
cfg.foi = 1:150;
cfg.toi = [comp.time{1}(1,1):0.02:comp.time{1}(1,end)];
cfg.t_ftimwin = 4./cfg.foi;
[freq_comp_tr] = ft_freqanalysis(cfg,comp);

pow_f=sum(freq_comp_tr.powspctrm,2);
pelec= squeeze(pow_f);

both pow_f and pelec contain NaN values, but plotting it I see the content!?

> I don't entirely understand what you referring to either, but it sounds
> at least like a within channel phenomenon? In that case, you can use
> cfg.output = 'pow', or 'fourier', which do not compute the between
> channel CSD, saving quite a bit memory.

Ok

> If you are interested in the total energy over time of your signal, but
> only for the 1-150 Hz part, it might be easier to do a bandpass, and
> taking the square of your raw signal (energy is usually squared
> amplitude I thought?). If that is what your intending though.

Right, this is the way I do it in general.. It was just to try using
field trip functions...

Thank you very much,

Francesco

```