Main Content

Visualizing Geoid Height for Earth Geopotential Model 1996

This example shows how to calculate the Earth geoid height using the EGM96 Geopotential Model of Aerospace Toolbox software. It also shows how to visualize the results with contour maps overlaid on maps of the Earth. Mapping Toolbox™ and Simulink® 3D Animation™ are required to generate the visualizations.

Generating Values for Earth Geopotential Model 1996

To implement the EGM96 Geopotential Model, calculate values for the Earth geopotential using the geoidheight function.

Use the following code to generate 260281 data points for calculating values of the Earth geoid height using geoidheight. To reduce computational overhead, this example includes a MAT-file that contains this data.

% Set amount of increment between degrees
gridDegInc = 0.5;                   %degrees

% Longitude value in degrees to use for latitude sweep.
lon = -180:gridDegInc:180;          %degrees

% Geodetic Latitude values to sweep.
geod_lat = -90:gridDegInc:90;       %degrees

% Loop through longitude values for each array of latitudes -90:90.
for lonIdx = size(lon,2):-1:1
    % Longitude must be the same dimension as the latitude array
    lon_temp = lon(lonIdx)*ones(1,numel(geod_lat));      % degrees
    geoidResults(:,lonIdx) = geoidheight(geod_lat,lon_temp,'None');

Loading Geoid Data File and Coastal Data

geoidFileName = 'GeoidResults_05deg_180.mat';
geoidData = load(geoidFileName);
coast = load('coastlines.mat');

Plot 2-D View of Geoid Height

Create 2-D plot using meshm.

h2D = figure;
set(h2D,'Position',[20 75 700 600],'Toolbar','figure');

Reference matrix for mapping geoid heights to lat/lon on globe.

RRR = georefcells([-90, 90], [-180, 180], size(geoidData.geoidResults));

Viewing Geoid height using VR canvas.

www2D = vrworld('astGeoidHeights.wrl');

Actual geoid heights for reference.

geoidGrid = vrnode(www2D,'EGM96_Grid');
actualHeights = getfield(geoidGrid,'height'); %#ok<GFLD>

Initialize heights to 0 for slider control.

geoidGrid.height = 0*actualHeights;

Size canvas for plotting and set parameters.

geoidcanvas2D = vr.canvas(www2D,'Parent',h2D,...
    'Antialiasing', 'on','NavSpeed','veryslow',...
    'NavMode','Examine','Units', 'normalized',...
    'Viewpoint','Perspective','Position',[.15 .04 .7 .42]);

Create slider.


Figure contains objects of type hgjavacomponent, uicontrol.

Plot 3-D View of Geoid Height

h3D = figure;
set(h3D,'Position',[20 75 700 600]);

Set up axes.

hmapaxis = axesm ('globe','Grid', 'on');
set(hmapaxis,'Position',[.1 .5 .8 .4])
axis off

Plot data on 3-D globe.


Plot land mass outline.


Plot Title.

title({'EGM96 Geoid Heights';['Grid Increment: ' ,num2str(geoidData.gridDegInc), ' Degrees; Height Units: Meters']})

3-D Globe: Geoid Height Using VR Canvas.

www3D = vrworld('astGeoidSphere.wrl');

Position canvas.

geoidcanvas3D = vr.canvas(www3D,'Parent',h3D,...
    'Antialiasing', 'on','NavSpeed','veryslow',...
    'NavMode','Examine','Units', 'normalized',...
    'Position',[.15 .04 .7 .4]);

Figure contains an object of type hgjavacomponent.


Clean Up


See Also