function s=normalize(x)
%NORMALIZE accepts a vector and ensures
% that the sum of output vector components is one.
for i = 1: size(x,2)
sum_x(i) = sum(x(:,i));
if abs(sum_x(i)) > 10^-2
scale = sum_x(i);
else
scale = 1;
end
s(:,i) = x(:,i)/scale;
end
Book Homepage | Book's MATLAB Homepage | Reducible Matrices |
Copyright � 2001 Northstar Digital Design, Inc.