function[mat] = normalise2(mat,const) [n,m] = size(mat); if(nargin==1) const=0; end Z = sum(mat); num = (Z*const)/(1-n*const); mat = mat + repmat(num,n,1); mat = mat ./ repmat(Z,n,1);