ListInterpolation

ListInterpolation[array]

constructs an InterpolatingFunction object that represents an approximate function that interpolates the array of values given.

ListInterpolation[array,{{xmin,xmax},{ymin,ymax},}]

specifies the domain of the grid from which the values in array are assumed to come.

Details and Options

  • You can replace {xmin,xmax} etc. by explicit lists of positions for grid lines. The grid lines are otherwise assumed to be equally spaced.
  • ListInterpolation[array] assumes grid lines at integer positions in each direction.
  • array can be an array in any number of dimensions, corresponding to a list with any number of levels of nesting.
  • ListInterpolation[array,domain] generates an InterpolatingFunction object that returns values with the same precision as those in {array,domain}.
  • ListInterpolation supports a Method option. Possible settings include "Spline" for spline interpolation and "Hermite" for Hermite interpolation.

Examples

open allclose all

Basic Examples  (3)

Construct an approximate function that interpolates the data:

Apply the function to find interpolated values:

Plot the interpolation function:

Compare with the original data:

Construct an approximate function with the x values equally spaced on the interval :

Apply the function to find interpolated values:

Plot the interpolation function with the original data:

Construct an approximate function that interpolates the values from an array of values:

Plot the function with the original data:

Scope  (4)

Interpolate between points at arbitrary x values:

The x values may be included in the data directly:

Create data with Table:

Form the interpolation:

Plot the interpolated function:

Create a list of multidimensional data:

Create an approximate interpolating function:

Plot the interpolating function:

Generalizations & Extensions  (3)

Create data including derivative values:

Construct an interpolation:

Plot the interpolation:

Create 2D data that includes a gradient vector at each point:

Compare with data that does not include gradients:

Also include tensors of second derivatives:

Options  (7)

InterpolationOrder  (4)

Make a 0^(th)-order interpolation:

Make a linear interpolation:

Make a quadratic interpolation:

Make an interpolation linear in the first dimension and quadratic in the second:

Method  (1)

Compare splines with piecewise Hermite interpolation for random data:

The curves appear close, but the spline has a continuous derivative:

PeriodicInterpolation  (2)

Make an interpolating function that repeats periodically:

Make an interpolating function that repeats periodically in the second dimension only:

Properties & Relations  (2)

The interpolating function always goes through the data points:

Find the integral of an interpolating function:

Plot the interpolating function and its integral:

Find a root of the integral:

Possible Issues  (4)

Beyond the domain defined by the original data extrapolation is used:

A plot shows the inaccuracy of extrapolation:

With the default choice of order, at least 4 points are needed in each dimension:

With a lower order, fewer points are needed:

The interpolation function will always be continuous, but may not be differentiable:

If derivatives are specified, the interpolation function will have a continuous ^(th) derivative:

Introduced in 1996
 (3.0)
 |
Updated in 2008
 (7.0)