matlab中的三维坐标系与旋转
2024-10-19 01:27:07
1. matlab中的三维坐标系
matlab中的三维坐标系是使用的右手坐标系;
输入以下代码:
>> plot3(0,0,0)
>> xlabel('axis X')
>> ylabel('axis Y')
>> zlabel('axis Z')
可以看出是个很明显的右手坐标系。
2. matlab中的欧拉角和四元数旋转
euler angles ----> quaternion ----> dcm ---->rotation
MATLAB中欧拉角旋转基本遵循以上步骤,欧拉角、四元数、旋转矩阵之间是可以相互转换的,具体可以参见help文档中的Aerospace Toolbox ----> Functions ----> Axes ----> Axes Transformations中查看。
假设我在三维坐标系中有一向量r,绕Z轴旋转90度,结果为:
close all; clear; clc; r = [ ]; % 默认的旋转顺序是ZYX,所以[ ]表示绕Z轴旋转90度 angle = [ ] * pi / ; quaternion = angle2quat(angle(),angle(),angle()); n = quatrotate(quaternion,r)
结果:
n =
1.0000 0.0000 1.0000
原始向量在YZ平面上[0 1 1],旋转后的平面在XZ的平面上[1 0 1],可以看出从Z轴的正方向来看,顺时针旋转;
再次验证:
close all; clear; clc; r = [ ]; % 默认的旋转顺序是ZYX,所以[ -]表示绕X轴旋转90度 angle = [ -] * pi / ; quaternion = angle2quat(angle(),angle(),angle()); n = quatrotate(quaternion,r) 结果: n = -1.0000 1.0000
结论:MATLAB中的默认坐标系是右手坐标系,且进行欧拉角旋转时,顺着轴的正方向来看,顺时针方向为正,逆时针方向为负。
另外,MATLAB自带rotate函数,解释如下:
rotate Rotate object in specified direction Syntax rotate(h,direction,alpha) rotate(...,origin) Description The rotate function rotates a graphics object in three-dimensional space, according to the right-hand rule. rotate(h,direction,alpha) rotates the graphics object h by alpha degrees. direction is a two- or three-element vector that describes the axis of rotation in conjunction with the origin. rotate(...,origin) specifies the origin of the axis of rotation as a three-element vector. The default origin is the center of the plot box.
此旋转函数可选择三维空间中的图像,遵循右手坐标系,顺着轴的正方向来看,且逆时针方向为正,顺时针方向为负。
最新文章
- 下一代Asp.net开发规范OWIN(1)—— OWIN产生的背景以及简单介绍
- 【BZOJ 3642】Phi的反函数
- jsp中文件上床的enctype=";multipart/form-data";用法
- RecyclerView android:layout_width=";match_parent"; 无效
- Reveal-Plugin-for-Xcode 自动结合 Reveal 进行 UI 分析
- jquery 获取input radio/checkbox 的值 【注意写法】
- DB2日期和时间函数汇总
- 【BZOJ 1927】 [Sdoi2010]星际竞速
- java I/O Stream 代码学习总结
- Windows服务定时运行,判断当前时间是否在配置时间段内
- PHP之APC缓存详细介绍
- [置顶] Asp.Net底层原理(一、浏览器和服务器的交互原理)
- web开发之Servlet 一
- Java 简单实用方法二
- Linux下使用GDAL进行开发(automake使用)
- pycharm删除project
- Python笔记(十六):迭代器
- iOS 字典转json字符串
- windows环境下为php打开ssh2扩展
- ios开发之--PDF文件生成