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 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
Matlab norm 用法小记的更多相关文章
- matlab fscanf用法
matlab fscanf用法 matlab中的fscanf的用法如下: A=fscanf(fid,format)[A, count]=fscanf(fid,format,size) [A, coun ...
- [转]HttpClient的超时用法小记
HttpClient的超时用法小记 HttpClient在使用中有两个超时时间,是一直接触和使用的,由于上次工作中使用httpClient造成了系统悲剧的情况,特地对它的两个超时时间进行了小小的测试, ...
- linux expect, spawn用法小记
linux expect, spawn用法小记_IT民工_百度空间 linux expect, spawn用法小记 版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明http://sys ...
- [转载]expect spawn、linux expect 用法小记
原文地址:expect spawn.linux expect 用法小记作者:悟世 使用expect实现自动登录的脚本,网上有很多,可是都没有一个明白的说明,初学者一般都是照抄.收藏.可是为什么要这么写 ...
- Shell常见用法小记
shell的简单使用 最近发现shell脚本在平常工作中简直算一把瑞士军刀,很多场景下用shell脚本能实现常用的简单需求,而之前都没怎么学习过shell,就趁机把shell相关的语法和常见用法总结了 ...
- matlab norm的使用
格式:n=norm(A,p)功能:norm函数可计算几种不同类型的矩阵范数,根据p的不同可得到不同的范数 以下是Matlab中help norm 的解释 NORM Matrix or vector n ...
- matlab norm 范式
格式:n=norm(A,p) 功能:norm函数可计算几种不同类型的矩阵范数,根据p的不同可得到不同的范数 p 返回值 1 返回A中最大一列和,即max(sum(abs(A))) 2 返回A的 ...
- matlab fspecial 用法解释
Matlab 的fspecial函数用法 fspecial函数用于建立预定义的滤波算子,其语法格式为:h = fspecial(type)h = fspecial(type,para)其中type指定 ...
- Linq用法小记
一.什么是Linq? LINQ即Language Integrated Query(语言集成查询),LINQ是集成到C#和Visual Basic.NET这些语言中用于提供查询数据能力的一个新特性. ...
随机推荐
- 清理300多台MySQL数据库的过期binlog日志
早晨睡梦中,被 on-call了,说磁盘报警,赶紧起来打开email,收到上百封email报警,数据库磁盘不够了,查询了原因 [xxx@xxxx cacti]$ ssh xxxx "df - ...
- labview 移位寄存器、隧道、索引隧道的区别
Lab view区别:移位寄存器.隧道.索引隧道 最近研究Lab view的时候发现移位寄存器和隧道的功能非常相似但是又有区别 外部数据进入循环体是通过隧道进入的,有几种方式: 图1:For 循环结构 ...
- iis6配置使用页面Gzip压缩提速
iis7默认就启用了Gzip压缩,节约带宽,流量,能够很明显的提升访问速度,但是iis6则没有,本文就是介绍如何通过配置开启iis6的Gzip压缩 一. HTTP压缩概述 HTTP压缩是在Web服务器 ...
- PHP ajax实现数组返回
首先,我想要实这样一个功能, 当选择一个下拉框时,让其它三个文本框得到从服务器上返回的值!也就把返回的值,赋给那三个文本框! 我用的是jquery+php!! 由于我前台,后台,js,数据库采用的都是 ...
- Quartz.net 定时任务在IIS中未按时执行
IIS 垃圾回收机制下解决Quartz.net 的不执行问题 IIS中涉及了垃圾回收机制,quartz.net 在ASP.NET 项目中可以实现线程监控定时执行任务,但是在IIS7.5机一下版本中涉及 ...
- SQL输出矩阵
数据库环境:SQL SERVER2008R2 需求:用SQL实现如下2个图中的矩阵. 图1和图2都是行列转换的另一个变形,下面直接贴上SQL脚本. 图1的SQL实现 /*利用系统 ...
- C# 匿名表达式(Lambda表达式)
匿名表达式 这次来说说Lambda表达式吧,反正也简单,我也不像其他高手那样强调来强调去,只讲一下方法: 准备条件如下: 第一,匿名表达式必须存在与之对应的委托. 只要存在相对应的委托就可以了.接下来 ...
- dx环境搭建
我使用的是vs2012+DXSDK_Jun10 DXSDK_Jun10下载地址http://download.microsoft.com/download/A/E/7/AE743F1F-632B-48 ...
- ACM HDU 1021 Fibonacci Again
#include<iostream> using namespace std; int main() { int n; while(cin>>n) { if((n+1)%4== ...
- USACO 2.2 Subset Sums 集合(subset)
Description 对于从1到N的连续整集合,能划分成两个子集合,且保证每个集合的数字和是相等的.举个例子,如果N=3,对于{1,2,3}能划分成两个子集合,他们每个的所有数字和是相等的: {3} ...
.