# dcm2latlon

Convert direction cosine matrix to geodetic latitude and longitude

## Syntax

``[lat lon] = dcm2latlon(dcm)``
``[lat lon] = dcm2latlon(dcm,action)``
``[lat lon] = dcm2latlon(dcm,action,tolerance)``

## Description

example

````[lat lon] = dcm2latlon(dcm)` calculates the geodetic latitude and longitude `lat` and `lon` for the direction cosine matrix `dcm`. `[lat lon] = dcm2latlon(dcm,action)` performs an, `action`, if the direction cosine matrix is invalid, that is, not orthogonal.`[lat lon] = dcm2latlon(dcm,action,tolerance)` uses a tolerance level, `tolerance`, to evaluate if the direction cosine matrix is within tolerance. ```

## Examples

collapse all

Determine the geodetic latitude and longitude from direction cosine matrix `dcm`.

```dcm = [ 0.3747 0.5997 0.7071; ... 0.8480 -0.5299 0; ... 0.3747 0.5997 -0.7071]; [lat, lon] = dcm2latlon(dcm)```
```lat = 44.9995 ```
```lon = -122.0005 ```

Determine the geodetic latitude and longitude from multiple direction cosine matrices.

```dcm = [ 0.3747 0.5997 0.7071; ... 0.8480 -0.5299 0; ... 0.3747 0.5997 -0.7071]; dcm(:,:,2) = [-0.0531 0.6064 0.7934; ... 0.9962 0.0872 0; ... -0.0691 0.7903 -0.6088]; [lat, lon] = dcm2latlon(dcm)```
```lat = 2×1 44.9995 37.5028 ```
```lon = 2×1 -122.0005 -84.9975 ```

Determine the geodetic latitude and longitude from the direction cosine matrix `dcm` within tolerance.

```dcm = [ 0.3747 0.5997 0.7071; ... 0.8480 -0.5299 0; ... 0.3747 0.5997 -0.7071]; [lat, lon] = dcm2latlon(dcm,'Warning',0.1)```
```lat = 44.9995 ```
```lon = -122.0005 ```

## Input Arguments

collapse all

Direction cosine matrix, specified as a 3-by-3-by-M containing M orthogonal direction cosine matrices. `dcm` performs the coordinate transformation of a vector in Earth-centered Earth-fixed (ECEF) axes into a vector in North-East-down (NED) axes.

Data Types: `double`

Function behavior when direction cosine matrix is invalid, that is not orthogonal.

• `'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 of direction cosine matrix validity, 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(dcm)*dcm == 1±tolerance```).

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

Data Types: `double`

## Output Arguments

collapse all

Geodetic latitude, returned as an M array in degrees.

Geodetic longitude, returned as a M array in degrees.

## Version History

Introduced in R2006b