Mapping Toolbox | ![]() ![]() |
Interpolate latitude for a given longitude
Syntax
newlat = intrplat(long,lat,newlong) newlat = intrplat(long,lat,newlong,method
) newlat = intrplat(long,lat,newlong,method
,units
)
Description
The command intrplat
is a geographic data analogy of the standard MATLAB command interp1
.
newlat = intrplat(long,lat,newlong) returns an interpolated latitude, newlat
, corresponding to a longitude newlong
. long
must be a monotonic vector of longitude values. The actual entries must be monotonic, i.e., the longitude vector [350 357 3 10]
is not allowed even though the geographic direction is unchanged (use [350 357 363 370]
instead). lat
is a vector of the latitude values paired with each entry in long
.
newlat = intrplat(long,lat,newlong,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.
newlat = intrplat(long,lat,newlong,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:
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
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 above example to the example in under intrplon
, which reverses the values of latitude and longitude.
See Also
interpm |
Linear interpolation of latitude and longitude |
intrplon |
Interpolated longitudes for given latitudes |
![]() | interpm | intrplon | ![]() |