The norm of a real vector or matrix. |
||
Syntax |
n = Norm(X, p) n = Norm(X, char) |
|
Arguments |
Name |
Description |
X |
A real vector or matrix. |
|
p |
A positive integer specifying the p Norm. The default is 2. |
|
char |
Either ‘inf’, ‘-inf’ or ‘fro.’ |
|
Outputs |
Name |
Description |
n |
The norm of X. |
|
Example 1 |
Find the norm of the vector [3, 4]. |
|
Syntax |
||
n = Norm([3, 4]) |
||
Results |
||
n = 5 |
||
Example 2 |
Find the norm of the matrix [4, 0; 0, 3] |
|
Syntax |
||
n = Norm([4, 0; 0, 3]) |
||
Results |
||
n = 4 |
||
Comments |
char = ‘inf’ returns the largest value of X in the absolute value. char = ‘-inf’ returns the smallest value of X in absolute value (only for vectors). char = ‘fro’ returns the Frobenius norm of X, which is the square root of the sum of the squared values. p = 1 returns the sum of the absolute values. p = 2 returns the Euclidean norm (or length) of a vector, and the largest singular value of a matrix. p > 2 returns the p norm of a vector. |
|
See Also: |