Mapping Toolbox | ![]() ![]() |
Interpolate longitude for a given latitude
Syntax
newlon = intrplon(lat,lon,newlat) newlon = intrplon(lat,lon,newlat,method) newlon = intrplon(lat,lon,newlat,method,units)
Description
The command intrplon
is a geographic data analogy of the MATLAB command interp1
.
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. The default value of the method
string is 'linear'
, which results in linear, or cartesian, interpolation between the numerical values entered. This is really just a pass-through to the MATLAB interp1
command. Similarly, 'spline'
and 'cubic'
perform cubic spline and cubic interpolation, respectively. The 'rh'
method returns interpolated points that lie on rhumb lines between input data. Similarly, the 'gc'
method 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'
.
Examples
Compare the results of the various methods:
lon = [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
Remarks
There are separate commands 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
interpm |
Linear interpolation of latitude and longitude |
intrplat |
Interpolated longitudes for given longitude |
![]() | intrplat | ismap | ![]() |