# [FieldTrip] PLV formula

Manuel Mercier manuel.mercier at einstein.yu.edu
Fri Jun 28 22:43:54 CEST 2013

```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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130628/372c9413/attachment-0001.html>
```