Does anyone have the code for the quat2euler fuction?
Show older comments
I am trying to convert a quaternion (Nx4, with a scalar as the first column) to euler angles for various sequences of rotation (ie. XYZ, YXZ, ZXY, etc). I believe there is a function "quat2euler", but I dont have access to that toolbox?
Answers (1)
James Tursa
on 23 Jun 2016
0 votes
I would recommend the SpinCalc FEX submission by John Fuller:
I don't recall at the moment if the scalar is in the first or last element for this code ... you should check that before using it.
2 Comments
Leah Taylor
on 23 Jun 2016
James Tursa
on 23 Jun 2016
Edited: James Tursa
on 23 Jun 2016
Yes. The cos(etc) spot defines where the scalar is. So if cos(etc) is in the q4 spot, that means that the scalar is in the q4 spot. Which would mean that the q1-q2-q3 spots are sin(etc)*u where u is the 3-element unit eigen-axis of rotation.
Categories
Find more on Quaternion Math in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!