norm
Vector and matrix norms
Description
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 p-norm of matrix n
= norm(X
,p
)X
, where
p
is 1
, 2
, or
Inf
:
If
p = 1
, thenn
is the maximum absolute column sum of the matrix.If
p = 2
, thenn
is approximatelymax(svd(X))
. This value is equivalent tonorm(X)
.If
p = Inf
, thenn
is the maximum absolute row sum of the matrix.
returns the Frobenius norm of
matrix or array n
= norm(X
,"fro")X
.
Examples
Input Arguments
Output Arguments
More About
Tips
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.