Mapping Toolbox    
gradientm

Numerical gradient, slope and aspect of matrix maps.

Syntax

Description

[aspect,slope,gradN,gradE] = gradientm(map,maplegend) computes the slope, aspect and north and east components of the gradient for a regular matrix map. If the map contains elevations in meters, the resulting aspect and slope are in units of degrees clockwise from north and up from the horizontal. The north and east gradient components are the change in the map variable per meter of distance in the north and east directions. The computation uses finite differences for the map variable on the default earth ellipsoid.

[aspect,slope,gradN,gradE] = gradientm(lat,lon,map) does the computation for a general matrix map.

[aspect,slope,gradN,gradE] = gradientm(map,maplegend,ellipsoid) and [aspect,slope,gradN,gradE] = gradientm(lat,lon,map,ellipsoid) use the provided ellipsoid definition. The ellipsoid vector is of the form [semimajor axes, eccentricity]. If the map contains elevations in the same units as ellipsoid(1), the slope and aspect are in units of degrees. This calling form is most useful for computations on bodies other than the earth.

[aspect,slope,gradN,gradE] = gradientm(lat,lon,map,ellipsoid,units) specifies the angle units of the latitude and longitude inputs. If omitted, 'degrees' are assumed. For elevation maps in the same units as ellipsoid(1), the resulting slope and aspect are in the specified units. The components of the gradient are the change in the map variable per unit of ellipsoid(1).

Example

Compute the gradient, slope, and aspect for a regular matrix map based on the MATLAB peaks matrix. Show the gradientm outputs as colors on a three-dimensional surfaces of elevation. The surfaces are shown with no vertical exaggeration.

Remarks

Coarse digital elevation models may considerably underestimate the local slope. For the above map, the elevation points are separated by about 10 kilometers. The terrain between two adjacent points is modelled as a linear variation, while actual terrain may vary much more abruptly over such a distance.

See Also
gradient
Approximate gradient
viewshed
Visible areas from a point on a digital elevation map


  getseeds grepfields