Next: , Previous: Interpolation Functions, Up: Interpolation


26.3 Interpolation Types

The interpolation library provides five interpolation types:

— Interpolation Type: gsl_interp_linear

Linear interpolation. This interpolation method does not require any additional memory.

— Interpolation Type: gsl_interp_polynomial

Polynomial interpolation. This method should only be used for interpolating small numbers of points because polynomial interpolation introduces large oscillations, even for well-behaved datasets. The number of terms in the interpolating polynomial is equal to the number of points.

— Interpolation Type: gsl_interp_cspline

Cubic spline with natural boundary conditions. The resulting curve is piecewise cubic on each interval, with matching first and second derivatives at the supplied data-points. The second derivative is chosen to be zero at the first point and last point.

— Interpolation Type: gsl_interp_cspline_periodic

Cubic spline with periodic boundary conditions. The resulting curve is piecewise cubic on each interval, with matching first and second derivatives at the supplied data-points. The derivatives at the first and last points are also matched. Note that the last point in the data must have the same y-value as the first point, otherwise the resulting periodic interpolation will have a discontinuity at the boundary.

— Interpolation Type: gsl_interp_akima

Non-rounded Akima spline with natural boundary conditions. This method uses the non-rounded corner algorithm of Wodicka.

— Interpolation Type: gsl_interp_akima_periodic

Non-rounded Akima spline with periodic boundary conditions. This method uses the non-rounded corner algorithm of Wodicka.

The following related functions are available:

— Function: const char * gsl_interp_name (const gsl_interp * interp)

This function returns the name of the interpolation type used by interp. For example,

          printf ("interp uses '%s' interpolation.\n",
                  gsl_interp_name (interp));

would print something like,

          interp uses 'cspline' interpolation.
— Function: unsigned int gsl_interp_min_size (const gsl_interp * interp)

This function returns the minimum number of points required by the interpolation type of interp. For example, Akima spline interpolation requires a minimum of 5 points.