# [FieldTrip] Spacing of Frequency Axis, output from ft_freqanalysis

Clara A. Scholl clara.scholl at gmail.com
Wed Jun 4 17:51:59 CEST 2014

```Dear FieldTrip Community,

I have a question regarding the frequency axis of a fourier spectrum
calculated using ft_freqanalysis.  How do I specify the input for
ft_freqanalysis to generate an evenly spaced frequency axis?

I would like to calculate the fourier spectrum between 2 and 30 Hz in steps
of 2 Hz (foi=2:2:30), full code here:

>>>>ft_freqanalysis input specification<<<<<

subj=598;

]);

cfg=[];

cfg.channel={'E59' 'E19'};

data=ft_selectdata(cfg, dataSame);

%data=dataSame;

cfg = [];

cfg.keeptrials = 'yes';

cfg.keepindividual = 'yes';

cfg.channel = {'all'};

cfg.method       = 'mtmconvol';

cfg.output       ='fourier';

cfg.toi = -0.2:0.01:1.0;

cfg.foi = 2:2:30; %frequency steps of 2Hz

cfg.taper = 'hanning';

cfg.t_ftimwin=ones(1,15).*.2;

%cfg.t_ftimwin=1./[2:2:30];

TFR = ft_freqanalysis(cfg, data);
>>>>end input specification<<<<<

>>>>output<<<<<
TFR =

label: {2x1 cell}
dimord: 'rpttap_chan_freq_time'
freq: [1.8750 3.7500 6.2500 8.1250 10 11.8750 13.7500 16.2500
18.1250 20 21.8750 23.7500 26.2500 28.1250 30]
time: [1x121 double]
fourierspctrm: [4-D double]
cumtapcnt: [452x15 double]
elec: [1x1 struct]
cfg: [1x1 struct]

>>>>end output<<<<<

The output from this code has uneven spacing on the frequency axis.  Some
frequency intervals are 1.875 Hz and some intervals are 2.5 Hz, see
TFR.freq above.  TFR.freq is the same (uneven) for different output choices
(fourier, powandcsd) and whether the length of time windows are the same at
each frequency or vary by frequency.

How can I run ft_freqanalysis to generate an evenly spaced frequency axis?
Downstream functions (ft_connectivityanalysis with method granger) check
for an evenly spaced frequency axis.  I am using fieldtrip version
20140603.

Thanks immensely,
Clara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140604/ddf102d6/attachment-0001.html>
```