Documentation

intrplon

Interpolate longitude at given latitude

Syntax

newlon = intrplon(lat,lon,newlat)
newlon = intrplon(lat,lon,newlat,method)
newlon = intrplon(lat,lon,newlat,method,units)

Description

newlon = intrplon(lat,lon,newlat) returns an interpolated longitude, newlon, corresponding to a latitude newlat. lat must be a monotonic vector of longitude values. lon is a vector of the longitude values paired with each entry in lat.

newlon = intrplon(lat,lon,newlat,method) specifies the method of interpolation employed, listed in the table below.

MethodDescription
'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

newlon = intrplon(lat,lon,newlat,method,units) specifies the units used, where units is any valid angle units string. The default is 'degrees'.

The function intrplon is a geographic data analogy of the MATLAB® function interp1.

Examples

Compare the results of the various methods:

long = [25 45]; lat = [30 60];
newlon = intrplon(lat,long,45,'linear')

newlon =
    35

newlon = intrplon(lat,long,45,'rh')

newlon =
   33.6515

newlon = intrplon(lat,long,45,'gc')

newlon =
   32.0526

More About

expand all

Tips

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

See Also

|

Was this topic helpful?