MATLAB: How to write code for zero mean and scaling for a matrix of m*n dimension

digital image processing

I am having matrix of dimension m*n and want to compute zero mean of that matrix and then scaled to it for providing a error value ?

Best Answer

newmatrix = yourmatrix - mean2(yourmatrix);
newmatrix = newmatrix ./ max(abs(newmatrix(:)));