Main Content

geointerp

Interpolation for geographic raster

Description

Vq = geointerp(V,R,latq,lonq) interpolates the geographic raster V, which uses the raster reference R, at the specified query points. The query points have latitude latq and longitude lonq.

example

Vq = geointerp(___,method) specifies the interpolation method. By default, the function uses bilinear interpolation.

Examples

collapse all

Read global elevation data into the workspace as an array and a geographic cells reference object.

load topo60c

Specify the latitude and longitude values to interpolate. Then, interpolate the values.

latq = [-40 -20 20 40];
lonq = [42 54 38 62];
Vq = geointerp(topo60c,topo60cR,latq,lonq)
Vq = 1×4
103 ×

   -2.8327   -4.3855   -0.7125    0.1700

Input Arguments

collapse all

Geographic raster, specified as an M-by-N numeric or logical matrix.

Raster reference for V, specified as a GeographicCellsReference object or GeographicPostingsReference object.

Latitudes of the query points, specified as a numeric array. The sizes of latq and lonq must match.

Data Types: single | double

Longitudes of the query points, specified as a numeric array. The sizes of latq and lonq must match.

Data Types: single | double

Interpolation method, specified as one of these options:

  • "linear" — Linear interpolation. The interpolated value at a query point is based on linear interpolation of the values at neighboring points. This method is sometimes called bilinear interpolation.

  • "nearest" — Nearest-neighbor interpolation. The interpolated value at a query point is the value of the nearest point.

  • "cubic" — Cubic interpolation. The interpolated value at a query point is based on cubic interpolation of the values at neighboring points. The interpolation is based on a cubic convolution. This method is sometimes called bicubic interpolation.

  • "spline" — Cubic spline interpolation. The interpolated value at a query point is based on a cubic interpolation of the values at neighboring points. The interpolation is based on a cubic spline using not-a-knot end conditions.

Data Types: char | string

Output Arguments

collapse all

Interpolated values, returned as a numeric array. The number of interpolated values matches the number of query points.

Tips

Interpolate a raster in planar map coordinates by using the mapinterp function.

Version History

Introduced in R2017a