quat2rotm
Convert quaternion to rotation matrix
Syntax
Description
Examples
Convert Quaternion to Rotation Matrix
quat = [0.7071 0.7071 0 0]; rotm = quat2rotm(quat)
rotm = 3×3
1.0000 0 0
0 -0.0000 -1.0000
0 1.0000 -0.0000
Input Arguments
quat
— Unit quaternion
n-by-4 matrix | n-element vector of quaternion
objects
Unit quaternion, specified as an n-by-4 matrix or
n-element vector of quaternion
objects containing
n quaternions. If the input is a matrix, each row is
a quaternion vector of the form q = [w
x
y
z], with w as the scalar
number.
Example: [0.7071 0.7071 0 0]
Output Arguments
rotm
— Rotation matrix
3-by-3-by-n matrix
Rotation matrix, returned as a 3-by-3-by-n matrix containing n rotation matrices. Each rotation matrix has a size of 3-by-3 and is orthonormal. When using the rotation matrix, premultiply it with the coordinates to be rotated (as opposed to postmultiplying).
Example: [0 0 1; 0 1 0; -1 0 0]
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2015a
See Also
rotm2quat
| quaternion
| so2
| so3
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)