Convert rotation matrix to axis-angle rotation
rotm = [1 0 0 ; 0 -1 0; 0 0 -1]; axang = rotm2axang(rotm)
axang = 1×4 1.0000 0 0 3.1416
rotm— Rotation matrix
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.
Rotation matrices that are slightly non-orthonormal can give complex outputs. Consider validating your matrix before inputting to the function.
[0 0 1; 0 1 0; -1 0 0]
axang— Rotation given in axis-angle form
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).
[1 0 0 pi/2]