# rod2angle

Convert Euler-Rodrigues vector to rotation angles

## Syntax

``[R1 R2 R3]=rod2angle(rod)``
``[R1 R2 R3]=rod2angle(rod,S)``

## Description

example

````[R1 R2 R3]=rod2angle(rod)` function calculates the set of rotation angles, `R1`, `R2`, and `R3`, for a given Euler-Rodrigues (also known as Rodrigues) vector, `rod`. The rotation used in this function is a passive transformation between two coordinate systems.`[R1 R2 R3]=rod2angle(rod,S)` function calculates the set of rotation angles for a given Rodrigues vector and a specified rotation sequence, `S`.```

## Examples

collapse all

Determine rotation angles from vector, ```[.1 .2 -.1]```.

```r = [.1 .2 -.1]; [yaw, pitch, roll] = rod2angle(r)```
```yaw = -0.1651 pitch = 0.4074 roll = 0.1651```

## Input Arguments

collapse all

M-by-3 matrix containing M Rodrigues vector.

Data Types: `double`

Rotation angles, in radians, from which to determine Rodrigues vector. For the default rotation sequence, `ZYX`, the rotation angle order is:

• R1 — z-axis rotation

• R2 — y-axis rotation

• R3 — x-axis rotation

Data Types: `char` | `string`

## Output Arguments

collapse all

M-by-1 array of first rotation angles, in radians.

M-by-1 array of second rotation angles, in radians.

M-by-1 array of third rotation angles, in radians.

## Algorithms

An Euler-Rodrigues vector $\stackrel{⇀}{b}$ represents a rotation by integrating a direction cosine of a rotation axis with the tangent of half the rotation angle as follows:

`$\stackrel{\to }{b}=\left[\begin{array}{ccc}{b}_{x}& {b}_{y}& {b}_{z}\end{array}\right]$`

where:

`$\begin{array}{l}{b}_{x}=\mathrm{tan}\left(\frac{1}{2}\theta \right){s}_{x},\\ {b}_{y}=\mathrm{tan}\left(\frac{1}{2}\theta \right){s}_{y},\\ {b}_{z}=\mathrm{tan}\left(\frac{1}{2}\theta \right){s}_{z}\end{array}$`

are the Rodrigues parameters. Vector $\stackrel{⇀}{s}$ represents a unit vector around which the rotation is performed. Due to the tangent, the rotation vector is indeterminate when the rotation angle equals ±pi radians or ±180 deg. Values can be negative or positive.

## References

[1] Dai, J.S. "Euler-Rodrigues formula variations, quaternion conjugation and intrinsic connections." Mechanism and Machine Theory, 92, 144-152. Elsevier, 2015.

## Version History

Introduced in R2017a