Given \[ \left ( {\begin {array} {cc} 1 & 2 \\ 3 & 4 \end {array}} \right ) \] Find the mean of each column, and add this mean to each element of the corresponding column. The result should be
\[ \left ( {\begin {array} {cc} 3 & 5 \\ 5 & 7 \end {array}} \right ) \]
To subtract the mean, just replace Plus with Subtract below for Mathematica and replace
@plus
with @minus
for Matlab. This shows that Matlab bsxfun
is analogue to
Mathematica’s MapThread.