$LastChangedDate: 27-Juil-2011 $

# CL_unitVector

Vector normalization

## Calling Sequence

       [v,norms]=CL_unitVector(u)

## Description

- Normalizes vectors.

  Given a vector or matrix of vectors u, it computes the corresponding normalized vector (or matrix of vectors) v = u / ||u||.

  This function also returns the norms (norms) of the input vectors as second output argument.

- Notes:

  - If a vector is a null vector, the corresponding unit vector is undefined (%nan).

  - If u is an hypermatrix (of dimension 3), v(:,:,i) = CL_unitVector(u(:,:,i)).

## Parameters

u:

  Vector or matrix of column vectors (PxNxK). u is an hypermatrix if K>1.

v:

  Vector or matrix of column vectors with norms equal to 1 (%nan if norm(u) is 0). (PxNxK)

norms:

  Norms of input vectors. (1xNxK)

## Authors

- CNES - DCT/SB

## See also

- CL_norm

- CL_dMult

## Examples

    // With a matrix :
    u = rand(3,15);
    [v,norms] = CL_unitVector(u);

    // With an hypermatrix :
    u = rand(3,15,3);
    [v,norms] = CL_unitVector(u);