Main Content

track1

Geographic track points from starting point, azimuth, and range

    Description

    Track Points Along Unit Sphere

    [lattrk,lontrk] = track1(lat0,lon0,az) finds the latitude and longitude coordinates of track points along the great circle azimuth az starting at the point with coordinates lat0 and lon0. This syntax references the coordinates to a unit sphere and assumes that all input arguments are in degrees.

    [lattrk,lontrk] = track1(lat0,lon0,az,arclen) specifies the length of the track as the spherical distance arclen.

    example

    [lattrk,lontrk] = track1(lat0,lon0,az,units) specifies the angle units units for the inputs and outputs.

    [lattrk,lontrk] = track1(lat0,lon0,az,arclen,units) specifies both the length of the track and the angle units.

    Track Points Along Ellipsoid

    [lattrk,lontrk] = track1(lat0,lon0,az,arclen,ellipsoid) finds track points along a geodesic on the reference ellipsoid ellipsoid. In most cases, this syntax assumes that arclen is a linear distance in the units of the semimajor axis of the reference ellipsoid.

    example

    [lattrk,lontrk] = track1(lat0,lon0,az,arclen,ellipsoid,units) additionally specifies the units for the azimuth and coordinates.

    [lattrk,lontrk] = track1(lat0,lon0,az,arclen,ellipsoid,units,npts) additionally specifies the number of track points to find.

    Additional Options

    [lattrk,lontrk] = track1(method,___), where method is "rh", calculates track points along rhumb lines. The default for method is "gc", which calculates track points along great circles (for spheres) or geodesics (for ellipsoids).

    example

    mat = track1(___) returns the latitude and longitude coordinates of the track points in the matrix mat.

    Examples

    collapse all

    Find points along a great circle track from London to the point 600 nautical miles northwest of London. A northwest direction has an azimuth of 315 degrees. Convert 600 nautical miles to a spherical distance in degrees by using the nm2deg function.

    az = 315;
    arclen = nm2deg(600);
    [latgc,longc] = track1(51.5,0,az,arclen);

    Find points along a rhumb line track from London to the same point.

    [latrh,lonrh] = track1("rh",51.5,0,az,arclen);

    Compare the great circle and rhumb line tracks by displaying the track points on a map. Use a blue line for the great circle track and a red line for the rhumb line track.

    geoplot(latgc,longc,"b")
    hold on
    geoplot(latrh,lonrh,"r")
    geobasemap darkwater

    Figure contains an axes object with type geoaxes. The geoaxes object contains 2 objects of type line.

    Create a World Geodetic System of 1984 (WGS84) reference ellipsoid with a length unit of nautical miles.

    wgs84 = wgs84Ellipsoid("nm");

    Find points along a geodesic track from London to the point 600 nautical miles northwest of London. When you specify a reference ellipsoid as input to the track1 function, specify the arc length as a linear distance. A northwest direction has an azimuth of 315 degrees.

    arclen = 600;
    az = 315;
    [lattrk,lontrk] = track1(51.5,0,az,arclen,wgs84);

    Display the track points on a map.

    geoplot(lattrk,lontrk)
    geobasemap darkwater

    Figure contains an axes object with type geoaxes. The geoaxes object contains an object of type line.

    Input Arguments

    collapse all

    Latitude of the input point, specified as a scalar or column vector.

    The sizes of lat0 and lon0 must match.

    To find multiple tracks from a single starting point, specify lat0 and lon0 as scalars, az as a column vector, and arclen as a column vector or a two-column matrix.

    Data Types: single | double

    Longitude of the input point, specified as a scalar or column vector.

    The sizes of lat0 and lon0 must match.

    To find multiple tracks from a single starting point, specify lat0 and lon0 as scalars, az as a column vector, and arclen as a column vector or a two-column matrix.

    Data Types: single | double

    Azimuth measured clockwise from north, specified as a scalar or column vector.

    To find multiple tracks from a single starting point, specify lat0 and lon0 as scalars, az as a column vector, and arclen as a column vector or a two-column matrix.

    Data Types: single | double

    Length of the track, specified as a scalar, column vector, or two-column matrix.

    The units of arclength depend on whether you specify the ellipsoid argument.

    • When you do not specify a reference ellipsoid as input, specify arclen as a spherical distance in degrees. You can specify a spherical distance in radians by additionally using the units argument.

    • In most cases, when you specify a reference ellipsoid as input, specify arclen as a linear distance in the units of the semimajor axis of the ellipsoid.

    To find track points in a range, specify arclen as a two-column matrix. The track1 function calculates track points between the distance in the first column and the distance in the second column from the starting point.

    To find multiple tracks from a single starting point, specify lat0 and lon0 as scalars, az as a column vector, and arclen as a column vector or a two-column matrix.

    The default for arclen is [], which finds points for the full track.

    Data Types: single | double

    Angle unit, specified as one of these options:

    • "degrees" — Degrees

    • "radians" — Radians

    Data Types: char | string

    Reference ellipsoid, specified as a referenceSphere object, a referenceEllipsoid object, an oblateSpheroid object, or a two-element vector of the form [semimajor_axis eccentricity], where semimajor_axis is the length of the semimajor axis and eccentricity is the eccentricity. The values semimajor_axis and eccentricity must be of data type double.

    The default value of [1 0] represents the unit sphere.

    In most cases, when you specify the ellipsoid argument, the track1 function assumes that arclen is a linear distance in the units of the semimajor axis of the reference ellipsoid. The exceptions are when ellipsoid is [] or when the semimajor axis is 0, in which case the track1 function assumes arclen is a spherical distance.

    Track method, specified as one of these options:

    • "gc"az is a great circle azimuth (for spheres) or a geodesic azimuth (for ellipsoids).

    • "rh"az is a rhumb line azimuth.

    For more information about rhumb lines and great circles, see Comparison of Rhumb Lines and Great Circles.

    Data Types: char | string

    Number of track points to include in lattrk and lontrk, specified as a scalar.

    Data Types: double

    Output Arguments

    collapse all

    Latitude coordinates of the track points, returned as a column vector with npts elements or a matrix of size npts-by-length(lat0). The function returns lattrk as a column vector if lat0 and lon0 are scalars, and as a matrix if lat0 and lon0 are column vectors.

    Longitude coordinates of the track points, returned as a column vector with npts elements or a matrix of size npts-by-length(lon0). The function returns lontrk as a column vector if lat0 and lon0 are scalars, and as a matrix if lat0 and lon0 are column vectors.

    Latitude and longitude coordinates of the track points, returned as a matrix equivalent to [lattrk lontrk].

    Version History

    Introduced before R2006a