# dcm2alphabeta

Convert direction cosine matrix to angle of attack and sideslip angle

## Syntax

``[alpha beta] = dcm2alphabeta(dcm)``
``[alpha beta] = dcm2alphabeta(dcm,action)``
``[alpha beta] = dcm2alphabeta(___,tolerance)``

## Description

example

````[alpha beta] = dcm2alphabeta(dcm)` calculates the angle of attack (`alpha`) and sideslip angle (`beta`) for the direction cosine matrix, `dcm`. The function transforms the coordinates from a vector in body axes into a vector in wind axes. `[alpha beta] = dcm2alphabeta(dcm,action)` performs `action` if the `dcm` is not orthogonal.`[alpha beta] = dcm2alphabeta(___,tolerance)` uses a `tolerance` level to evaluate if the direction cosine matrix, `dcm`, is orthogonal. Specify `tolerance` after all other input arguments. ```

## Examples

collapse all

Determine the angle of attack and sideslip angle from a direction cosine matrix:

```dcm = [ 0.8926 0.1736 0.4162; ... -0.1574 0.9848 -0.0734; ... -0.4226 0 0.9063]; [alpha, beta] = dcm2alphabeta(dcm)```
```alpha = 0.4363 beta = 0.1745```

Determine the angle of attack and sideslip angle from multiple direction cosine matrices:

```dcm = [ 0.8926 0.1736 0.4162; ... -0.1574 0.9848 -0.0734; ... -0.4226 0 0.9063]; dcm(:,:,2) = [ 0.9811 0.0872 0.1730; ... -0.0859 0.9962 -0.0151; ... -0.1736 0 0.9848]; [alpha, beta] = dcm2alphabeta(dcm)```
```alpha = 0.4363 0.1745 beta = 0.1745 0.0873```

Determine the angle of attack and sideslip angle from multiple direction cosine matrices. Return a warning if the `dcm` exceeds a tolerance of `0.1`:

```dcm = [ 0.8926 0.1736 0.4162; ... -0.1574 0.9848 -0.0734; ... -0.4226 0 0.9063]; dcm(:,:,2) = [ 0.9811 0.0872 0.1730; ... -0.0859 0.9962 -0.0151; ... -0.1736 0 0.9848]; [alpha, beta] = dcm2alphabeta(dcm,'Warning',0.1)```
```alpha = 0.4363 0.1745 beta = 0.1745 0.0873```

## Input Arguments

collapse all

Direction cosine matrices, specified as a 3-by-3-by-m matrix, where `m` is the number of direction cosine matrices. `dcm` contains m orthogonal direction cosine matrices.

Action for invalid direction cosine matrices, specified as:

• `'Warning'` — Displays warning and indicates that the direction cosine matrix is invalid.

• `'Error'` — Displays error and indicates that the direction cosine matrix is invalid.

• `'None'` — Does not display warning or error.

Data Types: `char` | `string`

Tolerance level to evaluate if the direction cosine matrix, `dcm`, is orthogonal, specified as a scalar.

The function considers the direction cosine matrix valid if these conditions are true:

• The transpose of the direction cosine matrix times itself equals `1` within the specified tolerance (```transpose(n)*n == 1±tolerance```)

• The determinant of the direction cosine matrix equals `1` within the specified tolerance (`det(n) == 1±tolerance`).

Data Types: `double`

## Output Arguments

collapse all

Angles of attack, returned as an array of m angles of attack, in radians.

Sideslip angles, returned as an m array of sideslip angles, in radians.

## Version History

Introduced in R2006b