Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

track2

Geographic tracks from starting and ending points

Syntax

[lat,lon] = track2(lat1,lon1,lat2,lon2)
[lat,lon] = track2(lat1,lon1,lat2,lon2,ellipsoid)
[lat,lon] = track2(lat1,lon1,lat2,lon2,units)
[lat,lon] = track2(lat1,lon1,lat2,lon2,ellipsoid,units)
[lat,lon] = track2(lat1,lon1,lat2,lon2,ellipsoid,units,npts)
[lat,lon] = track2(track,...)
mat = track2(...)

Description

[lat,lon] = track2(lat1,lon1,lat2,lon2) computes great circle tracks on a sphere starting at the point lat1,lon1 and ending at lat2,lon2. The inputs can be scalar or column vectors.

[lat,lon] = track2(lat1,lon1,lat2,lon2,ellipsoid) computes the great circle track on the ellipsoid defined by the input ellipsoid. ellipsoid is a referenceSphere, referenceEllipsoid, or oblateSpheroid object, or a vector of the form [semimajor_axis eccentricity]. If ellipsoid = [], a sphere is assumed.

[lat,lon] = track2(lat1,lon1,lat2,lon2,units) and
[lat,lon] = track2(lat1,lon1,lat2,lon2,ellipsoid,units) are both valid calling forms, which use the input character vector units to define the angle units of the inputs and outputs. If you omit units, 'degrees' is assumed.

[lat,lon] = track2(lat1,lon1,lat2,lon2,ellipsoid,units,npts) uses the scalar input npts to determine the number of points per track computed. The default value of npts is 100.

[lat,lon] = track2(track,...) uses the track to define either a great circle or a rhumb line track. If track = 'gc', then great circle tracks are computed. If track = 'rh', then rhumb line tracks are computed. If you omit track, 'gc' is assumed.

mat = track2(...) returns a single output argument where mat = [lat lon]. This is useful if a single track is computed. Multiple tracks can be defined from a single starting point by providing scalar inputs for lat1,lon1 and column vectors for lat2,lon2.

Definitions

A path along the surface of the Earth connecting two points is a track. Two types of track lines are of interest geographically, great circles and rhumb lines. Great circles represent the shortest possible path between two points. Rhumb lines are paths with constant angular headings. They are not, in general, the shortest path between two points.

Examples

% Set up the axes.
axesm('mercator','MapLatLimit',[30 50],'MapLonLimit',[-40 40])

% Calculate the great circle track.
[lattrkgc,lontrkgc] = track2(40,-35,40,35);

% Calculate the rhumb line track.
[lattrkrh,lontrkrh] = track2('rh',40,-35,40,35);

% Plot both tracks.
plotm(lattrkgc,lontrkgc,'g')
plotm(lattrkrh,lontrkrh,'r')

Introduced before R2006a

Was this topic helpful?