Here is a table of the types/constructors available for one-dimensional interpolation.
Interpolators | Method |
---|---|
LinearInterpolator | piecewise linear |
CubicInterpolator | piecewise cubic (no smoothness guarantee) |
CubicSplineInterpolator | cubic spline, natural or clamped |
ChebyshevInterpolator | Chebyshev expansion |
For the derivative of a ChebyshevInterpolator, use chebyderiv
.
Here is a table of the functions available for one-dimensional interpolation.
Functions | Use |
---|---|
quadratic | quadratic interpolation of any 3 points |
cubic | cubic interpolation of any 4 points |
neville | $(n-1)$th order polynomial interpolation of any $n$ points |
vandermonde | coefficients of $(n-1)$th order polynomial passing through $n$ points |
cubichermite | cubic interpolation using two points with first derivatives |
BasicInterpolators.LinearInterpolator
— TypeLinearInterpolator(x, y, boundaries=StrictBoundaries())
Construct a LinearInterpolator
for the points defined by coordinates x
and values y
LinearInterpolator(f, xa, xb, n, boundaries=StrictBoundaries())
Construct a LinearInterpolator
for the function f
using n
evenly spaced function evaluations in the range [xa
,xb
]
BasicInterpolators.CubicInterpolator
— TypeCubicInterpolator(x, y, boundaries=StrictBoundaries())
Construct a CubicInterpolator
for the points defined by coordinates x
and values y
CubicInterpolator(f, xa, xb, n, boundaries=StrictBoundaries())
Construct a CubicInterpolator
for the function f
using n
evenly spaced function evaluations in the range [xa
,xb
]
BasicInterpolators.CubicSplineInterpolator
— TypeCubicSplineInterpolator(x, y, boundaries=StrictBoundaries())
Construct a CubicSplineInterpolator
for the points defined by coordinates x
and values y
. This constructor creates a natural spline, where the second derivative is set to zero at the boundaries.
CubicSplineInterpolator(x, y, dy₁, dyₙ, boundaries=StrictBoundaries())
Construct a CubicSplineInterpolator
for the points defined by coordinates x
and values y
. This constructor creates a clamped spline, where the first derivatives at the boundaries are set by dy₁
and dyₙ
.
CubicSplineInterpolator(f, xa, xb, n, boundaries=StrictBoundaries())
Construct a CubicSplineInterpolator
for the function f
using n
evenly spaced function evaluations in the range [xa
,xb
]. A natural spline is created.
BasicInterpolators.ChebyshevInterpolator
— TypeChebyshevInterpolator(x, y)
Construct a ChebyshevInterpolator
for the points defined by coordinates x
and values y
. The x
coordinates must be arranged on a chebyshev grid, which can be generated using the chebygrid
function.
ChebyshevInterpolator(f, xa, xb, n)
Construct a ChebyshevInterpolator
for the function f
using n
function evaluations in the range [xa
,xb
]. The function evaluations will occur on the chebyshev nodes.
BasicInterpolators.quadratic
— Functionquadratic(x, xₚ, yₚ)
Perform quadratic polynomial interpolation of the points defined by coordinates xₚ
and values yₚ
, at the coordinate x
, using Neville's algorithm. xₚ
and yₚ
must both contain three points.
BasicInterpolators.cubic
— Functioncubic(x, xₚ, yₚ)
Perform cubic polynomial interpolation of the points defined by coordinates xₚ
and values yₚ
, at the coordinate x
, using Neville's algorithm. xₚ
and yₚ
must both contain four points.
BasicInterpolators.neville
— Functionneville(x, xₚ, yₚ)
Perform polynomial interpolation of the points defined by coordinates xₚ
and values yₚ
, at the coordinate x
, using Neville's algorithm with as many points as are provided. xₚ
and yₚ
must have the same length. With only 3 or 4 points the quadratic
and cubic
functions will be considerably faster.
BasicInterpolators.vandermonde
— Functionvandermonde(x, y)
Generate the coefficients of an arbitrary order polynomial passing through the ponts defined by coordinates x
and value y
. For n points, n coefficients $[c_0, c_1, ..., c_{n-1}]$ are returned forming the polynomial $c_0 + c_1x + ... + c_{n-1}x^{n-1}$
Solving for the the coefficients of a high-order polynomial is a notoriously ill-conditioned problem. It is not recommended for orders greater than 5 or 6, although it depends on the application. If you must interpolate with a high-order polynomial, it's better to use the neville
function instead of computing coefficients.
BasicInterpolators.cubichermite
— Functioncubichermite(x, x₁, x₂, y₁, y₂, y₁′, y₂′)
Interpolate a cubic polynomial between two points, given its values and first derivatives at the points.