Skip to Main Content Skip to Search
Product Documentation

norm - Vector and matrix norms

Syntax

n = norm(X,2)
n = norm(X)
n = norm(X,1)
n = norm(X,Inf)
n = norm(X,'fro')
n = norm(v,p)
n = norm(v,Inf)
n = norm(v,-Inf)

Description

The norm function calculates several different types of matrix and vector norms. If the input is a vector or a matrix:

n = norm(X,2) returns the 2-norm of X.

n = norm(X) is the same as n = norm(X,2).

n = norm(X,1) returns the 1-norm of X.

n = norm(X,Inf) returns the infinity norm of X.

n = norm(X,'fro') returns the Frobenius norm of X.

In addition, when the input is a vector v:

n = norm(v,p) returns the p-norm of v. The p-norm is sum(abs(v).^p)^(1/p).

n = norm(v,Inf) returns the largest element of abs(v).

n = norm(v,-Inf) returns the smallest element of abs(v).

Tips

By convention, norm returns NaN if the input matrix X or input vector v contains NaN values.

See Also

cond | condest | hypot | normest | rcond

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS