MATLAB AerospaceToolBox-angle2dcm,dem2angle...etc.

分类: Matlab |
Axes Transformations 坐标转换
今天闲来无事想起来以前在MATLAB中进行坐标变换都自己编写了坐标转换函数,MATLAB中应该会有吧,找了下帮助果真有,其实在MATLAB的AerospaceToolBox中封装好了很多坐标转换函数,可以直接调用完成对坐标系相对关系的描述。
angle2dcm
Create direction cosine matrix from rotation angles
由旋转角度创建方向余弦矩阵
Syntax
dcm =
angle2dcm(rotationAng1,
rotationAng2, rotationAng3)
dcm = angle2dcm(rotationAng1,
rotationAng2, rotationAng3,
rotationSequence)
Description
dcm = angle2dcm(rotationAng1, rotationAng2, rotationAng3) calculates the direction cosine matrix given three sets of rotation angles. 由三个旋转角计算方向余弦矩阵
dcm = angle2dcm(rotationAng1, rotationAng2, rotationAng3, rotationSequence) calculates the direction cosine matrix using a rotation sequence.由特定的旋转序列计算方向余弦矩阵
这里的旋转角是指右手系下的旋转方向为正如图
http://s6/small/4b94ff1347c66ecf39635&690AerospaceToolBox-angle2dcm,dem2angle...etc." TITLE="MATLAB
而得出的方向余弦矩阵dcm 是由原坐标系经旋转后到新坐标系的转换矩阵。
例如在导航专业中用到的导航坐标系到载体坐标系的旋转就可以用此函数求的,而求的的方向余弦矩阵为导航坐标系转向载体坐标系的,即Cnb
Inputs
rotationAng1 |
m-by-1 array of first rotation angles, in radians. 第一个旋转角 |
|||||||||||||
rotationAng2 |
m-by-1 array of second rotation angles, in
radians. |
|||||||||||||
rotationAng3 |
m-by-1 array of third rotation angles, in radians.第三个旋转角 |
|||||||||||||
rotationSequence |
String that defines rotation sequence. For example, the default 'ZYX' represents a sequence where rotationAng1 is z-axis rotation, rotationAng2 is y-axis rotation, and rotationAng3 is x-axis rotation. 定义旋转序列的字符串。例如默认的'ZYX'表示了一个这样的旋转顺序:rotationAng1是绕Z轴旋转,rotationAng2 是绕y轴旋转,rotationAng3绕x轴旋转。共有如下几种形式:
|
Outputs
dcm |
3-by-3-by-m matrix containing m direction cosine matrices. 3X3的方向余弦矩阵 |
Examples
将原坐标系axis1先沿着z轴旋转20度,沿着x轴旋转30度,再沿着y轴旋转45度,得到新的坐标系axis2。
那么在坐标系axis1中的点A(2,3,4)在新的坐标系axis2中的坐标B用以下方法来求得:
A=[2;3;4];
dcm=angle2dcm(20*pi/180,30*pi/180,45*pi/180,'ZXY');
B=dcm*A
>>
在这里,方向余弦矩阵有个性质,即:方向余弦矩阵是正交的,就是其逆等于其转置
所以如果需要坐标反向转换,只需要这样用:
dcm_inv=dcm';
C=dcm_inv*B;
>> C =