Normalize list of vectors in MATLAB

Alec Jacobson

April 16, 2010

weblog/

If a contains a list of row-vectors then you can normalize there lengths using the following:
normalized_a = a./repmat(sqrt(sum(a.^2,2)),1,3);