[FieldTrip] Time-frequency analysis with varying length trials

Justin Fleming justintracyfleming at gmail.com
Fri Jan 5 22:52:00 CET 2018

Hello all,

I'm trying to do some exploratory spectral analysis on EEG data from a
reaction time experiment, in which the trial ends as soon as the subject
detects a target. The trails are up to 6 sec in length, but they average
closer to 2-3 sec.

My goal is to make time-frequency plots, using the multi-taper method,
aligned to the end of the trial (subject response) rather than the
beginning. I tried the following approach first:

   - Flip each trial’s data in time, such that sample 1 is now the end of
   the trial
   - Nan-pad each trial so they all have the same number of samples (6 sec
   * 256 Hz = 1536 samples).
   - Perform multi-taper spectral analysis with ft_freqanalysis

It seems that FieldTrip isn’t ignoring the NaN’s when calculating the power
at each time point. Effectively, I’m limiting my data to the shortest trial
duration rather than plotting it out to the longest time point.

Any help on NaN removal with ft_freqanalysis, or if there’s a smarter way
to align time-frequency analyses to the ends of trials, would be much

Justin F.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20180105/17aa4484/attachment-0002.html>

More information about the fieldtrip mailing list