# tform2quat

Extract quaternion from homogeneous transformation

## Syntax

``quat = tform2quat(tform)``

## Description

example

````quat = tform2quat(tform)` extracts the rotational component from a homogeneous transformation, `tform`, and returns it as a quaternion, `quat`. The translational components of `tform` are ignored. The input homogeneous transformation must be in the premultiply form for transformations.```

## Examples

collapse all

```tform = [1 0 0 0; 0 -1 0 0; 0 0 -1 0; 0 0 0 1]; quat = tform2quat(tform)```
```quat = 1×4 0 1 0 0 ```

## Input Arguments

collapse all

Homogeneous transformation, specified by a 4-by-4-by-n matrix of n homogeneous transformations. The input homogeneous transformation must be in the premultiply form for transformations.

Example: `[0 0 1 0; 0 1 0 0; -1 0 0 0; 0 0 0 1]`

## Output Arguments

collapse all

Unit quaternion, returned as an n-by-4 matrix containing n quaternions. Each quaternion, one per row, is of the form q = [w x y z], with w as the scalar number.

Example: `[0.7071 0.7071 0 0]`