How can I set the values in x that are above the mean to their difference from the mean.
x = [3 15 9 12 -1 0 -12 9 6 1]
How can I set the values in x that are above the mean to their difference from the mean.
x = [3 15 9 12 -1 0 -12 9 6 1]
x = [3 15 9 12 -1 0 -12 9 6 1];
m = mean(x);
idx = (x>m);
x(idx) = x(idx) - m;