# freqanalysis_wltconvol.m question

Jan Mathijs Schoffelen Jan.Schoffelen at FCDONDERS.RU.NL
Thu Nov 9 10:37:50 CET 2006

```Dear Brian,

Freqanalysis_wltconvol does not support fourier as an output. However, since
wavelet-analysis and fft's in the end are about the same thingy, you could
use freqanalysis_mtmconvol to achieve your goal.
There is a tutorial on the fieldtrip-website which deals with this function,
and uses it in a way that it resembles a wavelet-analysis, in which the
time-frequency resolution is treated in the same way as with standard
wavelet-analysis.

Phase-locking-value is defined in fieldtrip as a bivariate-measure, so that
means that it quantifies how consistent the phase-relation between two
channels is across trials.
Inter-trial coherence is a bit an odd thingy, because the term coherence
suggests something bivariate, but the way you would like to use it, is
essentially univariate. You want to estimate how consistent the phase of the
oscillations at a particular channel is across trials.
However, both measures use similar math. In fact, when you create a
dummy-fourier-channel you can use the plv-option to obtain your 'itc'. This
is because in this situation, the mathematics become identical. I would
advise it like this:

Do your freqanalysis as Robert suggested in one of his previous mails (see
below (cfg.keeptapers = 'yes')).
Then create a dummy channel:

dim                             = size(freq.fourierspctrm;
freq.fourierspctrm(:,end+1,:,:) = ones(dim([1 3 4]));
freq.label = 'dummy';

cfg = [];
cfg.cohmethod = 'plv';
cfg.channelcmb = channelcombination({'dummy' 'all'}, freq.label); %should
work

itc = freqdescriptives(cfg, freq);

Your 'itc' now is contained in the field itc.cohspctrm;

The check whether this is correctly done is done outside fieldtrip:

itc2 = abs(mean(freq.fourierspctrm./abs(freq.fourierspctrm),1));

Yours,

Jan-Mathijs

-----Original Message-----
From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf
Of Brian Roach
Sent: Wednesday, November 08, 2006 11:13 PM
To: FIELDTRIP at NIC.SURFNET.NL
Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question

Robert,
Thanks for your quick reply.  I did not realize that
freqanalysis_wltconvol.m allowed for 'fourier' output, but maybe I need to
instead?  Also, how does ITC differ from phase-locking value?  I thought
they were the same measure.
At 04:56 PM 11/8/2006, you wrote:
>Hi Brian
>
>On 8 Nov 2006, at 21:20, Brian Roach wrote:
>>eI would like to take this complex output and use it to calculate
>>phase-locking factor, but I am not sure what parts of the power
>>transformation need to be removed - just the abs() and the
>>squaring?  Clarification of this line of code would be extremely
>
>You can use the existing code for that:
>
>For computing the phase-locking value I suggest that you use either
>   cfg.output='fourier'
>   cfg.keeptrials='yes'
>   cfg.keeptapers='yes'
>or
>   cfg.output='fourier'
>   cfg.keeptrials='yes'
>   cfg.keeptapers='no' (not needed now)
>   cfg.channelcmb = something, see the help
>in freqanalysis.
>
>Subsequently, use the option
>   cfg.cohmethod='plv'
>in freqdescriptives. In case of fourier output in freqanalysis, you
>should specify the channel combinations here.
>
>...
>Looking back at your previous mail, I see that you mean ITC and not
>PLV. The stuff above then does not apply. You can do output=fourier
>in freqanalysis and work manually on the output freq structure. I
>think that this should work
>
>magnitude = abs(freq.fourierspctrm);
>scaled    = freq.fourierspctrm ./ magnitude;
>freq.itcspctrm = mean(scaled, 1);
>freq = rmfield(freq, 'fourierspctrm');   % remove the single
>fourierspectrum, to avoid confusion
>freq.dimord = 'chan_freq_time';          % remove the rpt or rpttap
>dimension
>
>best regards,
>Robert
>

```