Matlab运算之 norm,cross,makehgtform,asin(acos)

范数,是具有“长度”概念的函数。在线性代数、泛函分析及相关的数学领域,范数是一个函数,其为矢量空间内的所有矢量赋予非零的正长度或大小。半范数反而可以为非零的矢量赋予零长度。

1、向量范数

1-范数:,即向量元素绝对值之和,matlab调用函数norm(x, 1) 。

2-范数:,Euclid范数(欧几里得范数,常用计算向量长度),即向量元素绝对值的平方和再开方,matlab调用函数norm(x, 2)。

∞-范数:,即所有向量元素绝对值中的最大值,matlab调用函数norm(x, inf)。

-∞-范数:,即所有向量元素绝对值中的最小值,matlab调用函数norm(x, -inf)。

p-范数:,即向量元素绝对值的p次方和的1/p次幂,matlab调用函数norm(x, p)。

2、矩阵范数

1-范数:, 列和范数,即所有矩阵列向量绝对值之和的最大值,matlab调用函数norm(A, 1)。

2-范数:,谱范数,即A'A矩阵的最大特征值的开平方。matlab调用函数norm(x, 2)。

-------------------- norm--------------------

matlab里,doc norm的结果:

Description The norm function calculates several different
types of matrix and vector norms. If the input is a vector or a matrix:n = norm(X,2) returns the2-norm of X.

n = norm(X) is the same as n = norm(X,2).

n = norm(X,1) returns the 1-norm of X.

n = norm(X,Inf) returns the infinity norm of X.

n = norm(X,'fro') returns the Frobenius norm of X.

In addition, when the input is a vector v:n = norm(v,p) returns the p-norm of v. 

The p-norm is sum(abs(v).^p)^(1/p).n = norm(v,Inf) returns the largest element of abs(v).

n = norm(v,-Inf) returns the smallest element of abs(v).


---------------------cross--------------------

matalb,doc cross:

Syntax
C = cross(A,B)
C = cross(A,B,dim)
Description
C = cross(A,B) returns the cross product of A and B.
•If A and B are vectors, then they must have a length of 3.
•If A and B are matrices or multidimensional arrays, then they must have the same size. In this case, the cross function treats A and B as collections of three-element vectors. The function calculates the cross product of corresponding vectors along the first array dimension whose size equals 3.
C = cross(A,B,dim) evaluates the cross product of arrays A and B along dimension, dim. A and B must have the same size, and both size(A,dim) and size(B,dim) must be 3. The dim input is a positive integer scalar.


C = cross(A,B)返回向量叉积A和B,即,C = A x B,A和B必须是3元向量。

--------------- --makehgtform---------------

matlab,doc makehgtform:

Syntax
M = makehgtform
M = makehgtform('translate',[tx ty tz])
M = makehgtform('scale',s)
M = makehgtform('scale',[sx,sy,sz])
M = makehgtform('xrotate',t)
M = makehgtform('yrotate',t)
M = makehgtform('zrotate',t)
M = makehgtform('axisrotate',[ax,ay,az],t)

Description
Use makehgtform to create transform matrices for translation, scaling, and rotation of graphics objects. Apply the transform to graphics objects by assigning the transform to the Matrix property of a parent hgtransform object. See Examples for more information.

M = makehgtform returns an identity transform.
M = makehgtform('translate',[tx ty tz]) or M = makehgtform('translate',tx,ty,tz) returns a transform that translates along the x-axis by tx, along the y-axis by ty, and along the z-axis by tz.
M = makehgtform('scale',s) returns a transform that scales uniformly along the x-, y-, and z-axes.
M = makehgtform('scale',[sx,sy,sz]) returns a transform that scales along the x-axis by sx, along the y-axis by sy, and along the z-axis by sz.
M = makehgtform('xrotate',t) returns a transform that rotates around the x-axis by t radians.
M = makehgtform('yrotate',t) returns a transform that rotates around the y-axis by t radians.
M = makehgtform('zrotate',t) returns a transform that rotates around the z-axis by t radians.
M = makehgtform('axisrotate',[ax,ay,az],t) Rotate around axis [ax ay az] by t radians.

---------------------asin----------------------

matlab中asin是一个求反正弦的函数
注1:asin(x)中x的取值范围为:-1<=x<=1
注2:asin计算出来的结果是以弧度制表示的。

使用方法如下:
a = sin(pi/6); % 计算结果为0.5
b = asin(a); % 计算结果为0.5236 = pi/6(弧度制表示)


最后,附个matlab综合实例:

>> A=[1,2,2]

A =

     1     2     2
>> norm_A=norm(A)//求得A的2范数

norm_A =

     3

>> B=[2 1 2]

B =

     2     1     2

>> CROSS_AB=cross(A,B) //求得AB面的法向量

CROSS_AB =

     2     2    -3
>> M=makehgtform('xrotate',pi/2) //M为绕着X轴旋转90度的旋转矩阵

M =

     1     0     0     0
     0     0    -1     0
     0     1     0     0
     0     0     0     1

参考:

http://blog.csdn.net/left_la/article/details/9159949

http://www.cnblogs.com/sddai/p/5433346.html

http://yishouce.com/matlab/func/makehgtform

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值