Syntax
n = norm(A)
n = norm(A,p)
Description
Thenormofa matrix is a scalar that gives some measure of the magnitude ofthe elements of the matrix. Thenormfunctioncalculates several different types of matrix norms:
n = norm(A)returns thelargest singular value ofA,max(svd(A)).
n = norm(A,p)returns adifferent kind of norm, depending on the valueofp.
Ifpis... | Thennormreturns... |
---|---|
1 | The 1-norm, or largest column sum ofA,max(sum(abs(A))). |
2 | The largest singular value (same asnorm(A)). |
inf | The infinity norm, or largest row sumofA,max(sum(abs(A'))). |
'fro' | The Frobenius-norm of matrixA,sqrt(sum(diag(A'*A))). |
WhenAisa vector:
norm(A,p) | Returnssum(abs(A).^p)^(1/p),for any 1<=p<=∞. |
norm(A) | Returnsnorm(A,2). |
norm(A,inf) | Returnsmax(abs(A)). |
norm(A,-inf) | Returnsmin(abs(A)). |
Remarks
Notenorm(x)isthe Euclidean length of a vectorx.On the other hand, MATLAB software uses "length" to denote thenumber of elementsnina vector. This example usesnorm(x)/sqrt(n)toobtain the root-mean-square (RMS) value ofann-elementvectorx.
x = [0 1 2 3]
x = 0 1 2 3
sqrt(0+1+4+9) % Euclidean length
ans = 3.7417
norm(x)
ans = 3.7417
n = length(x) % Number of elements
n = 4
rms = 3.7417/2 % rms = norm(x)/sqrt(n)
rms = 1.8708