intrplat

Interpolate latitude at given longitude

Syntax

newlat = intrplat(long,lat,newlong)
newlat = intrplat(long,lat,newlong,method)
newlat = intrplat(long,lat,newlong,method,units)

Description

newlat = intrplat(long,lat,newlong)returns an interpolated latitude,newlat, corresponding to a longitudenewlong.longmust be a monotonic vector of longitude values. The actual entries must be monotonic; that is, the longitude vector[350 357 3 10]is not allowed even though the geographicdirectionis unchanged (use[350 357 363 370]instead).latis a vector of the latitude values paired with each entry inlong.

newlat = intrplat(long,lat,newlong,method)specifies themethodof interpolation employed, listed in the table below.

Method Description
'linear' Linear, or Cartesian, interpolation (default)
'pchip' Piecewise cubic Hermite interpolation
'rh' Returns interpolated points that lie on rhumb lines between input data
'gc' Returns interpolated points that lie on great circles between input data

newlat = intrplat(long,lat,newlong,method,units)specifies the units used, whereunitsis any valid angle units string scalar or character vector. The default is'degrees'.

The functionintrplat是一个地理数据类比标准MATLA吗B®functioninterp1.

Examples

Compare the results of the various methods:

lats = [25 45]; longs = [30 60]; newlat = intrplat(longs,lats,45,'linear') newlat = 35 newlat = intrplat(longs,lats,45,'rh') newlat = 35.6213 newlat = intrplat(longs,lats,45,'gc') newlat = 37.1991

Tips

There are separate functions for interpolating latitudes and longitudes, for although the cases are identical when using those methods supported byinterp1, when latitudes and longitudes are treated like the spherical angles they are (using'rh'or'gc'), the results are different. Compare the example above to the example underintrplon, which reverses the values of latitude and longitude.

See Also

|

Introduced before R2006a