| Mapping Toolbox | ![]() |
Compute mean for geographic data
Syntax
[latmean,lonmean] = meanm(lat,lon) returns row vectors of the geographic mean positions of the columns of the input latitude and longitude points.
[latmean,lonmean] = meanm(lat,lon,units) indicates the angular units of the data. When the standard angle string units is omitted, 'degrees' is assumed.
[latmean,lonmean] = meanm(lat,lon,ellipsoid) specifies the elliptical definition of the Earth to be used with the two-element ellipsoid vector. The default ellipsoid model is a spherical Earth, which is sufficient for most applications.
If a single output argument is used, then geomeans = [latmean,longmean]. This is particularly useful if the original lat and lon inputs are column vectors.
Background
Finding the mean position of geographic points is more complicated than simply averaging the latitudes and longitudes. meanm determines mean position through three-dimensional vector addition. See "Geographic Statistics" in the "Mapping Applications" chapter of the Mapping Toolbox User's Guide documentation.
Examples
Create random latitude and longitude matrices:
lat = rand(3) lat = 0.9501 0.4860 0.4565 0.2311 0.8913 0.0185 0.6068 0.7621 0.8214 lon = rand(3) lon = 0.4447 0.9218 0.4057 0.6154 0.7382 0.9355 0.7919 0.1763 0.9169 [latmean,lonmean] = meanm(lat,lon,'radians') latmean = 0.6004 0.7395 0.4448 lonmean = 0.6347 0.6324 0.7478
See Also
filterm |
Geographic filter for data sets |
hista |
Spatial equal area histogram |
histr |
Spatial equirectangular histogram |
stdist |
Standard distances for geographic data |
stdm |
Standard deviation for geographic data |
| mdistort | meshgrat | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |