Main Content

rotm2axang

Convert rotation matrix to axis-angle rotation

Description

axang = rotm2axang(rotm) converts a rotation given as an orthonormal rotation matrix, rotm, to the corresponding axis-angle representation, axang. The input rotation matrix must be in the premultiply form for rotations.

example

Examples

collapse all

rotm = [1 0 0 ; 0 -1 0; 0 0 -1];
axang = rotm2axang(rotm)
axang = 1×4

    1.0000         0         0    3.1416

Input Arguments

collapse all

Rotation matrix, specified as a 3-by-3-by-n matrix containing n rotation matrices. Each rotation matrix has a size of 3-by-3 and must be orthonormal. The input rotation matrix must be in the premultiply form for rotations.

Note

Rotation matrices that are slightly non-orthonormal can give complex outputs. Consider validating your matrix before inputting to the function.

Example: [0 0 1; 0 1 0; -1 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

See Also

|