# dcm2alphabeta

Convert direction cosine matrix to angle of attack and sideslip angle

## Syntax

```[a b] = dcm2alphabeta(n) [a b] = dcm2alplhabeta(n,action) [a b] = dcm2angle(n,action,tolerance) ```

## Description

`[a b] = dcm2alphabeta(n)` calculates the angle of attack and sideslip angle, `a` and `b`, for a given direction cosine matrix, `n`. `n` is a 3-by-3-by-`m` matrix containing `m` orthogonal direction cosine matrices. `a` is an `m` array of angles of attack. `b` is an `m` array of sideslip angles. `n` performs the coordinate transformation of a vector in body-axes into a vector in wind-axes. Angles of attack and sideslip angles are output in radians.

`[a b] = dcm2alplhabeta(n,action)` performs `action` if the direction cosine matrix is invalid (not orthogonal).

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

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

• None — Does not display warning or error (default).

`[a b] = dcm2angle(n,action,tolerance)` uses a `tolerance` level to evaluate if the direction cosine matrix, `n`, is valid (orthogonal). `tolerance` is a scalar whose default is `eps(2)` (`4.4409e-16`). 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`).

## Examples

Determine the angle of attack and sideslip angle from 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 validated within tolerance:

```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``` 