[FieldTrip] ft_connectivityanalysis and PLV formula

jan-mathijs schoffelen jan.schoffelen at donders.ru.nl
Mon Jul 15 10:43:07 CEST 2013

Hi Manuel,

The first formula is correct, the second isn't.
Hint: when working with the complex representation in the second formula you should use a multiplication, rather than a subtraction, and take the negative angle for the second signal.

In other words

exp(1i.*angle(x)) .* exp(-1i.*angle(y)).

This is the same as:


Hope this helps,


On Jul 8, 2013, at 3:32 PM, Manuel Mercier wrote:

> Dear Fieldtrip Community
> I am still stuck with the implementation of PLV. To be sure that I understand properly the principle of Phase Locking Value, I wrote a code to compute it. That code (see below) gave me the same results as ft_connectivityanalysis.
> plv = squeeze(abs(mean(exp(1i*(angle(data.fourierspctrm(:,electrodes_1,:,:)) -angle(data.fourierspctrm(:,electrode_2,:,:)))),1)));
> (data.fourierspctrm being produced by ft_freqanalysis).
> However, I then realized that the subtraction between the two angles should be done in the complex plane as in:
> plv = squeeze(abs(mean(exp(1i*(angle(exp(1i*(angle(data.fourierspctrm(:,electrodes_1,:,:)))) - exp(1i*(angle(data.fourierspctrm(:,electrode_2,:,:))))))),1)));
> I doubt that PLV computed through FT is wrong, but then I am circumspect since the first formula is somewhat no correct and give the same results a as ft_connectivityanalysis.
> I went to FT code and got confused by the way ft_connectivity_corr use the cross spectrum to compute PLV.
> I would greatly appreciate if someone could tell me where I am missing/misunderstanding something.
> Thanks you for your help,
> Manuel
> Manuel Mercier, PhD
> Research Fellow
> Cognitive Neurophysiology Laboratory,
> Children’s Evaluation and Rehabilitation Center (CERC),
> Departments of Pediatrics and Neuroscience
> Albert Einstein College of Medicine,
> 1225 Morris Park Avenue
> Bronx , NY 10461
> phone: +1 (718) 862 1859
> fax: +1 (718) 862 1807
> From: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl] on behalf of Manuel Mercier [manuel.mercier at einstein.yu.edu]
> Sent: Friday, June 28, 2013 4:43 PM
> To: fieldtrip at science.ru.nl
> Subject: [FieldTrip] PLV formula
> Dear Fieldtripers
> Sometime ago I wrote for myself a function that was computing PLV and some related non parametric statistics.
> (Phase Locking Value as define as the mean across trials of the phase angle difference recorded at two loci ; based on Lachaux et al., 1999, HBM).
> I implemented PLV in matlab using the following formula:
> plv = squeeze(abs(mean(exp(1i*(angle(data.fourierspctrm(:,cmb(1),:,:)) ...
>                                                 -angle(data.fourierspctrm(:,cmb(2),:,:)))),1)));
> with cmb(1) and cmb(2) being the indices of the electrodes of interest (between which PLV is computed).
> I compared my results with the ft_connectivityanalysis function from Fieldtrip and the results were exactly the same.
> So far so good.
> But I recently went back to my code, and I was a little bit confused.
> Since I was dealing with angles, I though that the best way to do the subtraction should be done in the complex plane
> Like:
> plv = squeeze(abs(mean(exp(1i*(angle(exp(1i*(angle(data.fourierspctrm(:,cmb(1),:,:)))) ...
>                                                         - exp(1i*(angle(data.fourierspctrm(:,cmb(2),:,:))))))),1)));
> (for instance if the two angles: pi/2 and -pi/2 the direct subtraction will give pi,
> whereas in the complex plan it will be pi/2 - with the norm x2).
> The result I got with this code is obviously different from the previous one, and what I got from Fieldtrip.
> I went back to the archive of the mailing list but didn't find a clear answer to my point. Does anyone can enlighten me ?
> Thanks !
> Manuel
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

Jan-Mathijs Schoffelen, MD PhD 

Donders Institute for Brain, Cognition and Behaviour, 
Centre for Cognitive Neuroimaging,
Radboud University Nijmegen, The Netherlands

Max Planck Institute for Psycholinguistics,
Nijmegen, The Netherlands

J.Schoffelen at donders.ru.nl
Telephone: +31-24-3614793


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130715/458079dc/attachment-0002.html>

More information about the fieldtrip mailing list