Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Vector and matrix norms

`n = norm(v)`

`n = norm(v,p)`

`n = norm(X)`

`n = norm(X,p)`

`n = norm(X,'fro')`

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.