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

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Thu Jun 5 09:55:54 CEST 2014

```Hi Clara,

regarding the frequency resolution, you can best read this:
http://fieldtrip.fcdonders.nl/tutorial/timefrequencyanalysis?s[]=frequency&s[]=resolution#time-frequency_analysis_i
If you still have trouble understanding, you can check out this:

So to get an equally spaced frequency axis, you space the frequency in
cfg.foi in steps of your frequency resolution. I hope above links help
you to find out what this means and how to do that ;)

Best,
Jörn

On 6/4/2014 5:51 PM, Clara A. Scholl wrote:
> 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
>
>
>
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

--
Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging
Neuronal Oscillations Group
FieldTrip Development Team

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

Contact:
E-Mail: jm.horschig at donders.ru.nl
Tel:    +31-(0)24-36-68493
Web: http://www.ru.nl/donders