Matlab norm 用法小记

 2023-09-05 阅读 31 评论 0

摘要:Matlab norm 用法小记 matlab norm (a) 用法以及实例 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 = n

Matlab norm 用法小记

matlab norm (a) 用法以及实例

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

The norm of a matrix is a scalar that gives some measure of the magnitude of the elements of the matrix. The norm function calculates several different types of matrix norms:

n = norm(A) returns the largest singular value of Amax(svd(A)).

n = norm(A,p) returns a different kind of norm, depending on the value of p.

If p is...Then norm returns...
1The 1-norm, or largest column sum of Amax(sum(abs(A)).
2The largest singular value (same as norm(A)).
infThe infinity norm, or largest row sum of Amax(sum(abs(A'))).
'fro'The Frobenius-norm of matrix Asqrt(sum(diag(A'*A))).
 

 

When A is a vector:

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)).
 

 

Remarks

Note that norm(x) is the Euclidean length of a vector x. On the other hand, MATLAB uses "length" to denote the number of elements n in a vector. This example uses norm(x)/sqrt(n) to obtain the root-mean-square (RMS) value of an n-element vector x.

  • 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

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/5/1433.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息