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