# geoidheight

Calculate geoid height

## Syntax

``N = geoidheight(latitude,longitude)``
``N = geoidheight(latitude,longitude,modelname)``
``N = geoidheight(latitude,longitude,action)``
``N = geoidheight(latitude,longitude,modelname,action)``
``N = geoidheight(latitude,longitude,'custom',datafile)``
``N = geoidheight(___,action)``

## Description

example

````N = geoidheight(latitude,longitude)` calculates the geoid height using the EGM96 Geopotential Model. For this geopotential model, the function calculates the geoid heights to an accuracy of 0.01 m and interpolates an array of `m` geoid heights at `m` geodetic latitudes, `latitude`, and `m` longitudes, `longitude`.`N = geoidheight(latitude,longitude,modelname)` calculates the geoid height using the geopotential model, `modelname`. ```

example

````N = geoidheight(latitude,longitude,action)` calculates the geoid height and performs `action` if `latitude` or `longitude` are out of range.`N = geoidheight(latitude,longitude,modelname,action)` calculates the geoid height using `modelname` and performs action if latitude or longitude are out of range. ```

example

````N = geoidheight(latitude,longitude,'custom',datafile)` calculates the geoid height using the custom model specified by `datafile`.`N = geoidheight(___,action)` calculates the geoid height using the custom geopotential model and performs function performs `action` if `latitude` or `longitude` are out of range. Specify `action` as the last input argument preceded by any of the input argument combinations in the previous syntaxes.```

## Examples

collapse all

Calculate the EGM96 geoid height at 42.4 degrees N latitude and 71.0 degrees W longitude. A warning, enabled by default, is returned for the out-of-range longitude value:

`N = geoidheight(42.4,-71.0)`
```Warning: One or more longitude values exceed [0,360] range. Wrapping out of range longitude values within 0 degrees and 360 degrees and continuing. > In geoidheight>@()warning(message('aero:geoidheight:warnLongitudeWrap')) (line 324) In geoidheight/checklongitude (line 328) In geoidheight (line 166) N = -28.3700```

Calculate the EGM2008 geoid height at two different locations. The function returns an error if the results are out of range:

`N = geoidheight([39.3, 33.4],[77.2,36.5],'egm2008','error')`
```N = -49.9440 23.6110```

Calculate a custom geoid height at two different locations:

```N = geoidheight([39.3,33.4],[-77.2,36.5],'custom',... 'geoidegm96grid','none')```
```N = -33.0100 25.5500```

## Input Arguments

collapse all

Geodetic latitudes, specified as an array of `m` geodetic latitudes, in degrees, where north latitude is positive and south latitude is negative.

If `latitude` is not within the range –90 to 90, inclusive, this function wraps the value to be within the range when `action` is set to `'None'` or `'Warning'`. It does not wrap when `action` is set to `'Error'`.

Data Types: `double` | `single`

Longitudes, specified as an array of `m` longitudes, in degrees, where east longitude is positive and west longitude is negative. If `longitude` is not within the range 0 to 360 inclusive, this function wraps the value to be within the range.

If `longitude` is not within the range –90 to 90, inclusive, this function wraps the value to be within the range when `action` is set to `'None'` or `'Warning'`. It does not wrap when `action` is set to `'Error'`.

Data Types: `double` | `single`

Geopotential model, specified as:

Geopotential ModelDescription
`'EGM96'`

EGM96 Geopotential Model to degree and order 360. This model uses a 15-minute grid of point values in the tide-free system. This function calculates geoid heights to an accuracy of 0.01 m for this model.

`'EGM2008'`

EGM2008 Geopotential Model to degree and order 2159. This model uses a 2.5-minute grid of point values in the tide-free system. This function calculates geoid heights to an accuracy of 0.001 m for this model.

Note

This function requires that you download EGM2008 Geopotential Model data with the Add-On Explorer. For more information, see `aeroDataPackage`.

Data Types: `char` | `string`

Custom geopotential model definitions, specified as a scalar file of definitions for a custom geopotential model.

This file must contain these variables:

VariableDescription
`'latbp'`

Array of geodetic latitude breakpoints.

`'lonbp'`

Array of longitude breakpoints.

`'grid'`

Table of geoid height values.

`'windowSize'`

Even integer scalar greater than 2 for the number of interpolation points.

Data Types: `char` | `string`

Action for out-of-range input, specified as:

• `'Error'` — Displays warning and indicates that the input is out of range

• `'Warning'` — Displays error and indicates that the input is out of range

• `'None'` — Does not display warning or error

Data Types: `char` | `string`

## Output Arguments

collapse all

Geoid heights, returned as an array of M geoid heights, in meters.

## Tips

• This function interpolates geoid heights from a grid of point values in the tide-free system.

• When using the EGM96 Model, this function has the limitations of the 1996 Earth Geopotential Model.

• When using the EGM2008 Model, this function has the limitations of the 2008 Earth Geopotential Model.

• The interpolation scheme wraps over the poles to allow for geoid height calculations at and near pole locations.

• The geoid undulations for the EGM96 and EGM2008 models are relative to the WGS84 ellipsoid.

• The WGS84 EGM96 geoid undulations have an error range of +/– 0.5 to +/– 1.0 m worldwide.

 Vallado, D. A. "Fundamentals of Astrodynamics and Applications." McGraw-Hill, New York, 1997.

 NIMA TR8350.2: "Department of Defense World Geodetic System 1984, Its Definition and Relationship with Local Geodetic Systems."

## Support #### Try MATLAB, Simulink, and Other Products

Get trial now