Norm of matrix or vector
norm(A)
norm(A,p)
norm(V)
norm(V,P)
example
norm(A) returns the 2-norm of matrix A. Because symbolic variables are assumed to be complex by default, the norm can contain unresolved calls to conj and abs.
A
2
conj
abs
norm(A,p) returns the p-norm of matrix A.
p
norm(V) returns the 2-norm of vector V.
V
norm(V,P) returns the P-norm of vector V.
P
collapse all
Compute the 2-norm of the inverse of the 3-by-3 magic square A:
A = inv(sym(magic(3))) norm2 = norm(A)
A = [ 53/360, -13/90, 23/360] [ -11/180, 1/45, 19/180] [ -7/360, 17/90, -37/360] norm2 = 3^(1/2)/6
Use vpa to approximate the result with 20-digit accuracy:
vpa
vpa(norm2, 20)
ans = 0.28867513459481288225
Compute the norm of [x y] and simplify the result. Because symbolic variables are assumed to be complex by default, the calls to abs do not simplify.
[x y]
syms x y simplify(norm([x y]))
ans = (abs(x)^2 + abs(y)^2)^(1/2)
Assume x and y are real, and repeat the calculation. Now, the result is simplified.
x
y
assume([x y],'real') simplify(norm([x y]))
ans = (x^2 + y^2)^(1/2)
Remove assumptions on x for further calculations. For details, see Use Assumptions on Symbolic Variables.
assume(x,'clear')
Compute the 1-norm, Frobenius norm, and infinity norm of the inverse of the 3-by-3 magic square A:
1
A = inv(sym(magic(3))) norm1 = norm(A, 1) normf = norm(A, 'fro') normi = norm(A, inf)
A = [ 53/360, -13/90, 23/360] [ -11/180, 1/45, 19/180] [ -7/360, 17/90, -37/360] norm1 = 16/45 normf = 391^(1/2)/60 normi = 16/45
Use vpa to approximate these results to 20-digit accuracy:
vpa(norm1, 20) vpa(normf, 20) vpa(normi, 20)
ans = 0.35555555555555555556 ans = 0.32956199888808647519 ans = 0.35555555555555555556
Compute the 1-norm, 2-norm, and 3-norm of the column vector V = [Vx; Vy; Vz]:
3
V = [Vx; Vy; Vz]
syms Vx Vy Vz V = [Vx; Vy; Vz]; norm1 = norm(V, 1) norm2 = norm(V) norm3 = norm(V, 3)
norm1 = abs(Vx) + abs(Vy) + abs(Vz) norm2 = (abs(Vx)^2 + abs(Vy)^2 + abs(Vz)^2)^(1/2) norm3 = (abs(Vx)^3 + abs(Vy)^3 + abs(Vz)^3)^(1/3)
Compute the infinity norm, negative infinity norm, and Frobenius norm of V:
normi = norm(V, inf) normni = norm(V, -inf) normf = norm(V, 'fro')
normi = max(abs(Vx), abs(Vy), abs(Vz)) normni = min(abs(Vx), abs(Vy), abs(Vz)) normf = (abs(Vx)^2 + abs(Vy)^2 + abs(Vz)^2)^(1/2)
Input, specified as a symbolic matrix.
inf
'fro'
One of these values 1, 2, inf, or 'fro'.
norm(A,1) returns the 1-norm of A.
norm(A,1)
norm(A,2) or norm(A) returns the 2-norm of A.
norm(A,2)
norm(A,inf) returns the infinity norm of A.
norm(A,inf)
norm(A,'fro') returns the Frobenius norm of A.
norm(A,'fro')
Input, specified as a symbolic vector.
norm(V,P) is computed as sum(abs(V).^P)^(1/P) for 1<=P<inf.
sum(abs(V).^P)^(1/P)
1<=P<inf
norm(V) computes the 2-norm of V.
norm(A,inf) is computed as max(abs(V)).
max(abs(V))
norm(A,-inf) is computed as min(abs(V)).
norm(A,-inf)
min(abs(V))
The 1-norm of an m-by-n matrix A is defined as follows:
‖A‖1=maxj(∑i=1m|Aij|), where j=1…n
The 2-norm of an m-by-n matrix A is defined as follows:
‖A‖2=max eigenvalue of AHA
The 2-norm is also called the spectral norm of a matrix.
The Frobenius norm of an m-by-n matrix A is defined as follows:
‖A‖F=∑i=1m(∑j=1n|Aij|2)
The infinity norm of an m-by-n matrix A is defined as follows:
‖A‖∞=max(∑j=1n|A1j|, ∑j=1n|A2j|,…,∑j=1n|Amj|)
The P-norm of a 1-by-n or n-by-1 vector V is defined as follows:
‖V‖P=(∑i=1n|Vi|P)1P
Here n must be an integer greater than 1.
The Frobenius norm of a 1-by-n or n-by-1 vector V is defined as follows:
‖V‖F=∑i=1n|Vi|2
The Frobenius norm of a vector coincides with its 2-norm.
The infinity norm of a 1-by-n or n-by-1 vector V is defined as follows:
‖V‖∞=max(|Vi|), where i=1…n
The negative infinity norm of a 1-by-n or n-by-1 vector V is defined as follows:
‖V‖−∞=min(|Vi|), where i=1…n
Calling norm for a numeric matrix that is not a symbolic object invokes the MATLAB® norm function.
norm
cond | equationsToMatrix | inv | linsolve | rank
cond
equationsToMatrix
inv
linsolve
rank