Main Content

# gravitywgs84

Implement 1984 World Geodetic System (WGS84) representation of Earth 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

example

````g = gravitywgs84(h,lat)` implements the mathematical representation of the geocentric equipotential ellipsoid of WGS84 using altitude `h` and geodetic latitude `lat`. `g = gravitywgs84(h,lat,lon,method,[noatm,nocent,prec,jd],action)` uses both latitude and longitude, as well as other optional inputs. `method` must be `'CloseApprox'`, `'Exact'`, or `TaylorSeries`. ```

example

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

example

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

## Examples

collapse all

Calculate the normal gravity at 5000 meters and 55 degrees latitude using the Taylor Series approximation method and return 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 precession. A warning, enabled by default, is returned 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 precession. A warning, enabled by default, is returned 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 the normal and tangential gravity at 11,000 meters, 30 degrees latitude, and 50 degrees longitude using the Exact method with atmosphere, centrifugal effects, and no precession. Do not return 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 the normal gravity at 5000 meters, 55 degrees latitude, and 100 degrees longitude using the Close Approximation method with atmosphere, no centrifugal effects, and no precession. A warning, enabled by default, is returned 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 precession at Julian date 2451545. Return 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 precession at Julian date 2451545. Return 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 precession at Julian date 2451545. Return errors for out-of-range inputs.

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

## Input Arguments

collapse all

Altitudes, specified as an array of m values, with respect to the WGS84 ellipsoid, in meters.

Data Types: `double`

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

Data Types: `double`

Geodetic longitudes, specified as an array of m longitudes, in degrees, where the east longitude is positive, and west longitude is negative.

Only use this input when you specify `method` as `'CloseApprox'` or `'Exact'`.

Data Types: `double`

Gravity calculation method, specified as:

• `'TaylorSeries'` — Medium gravity precision

• `'CloseApprox'` — Close gravity precision

• `'Exact'` — Exact gravity precision

For more information, see Limitations.

Data Types: `double`

Exclude or include Earth atmosphere, specified as `true` or `false`:

• `false` — Include the mass of the atmosphere in the value for the Earth gravitational field.

• `true` — Exclude the mass of the atmosphere in the value for the Earth gravitational field.

Only use this input when you specify `method` as `'CloseApprox'` or `'Exact'`.

Data Types: `logical`

Remove or include centrifugal effects, specified as:

• `false` — Calculate gravity including the centrifugal force resulting from the Earth angular velocity; the centrifugal contribution is included.

• `true` — Calculate gravity based on pure attraction resulting from the normal gravitational potential; the centrifugal contribution is excluded.

Only use this input when you specify `method` as `'CloseApprox'` or `'Exact'`.

Data Types: `logical`

Include or exclude a precession reference frame.

• `false` — Calculate gravity using the angular velocity of the Earth as the value of the standard Earth rotating at a constant angular velocity.

• `true` — Calculate gravity using the International Astronomical Union (IAU) value of the Earth angular velocity and the precession rate in right ascension. For the precession rate in right ascension, this option calculates Julian centuries from Epoch J2000.0 using the Julian date, `jd`.

Only use this input when you specify `method` as `'CloseApprox'` or `'Exact'`.

Data Types: `logical`

Julian date, specified as a scalar, to calculate Julian centuries from Epoch J2000.0. The `prec` option uses this option to calculate Julian centuries from Epoch J2000.0 for the precession rate in right ascension.

Only use this input when you specify `method` as `'CloseApprox'` or `'Exact'`.

Data Types: `double`

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

• Warning — Displays warning and indicates that the input is out-of-range.

• Error — 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

Gravity values normal to the Earth surface at specific longitude and latitude, returned as an array of m gravity values in the direction normal to the Earth surface. A positive value indicates a downward direction.

Total gravity values normal to the Earth surface at a specific `lat` `lon` location, returned as an array of `m` gravity values. A positive value indicates a downward direction.

#### Dependencies

This output is available only with `method` specified as`'Exact'`. When `method` is `'TaylorSeries'` or `'CloseApprox'`, the function assumes that `gn` equals `g`.

An array of m gravity values in the direction tangential to the Earth surface at a specific `lat` `lon` location. A positive value indicates a northward direction.

#### Dependencies

This output is available only with `method` specified as `'Exact'`.

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

• Limit use of the WGS84 Taylor Series model 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.

• Limit use of the WGS84 Close Approximation model to a geodetic height of 20,000.0 meters (approximately 65,620.0 feet). Below this height, the function gives results with submicrogal precision.

• To predict and determine a satellite orbit with high accuracy, instead of the `gravitywgs84` function, use the `gravitysphericalharmonics` function with the `EGM96` option and degree and order 70.

 National Imagery and Mapping Agency (NIMA). “Department of Defense World Geodetic System 1984: Its Definition, and Relationship with Local Geodetic Systems, TR8350.2, Third Ed.” Department of Defense, Washington, DC: 1997.

## Support Get trial now