Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

quat2dcm

Convert quaternion to direction cosine matrix

Syntax

n = quat2dcm(q)

Description

n = quat2dcm(q) calculates the direction cosine matrix, n, for a given quaternion, q. Input q is an m-by-4 matrix containing m quaternions. n returns a 3-by-3-by-m matrix of direction cosine matrices. The direction cosine matrix performs the coordinate transformation of a vector in inertial axes to a vector in body axes. Each element of q must be a real number. Additionally, q has its scalar number as the first column.

Examples

Determine the direction cosine matrix from q = [1 0 1 0]:

dcm = quat2dcm([1 0 1 0])


dcm =

         0         0   -1.0000
         0    1.0000         0
    1.0000         0         0

Determine the direction cosine matrices from multiple quaternions:

q = [1 0 1 0; 1 0.5 0.3 0.1]; 
dcm = quat2dcm(q)


dcm(:,:,1) =

         0         0   -1.0000
         0    1.0000         0
    1.0000         0         0


dcm(:,:,2) =

    0.8519    0.3704   -0.3704
    0.0741    0.6148    0.7852
    0.5185   -0.6963    0.4963

Introduced in R2006b

Was this topic helpful?