# rod2quat

Convert Euler-Rodrigues vector to quaternion

## Syntax

``quat=rod2quat(R)``

## Description

example

````quat=rod2quat(R)` function calculates the quaternion, `quat`, for a given Euler-Rodrigues (also known as Rodrigues) vector, `R`.Aerospace Toolbox uses quaternions that are defined using the scalar-first convention.```

## Examples

collapse all

Determine the quaternion from Rodrigues vector.

```r = [.1 .2 -.1]; q = rod2quat(r)```
```q = 0.9713 0.0971 0.1943 -0.0971```

## Input Arguments

collapse all

M-by-1 array of Rodrigues vectors.

Data Types: `double`

## Output Arguments

collapse all

M-by-4 matrix of M quaternions. `quat` has its scalar number as the first column.

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