# geodetic2ned

Transform geodetic coordinates to local north-east-down

## Syntax

## Description

`[`

transforms the geodetic coordinates specified by `xNorth`

,`yEast`

,`zDown`

]
= geodetic2ned(`lat`

,`lon`

,`h`

,`lat0`

,`lon0`

,`h0`

,`spheroid`

)`lat`

,
`lon`

, and `h`

to the local
north-east-down (NED) Cartesian coordinates specified by
`xNorth`

, `yEast`

, and
`zDown`

. Specify the origin of the local NED system with the
geodetic coordinates `lat0`

, `lon0`

, and
`h0`

. Each coordinate input argument must match the others in
size or be scalar. Specify `spheroid`

as the reference spheroid
for the geodetic coordinates.

`[___] = geodetic2ned(___,`

specifies the units for latitude and longitude. Specify
`angleUnit`

)`angleUnit`

as `'degrees'`

(the default) or
`'radians'`

.

## Examples

### Calculate NED Coordinates from Geodetic Coordinates

Find the NED coordinates of Mount Mansfield with respect to a nearby aircraft, using their geodetic coordinates.

First, specify the reference spheroid as WGS 84. For more information about WGS 84, see Comparison of Reference Spheroids. The units for the ellipsoidal height and NED coordinates must match the units specified by the `LengthUnit`

property of the reference spheroid. The default length unit for the reference spheroid created by `wgs84Ellipsoid`

is `'meter'`

.

wgs84 = wgs84Ellipsoid;

Specify the geodetic coordinates of the local origin. In this example, the local origin is the aircraft. Specify `h0`

as ellipsoidal height in meters.

lat0 = 44.532; lon0 = -72.782; h0 = 1699;

Specify the geodetic coordinates of the point of interest. In this example, the point of interest is Mount Mansfield. Specify `h`

as ellipsoidal height in meters.

lat = 44.544; lon = -72.814; h = 1340;

Then, calculate the NED coordinates of Mount Mansfield with respect to the aircraft. Since the ellipsoidal height of the aircraft is greater than the height of Mount Mansfield, a passenger needs to look down to see the mountaintop. The *z*-axis of an NED coordinate system points down. Thus, the value of `zDown`

is positive. View the results in standard notation by specifying the display format as `shortG`

.

```
format shortG
[xNorth,yEast,zDown] = geodetic2ned(lat,lon,h,lat0,lon0,h0,wgs84)
```

xNorth = 1334.3

yEast = -2543.6

zDown = 359.65

Reverse the transformation using the `ned2geodetic`

function.

[lat,lon,h] = ned2geodetic(xNorth,yEast,zDown,lat0,lon0,h0,wgs84)

lat = 44.544

lon = -72.814

h = 1340

## Input Arguments

`lat`

— Geodetic latitude

scalar | vector | matrix | N-D array

Geodetic latitude of one or more points, specified as a scalar, vector, matrix, or N-D
array. Specify the values in degrees. To use values in radians, specify the
`angleUnit`

argument as `'radians'`

.

**Data Types: **`single`

| `double`

`lon`

— Geodetic longitude

scalar | vector | matrix | N-D array

Geodetic longitude of one or more points, specified as a scalar, vector, matrix, or
N-D array. Specify the values in degrees. To use values in radians, specify the
`angleUnit`

argument as `'radians'`

.

**Data Types: **`single`

| `double`

`h`

— Ellipsoidal height

scalar | vector | matrix | N-D array

Ellipsoidal height of one or more points, specified as a scalar, vector, matrix, or
N-D array. Specify values in units that match the `LengthUnit`

property
of the `spheroid`

object. For example, the default length unit for
the reference ellipsoid created by `wgs84Ellipsoid`

is `'meter'`

.

For more information about ellipsoidal height, see Find Ellipsoidal Height from Orthometric Height.

**Data Types: **`single`

| `double`

`lat0`

— Geodetic latitude of local origin

scalar | vector | matrix | N-D array

Geodetic latitude of the local origin, specified as a scalar, vector, matrix, or N-D array.
The local origin can refer to one point or a series of points (for example, a moving
platform). Specify the values in degrees. To use values in radians, specify the
`angleUnit`

argument as `'radians'`

.

**Data Types: **`single`

| `double`

`lon0`

— Geodetic longitude of local origin

scalar | vector | matrix | N-D array

Geodetic longitude of the local origin, specified as a scalar, vector, matrix, or N-D
array. The local origin can refer to one point or a series of points (for example, a
moving platform). Specify the values in degrees. To use values in radians, specify the
`angleUnit`

argument as `'radians'`

.

**Data Types: **`single`

| `double`

`h0`

— Ellipsoidal height of local origin

scalar | vector | matrix | N-D array

Ellipsoidal height of the local origin, specified as a scalar, vector, matrix, or N-D array.
The local origin can refer to one point or a series of points (for example, a moving
platform). Specify values in units that match the `LengthUnit`

property
of the `spheroid`

object. For example, the default length unit for
the reference ellipsoid created by `wgs84Ellipsoid`

is `'meter'`

.

For more information about ellipsoidal height, see Find Ellipsoidal Height from Orthometric Height.

**Data Types: **`single`

| `double`

`spheroid`

— Reference spheroid

`referenceEllipsoid`

object | `oblateSpheroid`

object | `referenceSphere`

object

Reference spheroid, specified as a `referenceEllipsoid`

object, `oblateSpheroid`

object, or `referenceSphere`

object. The term reference spheroid is used synonymously
with reference ellipsoid. To create a reference spheroid, use the creation function for
the object. To specify the reference ellipsoid for WGS84, use the `wgs84Ellipsoid`

function.

For more information about reference spheroids, see Comparison of Reference Spheroids.

**Example: **`spheroid = referenceEllipsoid('GRS 80');`

`angleUnit`

— Angle units

`'degrees'`

(default) | `'radians'`

Angle units, specified as `'degrees'`

(the default) or
`'radians'`

.

## Output Arguments

`xNorth`

— NED *x*-coordinates

scalar | vector | matrix | N-D array

NED *x*-coordinates of one or more points in the local NED system,
returned as a scalar, vector, matrix, or N-D array. Units are specified by the
`LengthUnit`

property of the `spheroid`

argument. For example, the default length unit for the reference ellipsoid created by
`wgs84Ellipsoid`

is
`'meter'`

.

`yEast`

— NED *y*-coordinates

scalar | vector | matrix | N-D array

NED *y*-coordinates of one or more points in the local NED system,
returned as a scalar, vector, matrix, or N-D array. Units are specified by the
`LengthUnit`

property of the `spheroid`

argument. For example, the default length unit for the reference ellipsoid created by
`wgs84Ellipsoid`

is
`'meter'`

.

`zDown`

— NED *z*-coordinates

scalar | vector | matrix | N-D array

NED *z*-coordinates of one or more points in the local NED system,
returned as a scalar, vector, matrix, or N-D array. Units are specified by the
`LengthUnit`

property of the `spheroid`

argument. For example, the default length unit for the reference ellipsoid created by
`wgs84Ellipsoid`

is
`'meter'`

.

## Extended Capabilities

### C/C++ Code Generation

Generate C and C++ code using MATLAB® Coder™.

## Version History

**Introduced in R2012b**

### R2021a: Generate C and C++ code using MATLAB Coder

The `geodetic2ned`

function supports code generation.

## See Also

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)