function E= energy(X) Y = X(:); E = real(Y'*Y/length(Y));