[FieldTrip] Time normalisation for trials of different lenghts

Bange, Manuel Manuel.Bange at unimedizin-mainz.de
Mon Sep 11 14:32:57 CEST 2017

```Dear fieldtrip community,

My name is Manuel Bange and I am working in the Movement Disorder and Neurostimulation Lab in Mainz, Germany. Currently I am working on a project where we recorded EEG and EMG data combined with simultaneously recorded ground reaction forces during walking on a treadmill. I intend to use complete gait cycles as trials in order to, for example, calculate the inter-trial coherence. The issue I now face is that every cycle lasts a different amount of time.
In a first step I have separated the continuous data into trials that correspond to whole gait cycles. One cycle starts with the onset of the right foot and ends one sample before the following onset of the same foot. This results in a number of trials (around 18 per subject) of different lengths.
Following this, I performed a time-frequency analysis for each individual trial by

1.       selecting a specific trial

cfg.trials      = 2;                                                               % select a a trial, here trial 2

trial2 = ft_selectdata(cfg, data)

2.       performing time-frequency analysis

cfg          = [];

cfg.output   = 'pow';

cfg.method   = 'mtmconvol';

cfg.taper    = 'hanning';

cfg.foi      = [1:1:40];

cfg.t_ftimwin    = ones(length(cfg.foi),1).*1;

cfg.toi          = trial2.time{1,1}(1,125):0.01:trial2.time{1,1}(1,end-125-1);

cfg.keeptrials = 'yes'

data_tfa1     = ft_freqanalysis(cfg, trial2);
resulting in
data_tfa1 =
struct with fields:
label: {257×1 cell}
dimord: 'rpt_chan_freq_time'
freq: [1×40 double]
time: [1×172 double]                                                                    % differs for each trial
powspctrm: [1×257×40×172 double]
cumtapcnt: [1×40 double]
cfg: [1×1 struct]

Now my question is:
Is there a way to normalise this data over the time-axis, so that all trials have the same length? This is important to calculate an average time-frequency representation, or in another step, to calculate the inter-trial coherence. I have thought of normalising the time axis and interpolating the corresponding power-values.

Thanks and best regards,

Manuel Bange
M.Sc. Sports Science

Johannes-Gutenberg-University Hospital
Movement Disorders and Neurostimulation
Department of Neurology
Langenbeckstr. 1
55131 Mainz, Germany
www.unimedizin-mainz.de

Email: manuel.bange at unimedizin-mainz.de

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170911/2eed0d2d/attachment-0001.html>
```