function [Y,MAX]=normmax(X) %NORMMAX Normalize columns of a matrix by the maximum of each column. % NORMMAX(X) normalizes the columns of the matrix X by the maximum % (in absolute value) of each column. % % [Y,Z]=NORMMAX(X) returns the normalized matrix in Y and the % column maximum of the matrix X in Z. [M,N]=size(X); MNX=[max(X);min(X)]; [MAX,I]=max(abs(MNX)); MAX=MAX.*sign(MNX(I)); Y=X./(ones(size((1:M)'))*MAX); if nargout==1,MAX=[];,end