# [FieldTrip] Probem with cross frequency phase-amplitude example in FieldTrip tutorial

Deepshikha Moolchandani dm4 at bu.edu
Mon Dec 1 22:00:48 CET 2014

```Dear all

I am working on the cross frequency phase-amplitude coupling and I tried to
run the following code provided in the tutorial in the latest version of
FieldTrip (fieldtrip-lite-20141125)

""
*Calculate coherence between power and raw*
% mtmconvol
cfg = [];
cfg.method    = 'mtmconvol';
cfg.channel   = 'mix';
cfg.output    = 'pow';
cfg.taper     = 'hanning';
cfg.foi       = 2:2:60;
cfg.toi       = data.time{1}(3001:7000); %power is calculated at every
sample
cfg.t_ftimwin = 4./cfg.foi; %timewindow used to calculated power is 4
cycles long and therefore differs over frequencies
cfg.keeptrials = 'yes';

freq1 = ft_freqanalysis(cfg,data);

% Make data same length as freq1
data_cut = data;
for iTr = 1:length(data.trial)
data_cut.trial{iTr} = data.trial{iTr}(:,3001:7000);
data_cut.time{iTr}  = data.time{iTr}(3001:7000);
end

data_app = ft_appenddata([],data_cut, freq1); %contains original channel
and channels with power
%FieldTrip automatically
converts the freq1 data to raw data.

% mtmfft output cross-spectral-density between mix(raw) and freq1
cfg = [];
cfg.method    = 'mtmfft';
cfg.output    = 'powandcsd';
cfg.taper     = 'hanning';
cfg.foilim    = [2 60];
cfg.keeptrials = 'no';
cfg.channelcmb = {'mix' 'mix at 2Hz'; 'mix' 'mix at 4Hz'; 'mix' 'mix at 6Hz'; 'mix'
'mix at 8Hz'; 'mix' 'mix at 10Hz'; 'mix' 'mix at 12Hz'; 'mix' 'mix at 14Hz'; 'mix'
'mix at 16Hz'; 'mix' 'mix at 18Hz'; 'mix' 'mix at 20Hz'; 'mix' 'mix at 22Hz'; 'mix'
'mix at 24Hz'; 'mix' 'mix at 26Hz'; 'mix' 'mix at 28Hz'; 'mix' 'mix at 30Hz'; 'mix'
'mix at 32Hz'; 'mix' 'mix at 34Hz'; 'mix' 'mix at 36Hz'; 'mix' 'mix at 38Hz'; 'mix'
'mix at 40Hz'; 'mix' 'mix at 42Hz'; 'mix' 'mix at 44Hz'; 'mix' 'mix at 46Hz'; 'mix'
'mix at 48Hz'; 'mix' 'mix at 50Hz'; 'mix' 'mix at 52Hz'; 'mix' 'mix at 54Hz'; 'mix'
'mix at 56Hz'; 'mix' 'mix at 58Hz'; 'mix' 'mix at 60Hz';};

freq2 = ft_freqanalysis(cfg,data_app);

% calculate coherence
coh = ft_freqdescriptives([],freq2);

coh.freq2 = [2:2:60];
figure; imagesc(coh.freq, coh.freq2, coh.cohspctrm)
axis xy
print -dpng phalow_amphigh_fig5.png""

It gives me the following error "Reference to non-existent field
'cohspctrm'."

Can anyone tell me if I'm doing something wrong or is there a problem in
the code?
Any help would be appreciated.

Best
Deepshikha Moolchandani
Research Assistant
Brain and Vision Research Lab
Boston University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20141201/b8a9a972/attachment.html>
```