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

Dear Raymundo.Cassani and Francois,

Recently, I conducted simulations on two signal segments and executed the code you provided:

t = 0:0.01:2*pi;
u = sin(t)';
v = cos(t)';
u_analytic = hilbert(u);
v_analytic = hilbert(v);
tXh = [u_analytic,v_analytic];
Xext    = repmat(tXh,1,2) ;
Yext    = repelem(tXh,1,2) ;    
Yext_p  = imag(bsxfun(@times, Yext, conj(Xext)./abs(Xext)));
CorrMat = reshape(diag(corr(abs(Xext),abs(Yext_p))),2,2) ;
A(: , :) = (abs(CorrMat) + abs(CorrMat'))/2 ;

The results I obtained are as follows:

0.067989	0.092222
0.092222	0.034612

However, according to your explanation, CorrMat is a [2×2] matrix with the elements:

[corr(|ũ|, |ũ⟂ũ|), corr(|ṽ|, |ũ⟂ṽ|) ; corr(|ũ|, |ṽ⟂u|), corr(|ṽ|, |ṽ⟂ṽ|)]

The diagonal elements of the correlation matrix should have a value of 1. However, it is evident that I did not obtain this result in my simulation.

Similarly, I also used the "HOrthCorr" function from "bst_henv.m" to calculate the orthogonalized envelope correlation.

t = 0:0.01:2*pi;
Xh = hilbert(cos(t))';
ConVec = HOrthCorr(Xh, Xh);

When both signals are perfectly identical, I obtained a correlation value of 0.067989.

As per my understanding, when the two signals are identical, the correlation should ideally be 1. However, the result I obtained seems to deviate significantly from this expectation. I would be extremely grateful if you could shed some light on this observation and help me comprehend the reasons behind this unexpected outcome. I want to ensure that my calculations are accurate and that I am correctly utilizing the "bst_henv.m" function.
If there are any specific considerations or steps that I might be missing in the process, please guide me through them to rectify the issue.
Thank you for your invaluable assistance, and I look forward to your insights.

Best regards,
Yanxi