function [mat] = normlog3(mat,const) [dim1, dim2] = size(mat); % oldmat = mat; mat = mat - max(max(mat)); mat = exp(mat); Z = sum(sum(mat)); Zstar = Z / (1- dim1*dim2*const); mat = (mat / Zstar) + const; % if (~(sum(sum(mat)) <=0 | sum(sum(mat)) >=0)) % % fprintf(1,'problem normlog!\n'); % % mat % % oldmat % % dbstop if error; % % % end