euler2qter.m

From Spinach Documentation Wiki
Jump to: navigation, search

Converts Euler angles (ZYZ active convention) into a unit quaternion in the active convention, matching euler2dcm.m function. The angles may be supplied either as three separate arguments or as a single three-element array; any other number of arguments is rejected. The components are computed directly from the half-angle expressions q.u=cos(beta/2)cos((alpha+gamma)/2), q.i=sin(beta/2)sin((gamma-alpha)/2), q.j=sin(beta/2)cos((gamma-alpha)/2), and q.k=cos(beta/2)sin((alpha+gamma)/2). The arithmetic is elementwise, and so equal-length column vectors of angles are processed in one call.

Syntax

    q=euler2qter(alpha,beta,gamma)

                OR

    q=euler2qter([alpha beta gamma])

Parameters

    alpha,beta,gamma - Euler angles in radians (ZYZ active
                       convention), scalars or column vec-
                       tors of equal length

Outputs

    q - structure with four fields q.u, q.i, q.j, q.k giving
        the four components of the quaternion; for column
        vector inputs each field is a column vector

Notes

Note: the quaternion returned represents the same rotation as euler2dcm(alpha,beta,gamma); it is converted into that matrix by qter2dcm.m function.

See also

euler2dcm.m, qter2dcm.m, dcm2qter.m, anax2quat.m, quat2anax.m, Rotation conventions

Version 2.13, authors: Ilya Kuprov