Coherence measure definition

Hi Guys,
I am looking at the function bst_cohn and it give the following definition:
Gxy: cross-spectral density between x and y
Gxx: autospectral density of x
Gyy: autospectral density of y
Coherence function C : Gxy/sqrt(Gxx*Gxy)
Magnitude-squared Coherence (MSC) : |C|^2 = |Gxy|^2/(Gxx*Gxy) = Gxyconj(Gxy)/(Gxx*Gxy)

However, I’m pretty sure Coherence should be Gxy/sqrt(Gxx*Gyy).
It seems that in the code you are doing it correct, but I wanted to be sure:

Coherence = |C|^2 = |Gxy|^2/(GxxGxy) = Gxyconj(Gxy)/(GxxGxy)
Gxy = Gxy .
conj(Gxy); % SLOWER
Gxy = abs(Gxy) .^ 2;
Gxy = bst_bsxfun(@rdivide, Gxy, Gxx);
Gxy = bst_bsxfun(@rdivide, Gxy, Gyy);

Can you confirm that I am understanding correctly? Is it just the definition that is wrong?

Beth

1 Like

Thank you, Beth.

@hossein27en: can you please have look and advise? Thanks!

Beth, FYI: we will migrate all connectivity metrics soon to a more robust implementation done by Hossein. In the meantime though, we need to make sure that the documentation of the current implementation is correct.

Best,

Sylvain.

1 Like

Dear Beth @ebock ,

Many thanks for your note.

You are right. There are typos in the definition. Those Gxy in denominators should be replaced by Gyy. However, as you mentioned, the code is correct and works well.

@Francois While we are working to implement the new functions, can you fix this one? Just a small change in comments. Nothing inside the code. Thanks

Hossein

1 Like

Done:

1 Like