# theta

Convert transformation or rotation to 2-D rotation angle

Since R2023b

## Syntax

``angle = theta(transformation)``
``angle = theta(rotation)``

## Description

example

````angle = theta(transformation)` extracts the 2-D rotation angle `angle` from the transformation `transformation`.```

example

````angle = theta(rotation)` extracts the 2-D rotation angle `angle` from the rotation `rotation`.```

## Examples

collapse all

Create SE(2) transformation with a rotation defined by an angle `pi/2`.

`angle1 = pi/2`
```angle1 = 1.5708 ```
`T = se2(angle1,"theta")`
```T = se2 0.0000 -1.0000 0 1.0000 0.0000 0 0 0 1.0000 ```

Get the rotation angle from the transformation.

`angle2 = theta(T)`
```angle2 = 1.5708 ```

Create SO(2) rotation defined by an angle `pi/2`.

`angle1 = pi/2`
```angle1 = 1.5708 ```
`R = so2(angle1,"theta")`
```R = so2 0.0000 -1.0000 1.0000 0.0000 ```

Get the rotation angle from the rotation.

`angle2 = theta(R)`
```angle2 = 1.5708 ```

## Input Arguments

collapse all

Transformation, specified as an `se2` object or as an N-by-M array of `se2` objects. N is the total number of transformations.

If `transformation` is a N-by-M array, the `angle` argument is the same size and contains an angle for each of the `se2` objects specified in the array.

Data Types: `single` | `double`

Rotation, specified as an `so2` object or as an N-by-M array of `so2` objects. N is the total number of rotations.

If `rotation` is a N-by-M array, the `angle` argument is the same size and contains an angle for each of the `so2` objects specified in the array.

## Output Arguments

collapse all

Rotation angle, returned as a numeric scalar for a scalar input and as an N-by-M matrix for an array input. N and M are the dimensions of the input `rotation` or `transformation` argument. Each element of the matrix is an angle, in radians, and each angle corresponds to a rotation or transformation in the input at the same index location.

The rotation angle is counterclockwise positive when you look along the axis toward the origin.

Data Types: `single` | `double`

## Version History

Introduced in R2023b