• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Matlabnorm用法小记

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
 

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 A, max(svd(A)).

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

If p is... Then norm returns...
1 The 1-norm, or largest column sum of A, max(sum(abs(A)).
2 The largest singular value (same as norm(A)).
inf The infinity norm, or largest row sum of A, max(sum(abs(A'))).
'fro' The Frobenius-norm of matrix A, sqrt(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
    

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Delphi取Ajax网页内容发布时间:2022-07-18
下一篇:
delphi里动态创建AlphaControls实现换肤发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap