# dcmecef2ned

Convert geodetic latitude and longitude to direction cosine matrix

## Syntax

``dcm = dcmecef2ned(lat,lon)``

## Description

example

````dcm = dcmecef2ned(lat,lon)` calculates the direction cosine matrix `dcm` for a given set of geodetic latitude `lat` and longitude `lon`. ```

## Examples

collapse all

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

```lat = 45; lon = -122; dcm = dcmecef2ned(lat, lon)```
```dcm = 3×3 0.3747 0.5997 0.7071 0.8480 -0.5299 0 0.3747 0.5997 -0.7071 ```

Determine the direction cosine matrix from multiple geodetic latitudes and longitudes.

```lat = [45 37.5]; lon = [-122 -85]; dcm = dcmecef2ned(lat, lon)```
```dcm = dcm(:,:,1) = 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 ```

## Input Arguments

collapse all

Geodetic latitude, specified as an M array in degrees. Latitude values can be any value. However, latitude values of +90 and -90 may return unexpected values because of singularity at the poles.

Data Types: `double`

Geodetic longitude, specified as a M array in degrees. Longitude values can be any value.

Data Types: `double`

## Output Arguments

collapse all

Direction cosine matrix, returned as a 3-by-3-by-M matrix, where M is the number of 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.

## Version History

Introduced in R2006b