Main Content

stdist

Standard distance of geographic points

    Description

    example

    dist = stdist(lat,lon) computes the standard distance of the geographic points specified by lat and lon. This syntax references the points to a unit sphere, assumes the points are specified in degrees, and returns the standard distance in degrees.

    Standard distance measures the dispersion of great-circle distances from each point to the geographic mean (centroid) of the points. For more information about the geographic mean, see meanm.

    Several scattered points. An arrow connects the geographic mean of the points to the edge of a circle whose radius represents the standard distance of the points.

    dist = stdist(lat,lon,units) specifies the angle units units for the points and standard distance.

    example

    dist = stdist(lat,lon,ellipsoid) specifies the reference ellipsoid for the geographic points. This syntax returns the standard distance as a linear distance in the same units as the semimajor axis of the reference ellipsoid.

    dist = stdist(lat,lon,ellipsoid,units) specifies the reference ellipsoid and units for the geographic points. This syntax returns the standard distance as a linear distance in the same units as the semimajor axis of the reference ellipsoid.

    example

    dist = stdist(lat,lon,ellipsoid,units,method) specifies the calculation method. By default, the function calculates the average great-circle distance of the points from the geographic mean of the points.

    Examples

    collapse all

    Specify the latitude and longitude coordinates of Paris, London, Rome, Madrid, Berlin, and Athens.

    lat = [48.87 51.52 41.93 40.43 52.43 38.02];
    lon = [2.41 -0.13 12.5 -3.68 13.08 23.52];

    Find the standard distance of the points.

    dist = stdist(lat,lon)
    dist = 8.1833
    

    Compare the stdist function to the sdtm function, which independently calculates the standard deviations for the latitudes and longitudes.

    [latdev,londev] = stdm(lat,lon) 
    latdev = 6.1805
    
    londev = 7.5871
    

    Specify the latitude and longitude coordinates of Paris, London, Rome, Madrid, Berlin, and Athens.

    lat = [48.87 51.52 41.93 40.43 52.43 38.02];
    lon = [2.41 -0.13 12.5 -3.68 13.08 23.52];

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

    wgs84 = wgs84Ellipsoid("km");

    Find the standard distance of the points referenced to the ellipsoid. When you specify a reference ellipsoid as input, the stdist function returns the standard distance in the same length unit as the ellipsoid.

    dist = stdist(lat,lon,wgs84)
    dist = 911.0339
    

    Specify the latitude and longitude coordinates of Paris, London, Rome, Madrid, Berlin, and Athens.

    lat = [48.87 51.52 41.93 40.43 52.43 38.02];
    lon = [2.41 -0.13 12.5 -3.68 13.08 23.52];

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

    wgs84 = wgs84Ellipsoid("km");

    Find the standard distance of the points using a quadratic calculation method.

    distQ = stdist(lat,lon,wgs84,"degrees","quadratic")
    distQ = 976.4035
    

    Find the standard distance of the point using a cubic calculation method.

    distC = stdist(lat,lon,wgs84,"degrees","cubic")
    distC = 1.0398e+03
    

    Input Arguments

    collapse all

    Latitude coordinates, specified as a vector or a matrix.

    Data Types: double

    Longitude coordinates, specified as a vector or a matrix.

    Data Types: double

    Angle unit, specified as one of these options:

    • "degrees" — Degrees

    • "radians" — Radians

    If you do not specify a reference ellipsoid, this argument determines the angle units for the input points and the output standard distance. If you specify a reference ellipsoid, this argument only determines the angle units for the input points.

    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.

    Calculation method, specified as one of these options:

    • "linear"dist is the average of the great-circle distances from each geographic point to the geographic mean of the points.

    • "quadratic"dist is the square root of the average of the squared great-circle distances.

    • "cubic"dist is the cube root of the average of the cubed great-circle distances.

    Data Types: char | string

    Output Arguments

    collapse all

    Standard distance of the geographic points, returned as a scalar or a row vector.

    • When lat and lon are vectors, dist is a scalar.

    • When lat and lon are matrices, dist is a row vector. Each element of the vector is the standard distance for the corresponding column of lat and lon.

    Data Types: double

    Version History

    Introduced in R2006a