Daniel@0: function B = mk_unit_norm(A) Daniel@0: % MK_UNIT_NORM Make each column be a unit norm vector Daniel@0: % function B = mk_unit_norm(A) Daniel@0: % Daniel@0: % We divide each column by its magnitude Daniel@0: Daniel@0: Daniel@0: [nrows ncols] = size(A); Daniel@0: s = sum(A.^2); Daniel@0: ndx = find(s==0); Daniel@0: s(ndx)=1; Daniel@0: B = A ./ repmat(sqrt(s), [nrows 1]); Daniel@0: