gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 20:19:27 28 4
gpt4 key购买 nike

我有四元数随时间变化的 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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com