Main Content


(Not recommended) Convert 3-D rotation vector to rotation matrix

rotationVectorToMatrix is not recommended. Use the rotvec2mat3d function instead. For more information, see Compatibility Considerations.



rotationMatrix = rotationVectorToMatrix(rotationVector) returns a 3-D rotation matrix that corresponds to the input axis-angle rotation vector. The function uses the Rodrigues formula for the computation.


collapse all

Create a vector representing a 90-degree rotation about the Z -axis.

rotationVector = pi/2 * [0, 0, 1];

Find the equivalent rotation matrix.

rotationMatrix = rotationVectorToMatrix(rotationVector)
rotationMatrix = 3×3

    0.0000    1.0000         0
   -1.0000    0.0000         0
         0         0    1.0000

Input Arguments

collapse all

Rotation vector, specified as a three-element vector. The vector represents the axis of rotation in 3-D, where the magnitude corresponds to the rotation angle in radians.

Data Types: single | double

Output Arguments

collapse all

Rotation of camera, returned as a 3-by-3 matrix that corresponds to the input axis-angle rotation vector.


[1] Trucco, Emanuele, and Alessandro Verri. Introductory Techniques for 3-D Computer Vision. Upper Saddle River, NJ: Prentice Hall, 1998.

Extended Capabilities

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

Version History

Introduced in R2016a

expand all