## Documentation Center |

Geographic tracks from starting and ending points

`[lat,lon] = track2(lat1,lon1,lat2,lon2)[lat,lon] = track2(lat1,lon1,lat2,lon2,ellipsoid)[lat,lon] = track2(lat1,lon1,lat2,lon2,`

`[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,npts)` uses
the scalar input

`[lat,lon] = track2(track,...)` uses
the

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

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.

% 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')

`azimuth` | `distance` | `reckon` | `scircle1` | `scircle2` | `track` | `track1` | `trackg`

Was this topic helpful?