function h = avestr(A) [m,m] = size(A); h = 0; for i=1:m for j=i+1:m x = A(:,i); y = A(:,j); d = sum(abs(x-y)); h = h + d; end end h = h / (m*(m-1)); return