| Mapping Toolbox™ | ![]() |
[lattrk,lontrk] = track2(lat1,lon1,lat2,lon2)
[lattrk,lontrk] = track2(track,lat1,lon1,lat2,lon2)
[lattrk,lontrk] = track2(track,lat1,lon1,lat2,lon2,units)
[lattrk,lontrk] = track2(track,lat1,lon1,lat2,lon2,ellipsoid,units)
[lattrk,lontrk] = track2(lat1,lon1,lat2,lon2,ellipsoid,units,npts)
pts = track2(lat1,lon1,lat2,lon2,...)
[lattrk,lontrk] = track2(lat1,lon1,lat2,lon2) returns, in lattrk and lontrk, points along a (great circle) track between the points specified by lat1 with lon1 and lat2 and lon2. When the inputs are column vectors, the successive tracks are stored in separate columns of lattrk and lontrk.
[lattrk,lontrk] = track2(track,lat1,lon1,lat2,lon2) allows the specification of the track logic to be employed. A string track of 'gc' is the default, resulting in a great circle track. A track of 'rh' results in a rhumb line track.
[lattrk,lontrk] = track2(track,lat1,lon1,lat2,lon2,units) specifies the units of the inputs and outputs, where units is any valid angle unit string. The default is 'degrees'.
[lattrk,lontrk] = track2(track,lat1,lon1,lat2,lon2,ellipsoid,units) specifies the elliptical definition of the Earth with a two-element ellipsoid model vector ellipsoid. The default ellipsoid is a spherical Earth, which is sufficient for most applications.
[lattrk,lontrk] = track2(lat1,lon1,lat2,lon2,ellipsoid,units,npts) specifies the number of points, npts, per output track. npts is 100 by default.
pts = track2(lat1,lon1,lat2,lon2,...) combines the outputs into a single two-column matrix, pts.
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.
axesm('mercator','MapLatLimit',[30 50],'MapLonLimit',[-40 40])
[lattrkgc,lontrkgc] = track2(40,-35,40,35);
[lattrkrh,lontrkrh] = track2('rh',40,-35,40,35);
plotm(lattrkgc,lontrkgc,'g')
plotm(lattrkrh,lontrkrh,'r')

azimuth, distance, reckon, scircle1, scircle2, track, track1, trackg
![]() | track1 | trackg | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |