0
$\begingroup$

I have two EEG signals/channels and I would like to compute phase coherence in MATLAB. I have this paper: https://www.nature.com/npp/journal/v39/n5/full/npp2013330a.html but it does not say what Sij is so I don't know the formula.

Can anyone advise me on how to do this or does anyone have MATLAB code?

Many thanks.

$\endgroup$
5
  • $\begingroup$ Wouldn't the cross correlation function give you this (xcorr is Matlab)? It will give you relative coherence versus time delay between the two signals. $\endgroup$ Commented Jun 24, 2017 at 17:18
  • $\begingroup$ @DanBoschen Phase coherence outputs a value between 0 and 1. I don't think xcorr does that. $\endgroup$
    – Ali Gul
    Commented Jun 24, 2017 at 17:28
  • $\begingroup$ Sure it does, you just need to normalize it by dividing by the total number of samples and the standard deviations of both signals. $\endgroup$ Commented Jun 24, 2017 at 17:30
  • $\begingroup$ He is asking for phase coherence $\endgroup$
    – user28715
    Commented Jun 24, 2017 at 17:34
  • $\begingroup$ @StanleyPawlukiewicz Correlation implies phase coherence; the only way you can get a normalized correlation magnitude of 1 between two signals is if they are coherent in phase. The complex result will indicate the phase shift between the signals and by using the cross correlation function you can detect if there is a gross time delay between the signals (yet they are still phase coherent once aligned in time by the static offset) $\endgroup$ Commented Jun 25, 2017 at 11:01

1 Answer 1

1
$\begingroup$

Perhaps the built-in 'mscohere' and 'cpsd' functions may help you.

The mscohere function returns a value between 0 and 1 that measures the correlation between the signals, and the phase delay can be computed using the cpsd function, as per this example from the Mathworks website. It suggests that the relative phase between the correlated components can be estimated with the cross-spectrum phase.

https://uk.mathworks.com/help/signal/examples/measuring-signal-similarities.html#d119e1563

Taken from the Mathworks page above

[Cxy,f] = mscohere(sig1,sig2,[],[],[],Fs);
Pxy     = cpsd(sig1,sig2,[],[],[],Fs);
phase   = -angle(Pxy)/pi*180;
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.