# gravitywgs84

Implement 1984 World Geodetic System (WGS84) representation of Earth's gravity

## Syntax

```g = gravitywgs84(h, lat) g = gravitywgs84(h, lat, lon, method, [noatm, nocent, prec, jd], action) gn = gravitywgs84(h, lat, lon, 'Exact', [noatm, nocent, prec, jd], action) [gn gt] = gravitywgs84(h, lat, lon, 'Exact', [noatm, nocent, prec, jd], action) ```

## Description

`g = gravitywgs84(h, lat)` implements the mathematical representation of the geocentric equipotential ellipsoid of WGS84. Using `h`, an array of `m` altitudes in meters, and `lat`, an array of `m` geodetic latitudes in degrees, calculates `g`, an array of `m` gravity values in the direction normal to the Earth's surface at a specific location. The default calculation method is Taylor Series. Gravity precision is controlled via the `method` parameter.

```g = gravitywgs84(h, lat, lon, method, [noatm, nocent, prec, jd], action)``` lets you specify both latitude and longitude, as well as other optional inputs, when calculating gravity values in the direction normal to the Earth's surface. In this format, `method` can be either `'CloseApprox'`or`'Exact'`.

```gn = gravitywgs84(h, lat, lon, 'Exact', [noatm, nocent, prec, jd], action)``` calculates an array of total gravity values in the direction normal to the Earth's surface.

```[gn gt] = gravitywgs84(h, lat, lon, 'Exact', [noatm, nocent, prec, jd], action)``` calculates gravity values in the direction both normal and tangential to the Earth's surface.

Inputs for `gravitywgs84` are:

 `h` An array of `m` altitudes, in meters, with respect to the WGS84 ellipsoid. `lat` An array of `m` geodetic latitudes, in degrees, where north latitude is positive, and south latitude is negative. `lon` An array of `m` geodetic longitudes, in degrees, where east longitude is positive, and west longitude is negative. This input is available only with `method` specified as `'CloseApprox'`or`'Exact'`. `method` Method to calculate gravity: `'TaylorSeries'`, `'CloseApprox'`, or `'Exact'`. The default is `'TaylorSeries'`. `noatm` A logical value specifying the exclusion of Earth's atmosphere. Set to `true` for the Earth's gravitational field to exclude the mass of the atmosphere. Set to `false` for the value for the Earth's gravitational field to include the mass of the atmosphere. This option is available only with `method` specified as `'CloseApprox'`or`'Exact'`. The default is `false`. `nocent` A logical value specifying the removal of centrifugal effects. Set to `true` to calculate gravity based on pure attraction resulting from the normal gravitational potential. Set to `false` to calculate gravity including the centrifugal force resulting from the Earth's angular velocity. This option is available only with `method` specified as `'CloseApprox'`or`'Exact'`. The default is `false`. `prec` A logical value specifying the presence of a precessing reference frame. Set to `true` for the angular velocity of the Earth to be calculated using the International Astronomical Union (IAU) value of the Earth's angular velocity and the precession rate in right ascension. To obtain the precession rate in right ascension, Julian Centuries from Epoch J2000.0 is calculated using the Julian date, `jd`. If set to `false`, the angular velocity of the Earth used is the value of the standard Earth rotating at a constant angular velocity. This option is available only with `method` specified as `'CloseApprox'`or`'Exact'`. The default is `false`. `jd` A scalar value specifying Julian date used to calculate Julian Centuries from Epoch J2000.0. This input is available only with `method` specified as `'CloseApprox'`or`'Exact'`. `action` Action for out-of-range input. Specify if out-of-range input invokes a `'Warning'`, `'Error'`, or no action (`'None'`). The default is `'Warning'`.

Outputs calculated for the Earth's gravity include:

 `g` An array of `m` gravity values in the direction normal to the Earth's surface at a specific `lat` `lon` location. A positive value indicates a downward direction. `gt` An array of `m` gravity values in the direction tangential to the Earth's surface at a specific `lat` `lon` location. A positive value indicates a northward direction. This option is available only with `method` specified as`'Exact'`. `gn` An array of `m` total gravity values in the direction normal to the Earth's surface at a specific `lat` `lon` location. A positive value indicates a downward direction. This option is available only with `method` specified as`'Exact'`.

## Examples

Calculate the normal gravity at 5000 meters and 55 degrees latitude using the Taylor Series approximation method with errors for out-of-range inputs:

```g = gravitywgs84( 5000, 55, 'TaylorSeries', 'Error') g = 9.7997 ```

Calculate the normal gravity at 15,000 meters, 45 degrees latitude, and 120 degrees longitude using the Close Approximation method with atmosphere, centrifugal effects, and no precessing, with warnings for out-of-range inputs:

```g = gravitywgs84( 15000, 45, 120, 'CloseApprox') g = 9.7601```

Calculate the normal and tangential gravity at 1000 meters, 0 degrees latitude, and 20 degrees longitude using the Exact method with atmosphere, centrifugal effects, and no precessing, with warnings for out-of-range inputs:

```[gn, gt] = gravitywgs84( 1000, 0, 20, 'Exact') gn = 9.7772 gt = 0```

Calculate the normal and tangential gravity at 1000 meters, 0 degrees latitude, and 20 degrees longitude and 11,000 meters, 30 degrees latitude, and 50 degrees longitude using the Exact method with atmosphere, centrifugal effects, and no precessing, with no actions for out-of-range inputs:

```h = [1000; 11000]; lat = [0; 30]; lon = [20; 50]; [gn, gt] = gravitywgs84( h, lat, lon, 'Exact', 'None' ) gn = 9.7772 9.7594 gt = 1.0e-04 * 0 -0.7751```

Calculate the normal gravity at 15,000 meters, 45 degrees latitude, and 120 degrees longitude and 5000 meters, 55 degrees latitude, and 100 degrees longitude using the Close Approximation method with atmosphere, no centrifugal effects, and no precessing, with warnings for out-of-range inputs:

```h = [15000 5000]; lat = [45 55]; lon = [120 100]; g = gravitywgs84( h, lat, lon, 'CloseApprox', [false true false 0]) g = 9.7771 9.8109 ```

Calculate the normal and tangential gravity at 1000 meters, 0 degrees latitude, and 20 degrees longitude using the Exact method with atmosphere, centrifugal effects, and precessing at Julian date 2451545, with warnings for out-of-range inputs:

```[gn, gt] = gravitywgs84( 1000, 0, 20, 'Exact', ... [ false false true 2451545 ], 'Warning') gn = 9.7772 gt = 0 ```

Calculate the normal gravity at 15,000 meters, 45 degrees latitude, and 120 degrees longitude using the Close Approximation method with no atmosphere, with centrifugal effects, and with precessing at Julian date 2451545, with errors for out-of-range inputs:

```g = gravitywgs84( 15000, 45, 120, 'CloseApprox', ... [ true false true 2451545 ], 'Error') g = 9.7601 ```

Calculate the total normal gravity at 15,000 meters, 45 degrees latitude, and 120 degrees longitude using the Exact method with no atmosphere, with centrifugal effects, and with precessing at Julian date 2451545, with errors for out-of-range inputs:

```gn = gravitywgs84( 15000, 45, 120, 'Exact', ... [ true false true 2451545 ], 'Error') gn = 9.7601 ```

## Assumptions and Limitations

The WGS84 gravity calculations are based on the assumption of a geocentric equipotential ellipsoid of revolution. Since the gravity potential is assumed to be the same everywhere on the ellipsoid, there must be a specific theoretical gravity potential that can be uniquely determined from the four independent constants defining the ellipsoid.

Use of the WGS84 Taylor Series model should be limited to low geodetic heights. It is sufficient near the surface when submicrogal precision is not necessary. At medium and high geodetic heights, it is less accurate.

Use of the WGS84 Close Approximation model should be limited to a geodetic height of 20,000.0 meters (approximately 65,620.0 feet). Below this height, it gives results with submicrogal precision.

To predict and determine a satellite orbit with high accuracy, use the EGM96 through degree and order 70.

## References

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

#### Introduced in R2006b

##### Support Get trial now