NORM Norm Calculation
Section: Array Generation and Manipulations
Usage
Calculates the norm of a matrix. There are two ways to use thenorm function. The general syntax is
y = norm(A,p)
where A is the matrix to analyze, and p is the
type norm to compute. The following choices of p
are supported
-
p = 1returns the 1-norm, or the max column sum of A -
p = 2returns the 2-norm (largest singular value of A) -
p = infreturns the infinity norm, or the max row sum of A -
p = 'fro'returns the Frobenius-norm (vector Euclidean norm, or RMS value)
-
1 <= p < infreturnssum(abs(A).^p)^(1/p) -
punspecified returnsnorm(A,2) -
p = infreturns max(abs(A)) -
p = -infreturns min(abs(A))
Examples
Here are the various norms calculated for a sample matrix
--> A = float(rand(3,4))
A =
0.2751 0.5250 0.0532 0.8315
0.9886 0.7171 0.6396 0.5145
0.5634 0.9679 0.7133 0.0706
--> norm(A,1)
ans =
2.2099
--> norm(A,2)
ans =
2.0674
--> norm(A,inf)
ans =
2.8597
--> norm(A,'fro')
ans =
2.2313
-->
quit
Next, we calculate some vector norms.
--> A = float(rand(4,1))
A =
0.0288
0.6311
0.4853
0.6145
--> norm(A,1)
ans =
1.7596
--> norm(A,2)
ans =
1.0061
--> norm(A,7)
ans =
0.6962
--> norm(A,inf)
ans =
0.6311
--> norm(A,-inf)
ans =
2.8751e-02
-->
quit
