# [FieldTrip] Phase synchronization and coherence spectrum

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Mon Jun 8 18:12:41 CEST 2020

```Dear Laurent,

Hmmm, interesting that you managed to find this tutorial, since it does not seem to be linked. This is a very ‘old’ tutorial (i.e. > 15 years), and hasn’t been updated for quite a while. You are indeed correct that the x-axis represents frequency bins, but given the way that the data are plotted, i.e. as plot(<some-vector>) these frequency bins are not reflecting physical units as expressed in Hz. Rather, the number of points in the graph just reflect the number of points of the fft, which is by definition equal to the number of samples in the time domain signal. These frequency bins essentially span an axis that runs from 0 Hz up to (in this case) twice the Nyquist frequency (minus a little bit), where the Nyquist frequency is defined as the sampling frequency divided by 2. In other words, the 100 ‘bins’ on the frequency axis run from 0 to 99 Hz, which nicely correspond to a bin width of 1 Hz per bin. As you see in the graph, the coherence peak is actually at the 11’th bin, coinciding with a frequency of 10 Hz.
Now, if you change the length of  your signal to 2.5 seconds (at a sampling frequency of 100 Hz), your signals will be 250 samples long, and by consequence the fft of the signals will also be 250 samples long. Now the total frequency range (i.e. 0 Hz up to 100 Hz minus a bit) will be divided into 250 bins. This indeed causes the bin with the maximum coherence to be the 26th bin, but this still corresponds to a physical frequency of 10 Hz, because the bin width has changed from 1 bins/Hz into 2.5 bins/Hz.

Best wishes,
Jan-Mathijs

On 8 Jun 2020, at 14:27, Laurent Sheybani <Laurent.Sheybani at unige.ch<mailto:Laurent.Sheybani at unige.ch>> wrote:

Dear Fieldtrippers,

I am trying to implement the example provided here (http://www.fieldtriptoolbox.org/tutorial/fourier/) to measure the phase synchronization between two signals. I followed the paragraph starting by “The coherence spectrum”.

From what I understand of the “Coherence spectrum” example script of this web-page, the plot that one should obtain when calling plot(coh) is a 2-D plot with the y-axis corresponding to the coherence index between 0 to 1 and x-axis corresponding to frequencies (right ?).

However, when I changed the length of the signal (argument “len”), I noticed that the frequency (x-) axis increased by the same factor (e.g. if I change len from 1 to 2.5, the x-axis changes from 100 to 250). The coherence is no more on 10 Hz, but on 25 Hz. I must have missed something simple, but I do not understand why the results (& frequency axis) depend on the duration of the signal ? Did I miss a normalization somewhere ?

Any help would be greatly appreciated !

-----------------------------
Dr. Laurent Sheybani, Ph.D
Médecin interne en Neurologie Clinique
Clinique de Neurologie
Hôpitaux Universitaires de Genève
Rue Gabrielle-Perret-Gentil, 4
1205 Genève
Switzerland

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200608/11b350a3/attachment.htm>
```