ECOVM produces an extended Covariance matrix, function [ECM] = ecovm(X); ECM= [1 X]'*[1 X]; % l is a matching column of 1's ECM is additive, i.e. it can be applied to subsequent blocks and summed up afterwards function [ECM] = ecovm(X,Y); ECM= [1 X]'*[1 Y]; % l is a matching column of 1's if [ECM_1,NN1] = ecovm(s_1); and [ECM_n,NN2] = ecovm(s_n); with [ECM,NN] = ecovm([s_1+...+s_n]); then ECM_1 + ... + ECM_n == ECM and NN1 + ... + NNn == NN see also: DECOVM.M, R2.M