Main Content

# dcm2latlon

Convert direction cosine matrix to geodetic latitude and longitude

## Syntax

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

## Description

`[lat lon] = dcm2latlon(n)` calculates the geodetic latitude and longitude, `lat` and `lon`, for a given direction cosine matrix, `n`. `n` is a 3-by-3-by-`m` matrix containing `m` orthogonal direction cosine matrices. `lat` is an `m` array of geodetic latitudes. `lon` is an `m` array of longitudes. `n` performs the coordinate transformation of a vector in Earth-centered Earth-fixed (ECEF) axes into a vector in north-east-down (NED) axes. Geodetic latitudes and longitudes are output in degrees.

`[lat lon] = dcm2latlon(n,action)` performs `action` if the direction cosine matrix is invalid (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 (default).

`[lat lon] = dcm2latlon(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 geodetic latitude and longitude from direction cosine matrix:

```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 = 44.9995 37.5028 lon = -122.0005 -84.9975```

Determine the geodetic latitude and longitude from multiple direction cosine matrices validated within tolerance:

```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,'Warning',0.1) lat = 44.9995 37.5028 lon = -122.0005 -84.9975```

## See Also

Introduced in R2006b

## Support Get trial now