it's not really a question but it might produce some mistakes to other users. I'd worked with angle2dcm and noticed that its result are the transpose matrix if we follow euler's convention, which is the convention i used to work with (and some others), probably other professional fields use the transpose convention. Perhaps you should state this at angle2dcm description. I attach an example with euler's ZYX dcm convention released by the MIT.
MATLAB: Angle2dcm convention
angle2dcmangle2dcm convention
Related Solutions
Most common rotations are made for aerospace applications. Usually, the rotations are mostly made from earth (or inertial reference frame) to body reference frame. This causes for the DCM's to be the inverse or transpose of what the usual non-aerospace applications are used for. The to and from direction cosine matrix functions have this approach, as does the "quatrotate" function. Therefore the results, even though they "look" as if they are calculated using left-hand notation, have been calculated using right hand notation. They were calculated to use the most common approach in aerospace applications (inertial to body).
Workflow difference (quatrotate): There are two conventions for performing rotations. Aerospace Toolbox is using the rotation "convention most commonly used" as stated by Stevens and Lewis in quatrotate and the customer is using the other one. A potential solution is to make quatrotate more flexible with the type of rotation available as a choice. Would this be a workable solution for the customer?
1. "quatrotate" - rotates vector in inertial frame to body frame. Rational behind the choice of rotation equation in Aerospace Toolbox:
From: Stevens, Brian L., Frank L. Lewis, Aircraft Control and Simulation, Wiley-Interscience, 2nd Edition, page 18.
Workflow differences (DCM): The quat2dcm and dcm2quat functions are not incorrect, but does not return what the is expected. Below are the descriptions for each function:
quat2dcm - outputs DCM (inertial to body) from quaternion (body to inertial orientation -> right-handed rotation) % QUAT2DCM Convert quaternion to direction cosine matrix.
% 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.
dcm2quat - outputs quaternion (body to inertial orientation -> right-handed rotation) from DCM (inertial to body) % DCM2QUAT Convert direction cosine matrix to quaternion.
% Q = DCM2QUAT( N ) calculates the quaternion, Q, for given
% direction cosine matrix, N. Input N is a 3-by-3-by-M matrix of
% orthogonal direction cosine matrices. The direction cosine matrix performs the
% coordinate transformation of a vector in inertial axes to a vector in
% body axes. Q returns an M-by-4 matrix containing M quaternions. Q has
% its scalar number as the first column.
Workflows are the same: The following functions are not affected by the handedness of the quaternion. * quatconj * quatdivide * quatinv * quatmod * quatmultiply * Aerospace Toolbox uses the calculation from Steven's calculation which matches the customer derivation, not the paper in question * quatnorm * quatnormalize
MathWorks is constantly taking into account the feedback regarding relevant functions in Aerospace Toolbox and blocks in Aerospace Blockset and we will enhance product documentation to include more information.
Best Answer