<html><head><base href="x-msg://147/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Manuel,<div><br></div><div>The first formula is correct, the second isn't.</div><div>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.</div><div><br></div><div>In other words</div><div><br></div><div>exp(1i.*angle(x)) .* exp(-1i.*angle(y)).</div><div><br></div><div>This is the same as:</div><div><br></div><div>exp(1i.*(angle(x)-angle(y))).</div><div><br></div><div>Hope this helps,</div><div><br></div><div>Jan-Mathijs</div><div><br></div><div><br><div><div>On Jul 8, 2013, at 3:32 PM, Manuel Mercier wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div ocsi="0" fpstyle="1"><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; ">Dear Fieldtrip Community<br>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.<br><font color="000000">plv = squeeze(abs(mean(exp(1i*(angle(data.fourierspctrm(:,electrodes_1,:,:)) -angle(data.fourierspctrm(:,electrode_2,:,:)))),1)));</font><br>(<font color="000000">data.fourierspctrm being produced by ft_freqanalysis</font>).<br><br>However, I then realized that the subtraction between the two angles should be done in the complex plane as in:<br><font color="000000">plv = squeeze(abs(mean(exp(1i*(angle(exp(1i*(angle(data.fourierspctrm(:,electrodes_1,:,:)))) - exp(1i*(angle(data.fourierspctrm(:,electrode_2,:,:))))))),1)));</font><br><br>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.<br>I went to FT code and got confused by the way ft_connectivity_corr use the cross spectrum to compute PLV.<br>I would greatly appreciate if someone could tell me where I am missing/misunderstanding something.<br>Thanks you for your help,<br><br>Manuel<br><br><div><br><div style="font-family: Tahoma; font-size: 13px; "><div style="font-family: Tahoma; font-size: 13px; "><div style="font-family: Tahoma; font-size: 13px; "><hr style="width: 981px; height: 2px; "><br>Manuel Mercier, PhD<br>Research Fellow<br><br>Cognitive Neurophysiology Laboratory,<br>Children’s Evaluation and Rehabilitation Center (CERC),<br>Departments of Pediatrics and Neuroscience<br>Albert Einstein College of Medicine,<br>1225 Morris Park Avenue<br>Bronx , NY 10461<br><br>phone: +1 (718) 862 1859<br>fax: +1 (718) 862 1807</div></div></div></div><div style="font-family: 'Times New Roman'; color: rgb(0, 0, 0); font-size: 16px; "><hr tabindex="-1"><div id="divRpF910756" style="direction: ltr; "><font color="#000000" face="Tahoma" size="2"><b>From:</b><span class="Apple-converted-space"> </span><a href="mailto:fieldtrip-bounces@science.ru.nl">fieldtrip-bounces@science.ru.nl</a><span class="Apple-converted-space"> </span>[fieldtrip-bounces@science.ru.nl] on behalf of Manuel Mercier [manuel.mercier@einstein.yu.edu]<br><b>Sent:</b><span class="Apple-converted-space"> </span>Friday, June 28, 2013 4:43 PM<br><b>To:</b><span class="Apple-converted-space"> </span><a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a><br><b>Subject:</b><span class="Apple-converted-space"> </span>[FieldTrip] PLV formula<br></font><br></div><div></div><div><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; "><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; "><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; ">Dear Fieldtripers<br>Sometime ago I wrote for myself a function that was computing PLV and some related non parametric statistics.<br>(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).<br>I implemented PLV in matlab using the following formula:<br><i><font color="0000FF">plv = squeeze(abs(mean(exp(1i*(angle(data.fourierspctrm(:,cmb(1),:,:)) ...<br>                                                -angle(data.fourierspctrm(:,cmb(2),:,:)))),1)));</font></i><br>with cmb(1) and cmb(2) being the indices of the electrodes of interest (between which PLV is computed).<br>I compared my results with the ft_connectivityanalysis function from Fieldtrip and the results were exactly the same.<br>So far so good.<br><br>But I recently went back to my code, and I was a little bit confused.<br>Since I was dealing with angles, I though that the best way to do the subtraction should be done in the complex plane<br>Like:<br><i><font color="0000FF">plv = squeeze(abs(mean(exp(1i*(angle(exp(1i*(angle(data.fourierspctrm(:,cmb(1),:,:)))) ...<br>                                                  </font>     <font color="0000FF"><span class="Apple-converted-space"> </span>- exp(1i*(angle(data.fourierspctrm(:,cmb(2),:,:))))))),1)));</font></i><br>(for instance if the two angles: pi/2 and -pi/2 the direct subtraction will give pi,<br>whereas in the complex plan it will be pi/2 - with the norm x2).<br><br>The result I got with this code is obviously different from the previous one, and what I got from Fieldtrip.<br>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 ?<br>Thanks !<br><br>Manuel<br><br><div><br></div></div></div></div></div></div></div>_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div></span></blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Jan-Mathijs Schoffelen, MD PhD </div><div><br></div><div>Donders Institute for Brain, Cognition and Behaviour, <br>Centre for Cognitive Neuroimaging,<br>Radboud University Nijmegen, The Netherlands</div><div><br></div><div>Max Planck Institute for Psycholinguistics,</div><div>Nijmegen, The Netherlands</div><div><br></div><div><a href="mailto:J.Schoffelen@donders.ru.nl">J.Schoffelen@donders.ru.nl</a></div><div>Telephone: +31-24-3614793</div><div><br></div><div><a href="http://www.hettaligebrein.nl">http://www.hettaligebrein.nl</a></div></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></span>
</div>
<br></div></body></html>