How is the orthogonalization symmetric in the "bst_henv.m" function?


I was wondering how the orthogonalization is coded to be symmetric into the function "bst_henv.m". I find the following code in the .m file:


I recognize the orthogonalization method as the one in the article of Hipp et al. (2012):


But I can't really see the two orthogonalizations and the averaging afterwards. This is probably my lack of coding knowledge, but I am trying to learn it so any explanation would be helpful.

Thanks in advance!

This is a question for the author of the function: @hossein27en

Hi @gvh,

The two orthogonalizations happen in

Xext    = repmat(tXh,1,nSig) ;
Yext    = repelem(tXh,1,nSig) ;    
Yext_p  = imag(bsxfun(@times, Yext, conj(Xext)./abs(Xext)));

This operation is performed for each band, we can let aside the frequency dimension for now. Consider two (column vector) signals u and v with their corresponding analytic signals [ũ, ], and the variable tXh containing those signals, this is to say: tXh = [ũ, ]

Then, Xext is equal to [ũ, , ũ, ] , and Yext is equal to [ũ, ũ, , ] .
The operation is performed for each column vector, thus: Yext_p = [ũ⟂ũ, ũ⟂ṽ, ṽ⟂ũ, ṽ⟂ṽ]. Lastly, the correlation is computed and reshaped in

CorrMat = reshape(diag(corrFcn(abs(Xext),abs(Yext_p))),nSig,nSig) ;

In this case, CorrMat is a [2×2] matrix with:
[corr(|ũ|, |ũ⟂ũ|), corr(|ṽ|, |ũ⟂ṽ|) ; corr(|ũ|, |ṽ⟂u|), corr(|ṽ|, |ṽ⟂ṽ|)]

The average happens later in the line:

A(:,:,t,f) = (abs(CorrMat) + abs(CorrMat'))/2 ;


1 Like

I see, thank you very much for the clarification!


I have an additional question, but no pressure if you do not want to answer it. The averaging uses absolute values (indicated in the comment above it with the assumption that all measures are "non-negative"). How is it still possible to obtain negative AEC values?

Many thanks in advance!

The amplitude envelopes, |ũ| and |ṽ|, are not negative. However their correlation can take negative values.