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(latitude, longitude, 'Custom', datafile, action) ```

Description

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

`N = geoidheight(latitude, longitude, modelname)` calculates the geoid height using the model, `modelname`.

`N = geoidheight(latitude, longitude, action)` calculates the geoid height using the EGM96 Geopotential Model. This function performs `action` if `latitude` or `longitude` are out of range.

`N = geoidheight(latitude, longitude, modelname, action)` calculates the geoid height using `modelname`.

```N = geoidheight(latitude, longitude, 'Custom', datafile)``` calculates the geoid height using a custom model that `datafile` defines.

```N = geoidheight(latitude, longitude, 'Custom', datafile, action)``` calculates the geoid height using the custom model. This function performs `action` if `latitude` or `longitude` are out of range.

Input Arguments

`latitude`

An array of `m` geocentric latitudes, in degrees, where north latitude is positive and south latitude is negative. `latitude` must be of type single or double. If `latitude` is not within the range –90 to 90, inclusive, this function wraps the value to be within the range.

`longitude`

An array of `m` geocentric longitudes, in degrees, where east longitude is positive and west longitude is negative. `longitude` must be of type single or double. If `longitude` is not within the range 0 to 360 inclusive, this function wraps the value to be within the range.

`modelname`

Geopotential model.

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`.

`'Custom'`

Custom geopotential model that you define in `datafile`. This function calculates geoid heights to an accuracy of 0.01 m for custom models.

Note

To deploy a custom geopotential model, explicitly include the custom data and reader files to the MATLAB® Compiler™ (`mcc`) command at compilation. For example:

```mcc -m mycustomsgeoidheightfunction... -a customDataFile```

For other geopotential models, use the MATLAB Compiler as usual.

Default: EGM96

`datafile`

Optional file that contains definitions for a custom geopotential model. Provide this file only if you specify `'Custom'` for the `modelname` argument.

This file must contain the following variables.

VariableDescription
`'latbp'`

Array of geocentric latitude breakpoints.

`'lonbp'`

Array of geocentric longitude breakpoints.

`'grid'`

Table of geoid height values.

`'windowSize'`

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

`action`

Action for out-of-range input. Specify one:

 `'Error'` `'Warning'` `'None'`

Default: `Warning`

Output Arguments

 `N` An array of `M` geoid heights in meters. The values in this array have the same data type as `latitude`.

Examples

Calculate the EGM96 geoid height at 42.4 degrees N latitude and 71.0 degrees W longitude with warning actions:

`N = geoidheight( 42.4, -71.0 )`

Calculate the EGM2008 geoid height at two different locations with error actions.

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

Calculate a custom geoid height at two different locations with no actions.

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

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.

References

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."