FUNCTION REFERENCE
norm
Vector and matrix norms.
The source help has multiple entries for this name. They are preserved below in source order, including differing compatibility notes.
Source entry 1
Vector 2-norm.
Syntax
norm(v)Returns the Euclidean length of a vector.
Example
norm([3 4]) % 5Differences from MATLAB: Vectors only, no p argument. Matrices are rejected.
Source entry 2
Vector and matrix norms.
Syntax
n = norm(A)Syntax
n = norm(A, p)Vectors: p is any real number, Inf, -Inf or 'fro'; the default is 2. Other p
give sum(abs(v).^p)^(1/p), so norm([3 4], -1) is 12/7 and norm([3 4], 0) is Inf.
Matrices: p is 1 (largest column sum), 2 (largest singular value, the
default), Inf (largest row sum) or 'fro'. norm([]) is 0.
Example
norm([3 4]) % 5Differences from MATLAB: complex input is supported (|z| for the vector and matrix 1, Inf
and p norms, singular values for the matrix 2-norm). MatRust also accepts logical input;
'inf' is also accepted as text.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.