Interpolate longitude at given latitude


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


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.

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


Compare the results of the various methods:

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

newlon =

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

newlon =

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

newlon =

More About

expand all


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?