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

collapse all

R2022b: Not recommended

Starting in R2022b, most Computer Vision Toolbox™ functions create and perform geometric transformations using the premultiply convention. However, the rotationVectorToMatrix function uses the postmultiply convention. Although there are no plans to remove rotationVectorToMatrix at this time, you can streamline your geometric transformation workflows by switching to the rotvec2mat3d function, which supports the premultiply convention. For more information, see Migrate Geometric Transformations to Premultiply Convention.

To update your code:

  • Change instances of the function name rotationVectorToMatrix to rotvec2mat3d.

  • You do not need to change the input argument, rotationVector. The rotvec2mat3d function automatically returns the rotation matrix using the premultiply convention.