# angle2rod

Convert rotation angles to Euler-Rodrigues vector

## Syntax

``rod=angle2rod(R1,R2,R3)``
``rod=angle2rod(R1,R2,R3,S)``

## Description

example

````rod=angle2rod(R1,R2,R3)` function converts the rotation described by the three rotation angles, `R1`, `R2`, and `R3`, into an M-by-3 Euler-Rodrigues matrix, `rod`. The rotation used in this function is a passive transformation between two coordinate systems.`rod=angle2rod(R1,R2,R3,S)` function converts the rotation described by the three rotation angles and a rotation sequence, S, into an M-by-3 Euler-Rodrigues array, `rod`, that contains the M Rodrigues vector.```

## Examples

collapse all

Determine the Rodrigues vector from rotation angles.

```yaw = 0.7854; pitch = 0.1; roll = 0; r = angle2rod(yaw,pitch,roll)```
```r = -0.0207 0.0500 0.4142```

Determine the Rodrigues vectors from multiple rotation angles.

```yaw = [0.7854 0.5]; pitch = [0.1 0.3]; roll = [0 0.1]; r = angle2rod(pitch,roll,yaw,'YXZ')```
```r = 0.0207 0.0500 0.4142 0.0885 0.1381 0.2473```

## Input Arguments

collapse all

First rotation angle, in radians, from which to determine Euler-Rodrigues vector. Values must be real.

Data Types: `double` | `single`

Second rotation angle, in radians, from which to determine Euler-Rodrigues vector. Values must be real.

Data Types: `double` | `single`

Third rotation angle, in radians, from which to determine Euler-Rodrigues vector. Values must be real.

Data Types: `double` | `single`

Rotation sequence. 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

Euler-Rodrigues vector determined from rotation angles.

## 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.