Vector and matrix norms

returns the Euclidean norm of
vector `n`

= norm(`v`

)`v`

. This norm is also called the 2-norm, vector
magnitude, or Euclidean length.

returns the generalized vector
p-norm.`n`

= norm(`v`

,`p`

)

returns the `n`

= norm(`X`

,`p`

)*p*-norm of matrix `X`

, where
`p`

is `1`

, `2`

, or
`Inf`

:

If

`p = 1`

, then`n`

is the maximum absolute column sum of the matrix.If

`p = 2`

, then`n`

is approximately`max(svd(X))`

. This is equivalent to`norm(X)`

.If

`p = Inf`

, then`n`

is the maximum absolute row sum of the matrix.

returns the Frobenius norm of
matrix `n`

= norm(`X`

,'fro')`X`

.

Use

`vecnorm`

to treat a matrix or array as a collection of vectors and calculate the norm along a specified dimension. For example,`vecnorm`

can calculate the norm of each column in a matrix.