function normalized = normalize( vec )
% normalized = normalize( vec )
% 
% Scales the elements of a vector vec, so that it's smallest element(s)
% becomes zero, and it's largest becomes 1.
% 
% Yannick Kremer

minv = min( vec(:) );
maxv = max( vec(:) );

normalized = (vec - minv) ./ ( maxv - minv );