n = 4; S = [1,2,3,4]; O = [4,3,2,1]; sum = 0; for i=1:n sum = sum + ( O(i) - S(i) )^2; end Ej = sqrt(sum)