Create rotation angles from direction cosine matrix

`[r1 r2 r3] = dcm2angle(n)`

[r1 r2 r3] = dcm2angle(n, s)

[r1 r2 r3] = dcm2angle(n, s, lim)

`[r1 r2 r3] = dcm2angle(n)`

calculates
the set of rotation angles, `r1`

, `r2`

, `r3`

,
for a given direction cosine matrix, `n`

. `n`

is
a 3-by-3-by-`m`

matrix containing `m`

direction
cosine matrices. `r1`

returns an `m`

array
of first rotation angles. `r2`

returns an `m`

array
of second rotation angles. `r3`

returns an `m`

array
of third rotation angles. Rotation angles are output in radians.

`[r1 r2 r3] = dcm2angle(n, s)`

calculates
the set of rotation angles, `r1`

, `r2`

, `r3`

,
for a given direction cosine matrix, `n`

, and a specified
rotation sequence, `s`

.

The default rotation sequence is `'ZYX'`

, where `r1`

is * z*-axis
rotation,

`r2`

is `y`

`r3`

is `x`

Supported rotation sequence strings are `'ZYX'`

, `'ZYZ'`

, `'ZXY'`

, `'ZXZ'`

, `'YXZ'`

, `'YXY'`

, `'YZX'`

, `'YZY'`

, `'XYZ'`

, `'XYX'`

, `'XZY'`

,
and `'XZX'`

.

`[r1 r2 r3] = dcm2angle(n, s, lim)`

calculates
the set of rotation angles, `r1`

, `r2`

, `r3`

,
for a given direction cosine matrix, `n`

, a specified
rotation sequence, `s`

, and a specified angle constraint, `lim`

. `lim`

is
a string specifying either `'Default'`

or `'ZeroR3'`

.
See Assumptions and Limitations for
full definitions of angle constraints.

Determine the rotation angles from direction cosine matrix:

dcm = [1 0 0; 0 1 0; 0 0 1]; [yaw, pitch, roll] = dcm2angle( dcm ) yaw = 0 pitch = 0 roll = 0

Determine the rotation angles from multiple direction cosine matrices:

dcm = [ 1 0 0; 0 1 0; 0 0 1]; dcm(:,:,2) = [ 0.85253103550038 0.47703040785184 -0.21361840626067; ... -0.43212157513194 0.87319830445628 0.22537893734811; ... 0.29404383655186 -0.09983341664683 0.95056378592206]; [pitch, roll, yaw] = dcm2angle( dcm, 'YXZ' ) pitch = 0 0.3000 roll = 0 0.1000 yaw = 0 0.5000

The `'Default'`

limitations for the `'ZYX'`

, `'ZXY'`

, `'YXZ'`

, `'YZX'`

, `'XYZ'`

,
and `'XZY'`

implementations generate an `r2`

angle
that lies between ±90 degrees, and `r1`

and `r3`

angles
that lie between ±180 degrees.

The `'Default'`

limitations for the `'ZYZ'`

, `'ZXZ'`

, `'YXY'`

, `'YZY'`

, `'XYX'`

,
and `'XZX'`

implementations generate an `r2`

angle
that lies between 0 and 180 degrees, and `r1`

and `r3`

angles
that lie between ±180 degrees.

The `'ZeroR3'`

limitations for the `'ZYX'`

, `'ZXY'`

, `'YXZ'`

, `'YZX'`

, `'XYZ'`

,
and `'XZY'`

implementations generate an `r2`

angle
that lies between ±90 degrees, and `r1`

and `r3`

angles
that lie between ±180 degrees. However, when `r2`

is
±90 degrees, `r3`

is set to 0 degrees.

The `'ZeroR3'`

limitations for the `'ZYZ'`

, `'ZXZ'`

, `'YXY'`

, `'YZY'`

, `'XYX'`

,
and `'XZX'`

implementations generate an `r2`

angle
that lies between 0 and 180 degrees, and `r1`

and `r3`

angles
that lie between ±180 degrees. However, when `r2`

is
0 or ±180 degrees, `r3`

is set to 0 degrees.

`angle2dcm`

| `dcm2quat`

| `quat2angle`

| `quat2dcm`

Was this topic helpful?