matlab - 在 Matlab 中从四元数获取欧拉角

标签 matlab quaternions euler-angles

我有四元数随时间变化的 X、Y、Z 和 W 分量,在 4 个分离的向量中。

  QW             1x346             2768  double       
  QX             1x346             2768  double
  QY             1x346             2768  double
  QZ             1x346             2768  double              

我想转换为欧拉角,以便随时间绘制三个不同子图中的 3 个欧拉分量,因此我需要有 3 个这样的向量

  heading(t)          1x346 
  attitude(t)         1x346 
  bank(t)             1x346 

在 matlab 中是否有一种直接的方法来获得这个(我的意思是输入我的 4 个向量并输出上述 3 个向量的函数)或者我是否必须编写一些代码来为每个时间步进行转换?提前致谢。

最佳答案

我认为没有内置的 Matlab 函数可以执行您想要的操作。

但是,我相信 Mathworks 用户社区中有一个函数正是您正在寻找的。 spinCalc这将在各种旋转类型 DCM、欧拉角、欧拉向量和四元数之间进行转换。

请注意上述帖子中关于欧拉角集和您使用的旋转顺序的评论。

When converting data to Euler angles, you MUST make sure the orientation you are translating is not near a singularity. Singular Euler sets are orientations which cannot be uniquely converted to 3 variables in that particular rotation order. The singular sets are as follows:

Type 1 Rotations: 123 - 132 - 213 - 231 - 321 - 312 Singular if second rotation angle is -90 or 90 degrees.

Type 2 Rotations: 121 - 131 - 212 - 232 - 313 - 323 Singular if second rotation angle is 0 or 180 degrees.

关于matlab - 在 Matlab 中从四元数获取欧拉角,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8898350/

相关文章:

javascript - JavaScript 中带有欧拉 Angular 的 CSS 立方体全景控件

node.js - 如何在 JavaScript 中创建一个保存数组内容的 txt 文件?

matlab - MATLAB 中的轴刻度标记

math - 围绕 x,y,z 轴旋转模型,无万向节锁定,输入数据始终为 x,y,z 轴角度旋转

opengl - OpenGL 对四元数的支持是什么?

matrix - 如何使用原始陀螺仪数据°/s来计算3D旋转?

matlab - 为什么我们需要在图像分类的 multiSVM 方法中进行交叉验证?

matlab - 如何在没有眼睛和循环的情况下创建单位矩阵

c++ - Eigen 从 Affine3d 3x3 旋转矩阵中提取的四元数是否被归一化?

math - 将欧拉角转换为四元数时更改 XYZ 顺序