Main Content


Convert quaternion to axis-angle rotation



axang = quat2axang(quat) converts a quaternion, quat, to the equivalent axis-angle rotation, axang.


collapse all

quat = [0.7071 0.7071 0 0]; 
axang = quat2axang(quat)
axang = 1×4

    1.0000         0         0    1.5708

Input Arguments

collapse all

Unit quaternion, specified as an n-by-4 matrix or n-element vector of quaternion objects containing n quaternions. If the input is a matrix, each row is a quaternion vector of the form q = [w x y z], with w as the scalar number.

Example: [0.7071 0.7071 0 0]

Output Arguments

collapse all

Rotation given in axis-angle form, returned as an n-by-4 matrix of n axis-angle rotations. The first three elements of every row specify the rotation axis, and the last element defines the rotation angle (in radians).

Example: [1 0 0 pi/2]

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2015a