axang2quat

Convert axis-angle rotation to quaternion

Syntax

quat = axang2quat(axang)

Description

example

quat = axang2quat(axang) converts a rotation given in axis-angle form, axang, to quaternion, quat.

Examples

collapse all

axang = [1 0 0 pi/2];
quat = axang2quat(axang)
quat = 1×4

    0.7071    0.7071         0         0

Input Arguments

collapse all

Rotation given in axis-angle form, specified 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]

Output Arguments

collapse all

Unit quaternion, returned as an n-by-4 matrix containing n quaternions. Each quaternion, one per row, is of the form q = [w x y z], with w as the scalar number.

Example: [0.7071 0.7071 0 0]

Extended Capabilities

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

Introduced in R2015a