MATLAB: Find the value of summation

absfor loopindexingsummation

, where say
Now is basically value of x at i
and is value of x at index j ( all indices other than i)
For example, = 0 (i = 1),
How can I implement ??

Best Answer

sum(abs(x - x.'), 'all')