egm96geoid
Geoid height from Earth Gravitational Model 1996 (EGM96)
Syntaxes of the egm96geoid
function that return referencing vectors
have been removed. Use a syntax that returns a reference object instead. For more information,
see Version History.
Description
returns the height in meters of the geoid at the specified latitude and longitude from the
Earth Gravitational Model of 1996 (EGM96). Specify latitude and
longitude in degrees.N
= egm96geoid(lat
,lon
)
[
returns geoid heights for the entire globe as a 721-by-1441 matrix spaced at 15-minute
intervals with latitude limits N
,globalR
] = egm96geoid[-90 90]
and longitude limits
[0 360]
. The function also returns a geographic postings reference
object that contains spatial referencing information for the geoid heights.
Examples
Geoid Height from Latitude and Longitude
Find geoid heights from EGM96 by specifying latitude and longitude values in degrees. The result is returned in meters.
lat = 27.988056; lon = 86.925278; N = egm96geoid(lat,lon)
N = -28.7444
Geoid Heights within Limits
View geoid heights from EGM96 for an area including Europe.
First, create a GeographicPostingsReference
object. Specify the latitude and longitude limits of the area in degrees. Specify the raster size as the number of rows and columns for the grid of geoid heights. Then, return the grid of geoid heights for the area by calling egm96geoid
on the reference object.
latlim = [35 72]; lonlim = [-12 51]; rasterSize = [100 100]; R = georefpostings(latlim,lonlim,rasterSize); N = egm96geoid(R);
Note that the size of N
matches the raster size of R
.
size(N)
ans = 1×2
100 100
Load coastline latitude and longitude data into the workspace. Then, plot the geoid height and coastline data on a map.
load coastlines worldmap(latlim,lonlim) geoshow(N,R,'DisplayType','surface') geoshow(coastlat,coastlon,'Color','k')
Geoid Heights for Entire Globe
View geoid heights from EGM96 for the entire globe.
First, return the geoid heights and a referencing object for the globe. The geoid heights are spaced at 15-minute intervals. Load coastline latitude and longitude data into the workspace. Then, plot the geoid heights and coastline data on a world map.
[N,R] = egm96geoid; load coastlines worldmap('World') geoshow(N,R,'DisplayType','surface') geoshow(coastlat,coastlon,'Color','k')
Input Arguments
lat
— Latitude
scalar | vector | matrix
Latitude in degrees, specified as a scalar, vector, or matrix. The dimension of
lat
depends on the dimension of the geoid heights you want to find.
To find a single geoid height, specify
lat
andlon
as scalars.To find several geoid heights, specify
lat
andlon
as vectors of the same length.To find a p-by-q grid of geoid heights, specify
lat
andlon
as p-by-q matrices.
Data Types: single
| double
lon
— Longitude
scalar | vector | matrix
Longitude in degrees, specified as a scalar, vector, or matrix. The dimension of
lon
depends on the dimension of the geoid heights you want to find.
To find a single geoid height, specify
lat
andlon
as scalars.To find several geoid heights, specify
lat
andlon
as vectors of the same length.To find a p-by-q grid of geoid heights, specify
lat
andlon
as p-by-q matrices.
Data Types: single
| double
R
— Geographic reference
GeographicPostingsReference
object | GeographicCellsReference
object
Geographic reference, specified as a GeographicPostingsReference
object or a GeographicCellsReference
object that contains geospatial
referencing information for N
. The RasterSize
property of the geographic reference object determines the size of the data grid,
size(N)
.
Output Arguments
globalR
— Geographic reference
GeographicPostingsReference
object
Geographic reference, returned as a GeographicPostingsReference
object of size 721-by-1441 with latitude limits [-90 90]
and
longitude limits [0 360]
.
More About
Earth Gravitational Model of 1996 (EGM96)
The geoid is an equipotential surface of the
Earth's gravity field that approximates global mean sea level. You can visualize the geoid
as the surface of the ocean without effects such as weather, waves, and land. The Earth
Gravitational Model of 1996 (EGM96) is based on the ellipsoid specified by the World
Geodetic System of 1984 (WGS84), so the egm96geoid
function returns
heights above or below the surface of the WGS84 ellipsoid.
Version History
Introduced before R2006aR2023b: Syntaxes that return referencing vectors have been removed
Syntaxes of the egm96geoid
function that return referencing vectors
have been removed. Use a syntax that returns a geographic raster reference object instead.
Reference objects have several advantages over referencing vectors.
Unlike referencing vectors, reference objects have properties that document the size of the associated raster, its geographic limits, and the direction of its rows and columns. For more information about reference object properties, see the
GeographicCellsReference
andGeographicPostingsReference
objects.You can manipulate the limits of rasters associated with reference objects using the
geocrop
function.You can manipulate the size and resolution of rasters associated with reference objects using the
georesize
function.Most functions that accept referencing vectors as inputs also accept reference objects.
This table shows the syntaxes of the egm96geoid
function that
return referencing vectors and how to update your code to use syntaxes that return reference
objects instead.
Removed | Recommended |
---|---|
[N,refvec] = egm96geoid(samplefactor); |
[~,globalR] = egm96geoid; latlim = globalR.LatitudeLimits; lonlim = globalR.LongitudeLimits; globalSize = globalR.RasterSize; rasterSize = 1 + ceil((globalSize-1)/samplefactor); R = georefpostings(latlim,lonlim,rasterSize); N = egm96geoid(R); |
[N,refvec] = egm96geoid(samplefactor,latlim,lonlim); |
[~, globalR] = egm96geoid;
spacing = samplefactor ...
* globalR.SampleSpacingInLatitude;
R = georefpostings(latlim,lonlim,spacing,spacing);
N = egm96geoid(R); |
R2022a: Syntaxes that return referencing vectors warn
Syntaxes of the egm96geoid
function that return referencing vectors
issue a warning that they will be removed in a future release.
R2020b: Syntaxes that return referencing vectors will be removed
Syntaxes of the egm96geoid
function that return referencing vectors
will be removed in a future release.
R2020a: Return geoid heights referenced to geographic reference object
Return geoid heights from EGM96 that are referenced to a geographic raster reference
object. You can specify GeographicCellsReference
or
GeographicPostingsReference
objects, or return geoid heights and a
reference object for the entire globe spaced at 15-minute intervals.
R2019b: Return geoid heights at specified latitudes and longitudes
Return geoid heights from EGM96 by specifying latitude and longitude in degrees. For example, find the geoid height at a latitude of 42.3601 degrees and a longitude of -71.589 degrees:
N = egm96geoid(42.3601,-71.589);
R2019b: Improved performance
In previous releases, egm96geoid
accessed geoid heights using
WW15MGH.GRD
, a file that you downloaded from the Internet. Starting in
R2019b, a grid of geoid heights from EGM96 is included with Mapping Toolbox™, and egm96geoid
no longer reads data from
WW15MGH.GRD
.
As a result, the egm96geoid
function shows improved performance.
For example, this code shows about a 15x speed-up when you return the entire grid of geoid
heights:
function timingTest N = egm96geoid(1); end
The approximate execution times are:
R2019a: 0.1838 s
R2019b: 0.0121 s
This code was timed on a Windows® 10 test system with a 3.6-GHz Intel®
Xeon® W-2133 CPU using the timeit
function:
timeit(@timingTest)
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)