Compute norm of a vector, or of a set of vectors.
N = vectorNorm(V);
Returns the euclidean norm of vector V.
N = vectorNorm(V, N);
Specifies the norm to use. N can be any value greater than 0.
N=1 -> city lock norm
N=2 -> euclidean norm
N=inf -> compute max coord.
When V is a MxN array, compute norm for each vector of the array.
Vector are given as rows. Result is then a [M*1] array.
Example
n1 = vectorNorm([3 4])
n1 =
5
n2 = vectorNorm([1, 10], inf)
n2 =
10
See Also:
vectors2d, vectorAngle
Package: matgeom