qter2euler.m
Converts a unit quaternion in the active convention into Euler angles (ZYZ active convention), matching euler2dcm.m function. The quaternions are normalised elementwise, the angle sum and difference are obtained as 2*atan2(q.k,q.u) and 2*atan2(q.i,q.j), and the second Euler angle comes from 2*atan2(sqrt(q.i^2+q.j^2),sqrt(q.u^2+q.k^2)), which places it in the [0,pi] interval by construction. The conversion is vectorised: each quaternion component field may be a column vector.
Syntax
[alpha,beta,gamma]=qter2euler(q)
Parameters
q - structure with four fields q.u, q.i, q.j, q.k giving
the four components of the quaternion; each field may
be a column vector, in which case the conversion is
performed elementwise
Outputs
alpha,beta,gamma - Euler angles in radians (ZYZ active
convention), same shape as the qua-
ternion component fields
Notes
Euler angles are not unique; the angles returned satisfy euler2dcm(alpha,beta,gamma)=qter2dcm(q) with beta in the [0,pi] interval.
See also
qter2dcm.m, euler2qter.m, dcm2qter.m, dcm2euler.m, euler2dcm.m, euler_equiv.m, Rotation conventions
Version 2.13, authors: Ilya Kuprov