# Envelope Correlation N x N (2020) - Dimensions of arrays being concatenated are not consistent

We tested further the comparison between the older AEC and the new HENV processes.
You can reproduce exactly the results obtained the new HENV results with the older processes AEC by editing `bst_connectivity.m`.
Eeplace line 504:

``````R(:,:,iBand) = (R(:,:,iBand)+R(:,:,iBand)')/2;
``````

with

``````R(:,:,iBand) = (abs(R(:,:,iBand))+abs(R(:,:,iBand))')/2;
``````

And replace line 515:

``````R(iSeed,:,iBand) = (r1+r2)/2;
``````

with:

``````R(iSeed,:,iBand) = (abs(r1)+abs(r2))/2;
``````

Explaination from Hossein:

Amplitude envelope correlation is not a symmetric measure by its nature. Still, most people have used it as symmetric, and there is no clear explanation about the meaning of the connectivity from A->B Vs. B->A.
As a result, my code and the AEC make the matrix symmetric by adding its transpose and dividing over 2. However, I apply abs() before summation, but the AEC does not (so if there is a negative value, it might cancel the positive one). I do think the abs value is necessary. In MNE-python, they have abs as the default.

1 Like