Interpolate Coordinates at Specific Locations

This example shows how to interpolate coordinates at specific locations using intrplat and intrplon functions. intrplat and intrplon return one value at a time and give you control over the interpolation method used. For more information, see the intrplat and intrplon reference pages.

Define latitudes and longitudes.

lat = [57 68 60 65 56];
lon = [1 3 4 9 13];

Specify the longitude for which you want to compute a latitude.

newlon = 7.3;

Linear Interpolation

Generate a new latitude with linear interpolation.

newlat = intrplat(lon,lat,newlon,'linear')
newlat = 63.3000

Great Circle Interpolation

Generate a new latitude using great circle interpolation.

newlat = intrplat(lon,lat,newlon,'gc')
newlat = 63.5029

Rhumb Line Interpolation

Generate a new latitude using interpolation along a rhumb line.

newlat = intrplat(lon,lat,newlon,'rh')
newlat = 63.3937

To see an illustration comparing these three interpolations, see Geographic Interpolation of Vectors.