| Mapping Toolbox™ | ![]() |
[lattrk,lontrk] = track(waypts)
[lattrk,lontrk] = track(waypts,units)
[lattrk,lontrk] = track(lat,lon)
[lattrk,lontrk] = track(lat,lon,ellipsoid)
[lattrk,lontrk] = track(lat,lon,ellipsoid,units,npts)
[lattrk,lontrk] = track(method,lat,...)
trkpts = track(lat,lon...)
[lattrk,lontrk] = track(waypts) returns points in lattrk and lontrk along a track between the waypoints provided in navigational track format in the two-column matrix waypts. The outputs are column vectors in which successive segments are delineated with NaNs.
[lattrk,lontrk] = track(waypts,units) specifies the units of the inputs and outputs, where units is any valid angle unit string. The default is 'degrees'.
[lattrk,lontrk] = track(lat,lon) allows the user to input the waypoints in two vectors, lat and lon.
[lattrk,lontrk] = track(lat,lon,ellipsoid) 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] = track(lat,lon,ellipsoid,units,npts) establishes how many intermediate points are to be calculated for every track segment. By default, npts is 30.
[lattrk,lontrk] = track(method,lat,...) establishes the logic to be used to determine the intermediate points along the track between waypoints. Because this is a navigationally motivated function, the default method is 'rh', which results in rhumb line logic. Great circle logic can be specified with 'gc'.
trkpts = track(lat,lon...) compresses the output into one two-column matrix, trkpts, in which the first column represents latitudes and the second column, longitudes.
The track function is useful for generating data in order to display tracks. Lieutenant Sextant is the navigator of the USS Neversail. He is charged with plotting a track to take Neversail from the Straits of Gibraltar to Port Said, Egypt, the northern end of the Suez Canal. He has picked appropriate waypoints and now would like to display the track for his captain's approval.
First, display a chart of the Mediterranean Sea:
load coast
axesm('mercator','MapLatLimit',[28 47],'MapLonLimit',[-10 37]...
'Grid,'on','Frame','on','MeridianLabel','on','ParallelLabel','on)
geoshow(lat,long,'DisplayType','line','color,'b')These are the waypoints Lt. Sextant has selected:
waypoints = [36,-5; 36,-2; 38,5; 38,11; 35,13; 33,30; 31.5,32] waypoints = 36.0000 -5.0000 36.0000 -2.0000 38.0000 5.0000 38.0000 11.0000 35.0000 13.0000 33.0000 30.0000 31.5000 32.0000
Now display the track:
[lttrk,lntrk] = track('rh',waypoints,'degrees');
geoshow(lttrk,lntrk,'DisplayType','line','color,'r')
With a display this clear, the captain gladly approves the plan.

dreckon, gcwaypts, legs, navfix
![]() | toRadians | track1 | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |