# stdm

Standard deviation of geographic points

## Syntax

``[latdev,londev] = stdm(lat,lon)``
``[latdev,londev] = stdm(lat,lon,units)``
``[latdev,londev] = stdm(lat,lon,ellipsoid)``
``[latdev,londev] = stdm(lat,lon,ellipsoid,units)``
``mat = stdm(___)``

## Description

example

````[latdev,londev] = stdm(lat,lon)` calculates the standard deviations `latdev` and `londev` 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 deviations in degrees.```
````[latdev,londev] = stdm(lat,lon,units)` specifies the angle units `units` for the points and standard deviations.```

example

````[latdev,londev] = stdm(lat,lon,ellipsoid)` specifies the reference ellipsoid for the geographic points. This syntax returns the standard deviations as linear distances in the same units as the semimajor axis of the reference ellipsoid.```
````[latdev,londev] = stdm(lat,lon,ellipsoid,units)` specifies the reference ellipsoid and units for the geographic points. This syntax returns the standard deviations as linear distances in the same units as the semimajor axis of the reference ellipsoid.```
````mat = stdm(___)` returns the standard deviations of the geographic points in the matrix `mat`, using any combination of input arguments from the previous syntaxes.```

## 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 deviations of the latitude and longitude coordinates.

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

Compare the `stdm` function to the `stdist` function, which calculates the standard distance of the points.

`dist = stdist(lat,lon)`
```dist = 8.1833 ```

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 deviations of the points referenced to the ellipsoid. When you specify a reference ellipsoid as input, the `stdm` function returns the standard deviations in the same length unit as the ellipsoid.

`[latdev,londev] = stdm(lat,lon,wgs84)`
```latdev = 688.0321 ```
```londev = 845.8243 ```

## Input Arguments

collapse all

Latitude coordinates, specified as a vector or a matrix. The sizes of `lat` and `lon` must match.

Data Types: `single` | `double`

Longitude coordinates, specified as a vector or a matrix. The sizes of `lon` and `lat` must match.

Data Types: `single` | `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 deviations. 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.

## Output Arguments

collapse all

Standard deviation of the latitude coordinates, returned as a scalar or a row vector. The size of `latdev` depends on the sizes of `lat` and `lon`.

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

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

The function calculates the standard deviation of the latitude coordinates using angular measurements.

Standard deviation of the longitude coordinates, returned as a scalar or a row vector. The size of `londev` depends on the sizes of `lat` and `lon`.

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

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

The function calculates the standard deviation of the longitude coordinates using departure distances. For more information about departure, see `departure`.

Standard deviation of the latitude and longitude coordinates, returned as a matrix equivalent to `[latdev londev]`.

## Algorithms

• The function calculates the mean position of the latitude and longitude coordinates using the `meanm` function.

• The function normalizes the standard deviations by n–1, where n is the number of geographic points.

## Version History

Introduced before R2006a