发布时间:2025-12-10 19:40:53 浏览次数:21
matlab中norm的用法_matlab的normMatlabnorm用法小记matlabnorm(a)用法以及实例norm(A,p)当A是向量时norm(A,p)Returnssum(abs(A).^p)^(1/p),forany1<=p<=∞.norm(A)Returnsnorm(A,2)norm(A,inf)Returnsmax(abs(A)).norm(A,-inf)…
Matlab norm 用法小记
norm(A,p)
当A是向量时
norm(A,p) Returns sum(abs(A).^p)^(1/p), for any 1 <= p <= ∞.
norm(A) Returns norm(A,2)
norm(A,inf) Returns max(abs(A)).
norm(A,-inf) Returns min(abs(A)).
当A是矩阵时
n = norm(A) returns the largest singular value of A, max(svd(A))
n = norm(A,1) The 1-norm, or largest column sum of A, max(sum(abs(A)).
n = norm(A,2) The largest singular value (same as norm(A)).
n = norm(A,inf) The infinity norm, or largest row sum of A, max(sum(abs(A’)))
n = norm(A,’fro’) The Frobenius-norm of matrix A, sqrt(sum(diag(A’*A))).
norm
Vector and matrix norms
Syntax
n=norm(A)n=norm(A,p)
希望我今天分享的这篇文章可以帮到您。
Description
Thenormof a matrix is a scalar that gives some measure of the magnitude of the elements of the matrix. Thenormfunction calculates several different types of matrix norms:
n = norm(A)returns the largest singular value ofA,max(svd(A)).
n = norm(A,p)returns a different kind of norm, depending on the value ofp.
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 sum ofA,max(sum(abs(A'))). |
'fro' | The Frobenius-norm of matrixA,sqrt(sum(diag(A'*A))). |
WhenAis a 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
Note thatnorm(x)is the Euclidean length of a vectorx. On the other hand, MATLAB uses “length” to denote the number of elementsnin a vector. This example usesnorm(x)/sqrt(n)to obtain theroot-mean-square (RMS) value of ann-element vectorx.
x = [0 1 2 3]x = 0 1 2 3sqrt(0+1+4+9) % Euclidean lengthans = 3.7417norm(x)ans = 3.7417n = length(x) % Number of elementsn = 4rms = 3.7417/2 % rms = norm(x)/sqrt(n)rms = 1.8708