<div dir="ltr"><div>Dear FieldTrip Community,</div><div><br></div><div>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? </div>
<div><br></div><div>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:</div><div><br></div><div>>>>>ft_freqanalysis input specification<<<<<</div>
<div><p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier">subj=598;</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier;min-height:12.0px"> </p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier;color:#b04ff1"><span style="color:#000000">load([</span>'../subj'<span style="color:#000000"> num2str(subj) </span>'FT_sameDiff_correctTrials_continuous_1secBlinkInt500hz0.1hz-30hz_fromContinuous_start-0.4end1.2.mat'<span style="color:#000000">]);</span></p>

<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier">cfg=[];</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier">cfg.channel={<span style="color:#b04ff1">'E59'</span> <span style="color:#b04ff1">'E19'</span>};</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier">data=ft_selectdata(cfg, dataSame);</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier;color:#2e9833">%data=dataSame;</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier;color:#2e9833;min-height:12.0px"> </p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier">cfg = [];</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier">cfg.keeptrials = <span style="color:#b04ff1">'yes'</span>;</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier">cfg.keepindividual = <span style="color:#b04ff1">'yes'</span>;</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier">cfg.channel = {<span style="color:#b04ff1">'all'</span>};</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier">cfg.method       = <span style="color:#b04ff1">'mtmconvol'</span>;</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier">cfg.output       =<span style="color:#b04ff1">'fourier'</span>;</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier">cfg.toi = -0.2:0.01:1.0;</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier;min-height:12.0px"> </p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier;color:#2e9833"><span style="color:#000000">cfg.foi = 2:2:30; </span>%frequency steps of 2Hz</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier">cfg.taper = <span style="color:#b04ff1">'hanning'</span>;</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier">cfg.t_ftimwin=ones(1,15).*.2;</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier;color:#2e9833">%cfg.t_ftimwin=1./[2:2:30];</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier;color:#2e9833;min-height:12.0px"> </p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:10.0px Courier">TFR = ft_freqanalysis(cfg, data);</p></div><div>>>>>end input specification<<<<<</div><div><br></div><div>>>>>output<<<<<</div>
<div><div>TFR = </div><div><br></div><div>            label: {2x1 cell}</div><div>           dimord: 'rpttap_chan_freq_time'</div><div>             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]</div>
<div>             time: [1x121 double]</div><div>    fourierspctrm: [4-D double]</div><div>        cumtapcnt: [452x15 double]</div><div>             elec: [1x1 struct]</div><div>              cfg: [1x1 struct]</div></div>
<div><br></div><div>>>>>end output<<<<<</div><div><br></div><div>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.</div>
<div><br></div><div>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.  </div>
<div><br></div><div>Thanks immensely,</div><div>Clara</div><div><br></div><div><br></div><div><br></div><div><br></div></div>