What Is Interpolation?
Continuous functions are interpolated on the basis of discrete data so that this continuous curve passes through all given discrete data points. [1]
- As early as the 6th century, Liu Ye of China has used equidistant quadratic interpolation for astronomical calculations.
- After the 17th century, I. Newton and J.-L. Lagrange discussed the general interpolation formulas of equidistant and non-equidistant respectively. In modern times,
- Given n discrete data points (called nodes )
- The formulation of the interpolation problem is:
- Use interpolation function in matlab
- The function of interpolation
- interp1
- Format of the calling function ( Syntax )
- yi = interp1 (x, Y, xi)
- yi = interp1 (Y, xi)
- yi = interp1 (x, Y, xi, method)
- yi = interp1 (x, Y, xi, method, 'extrap')
- yi = interp1 (x, Y, xi, method, extrapval)
- pp = interp1 (x, Y, method, 'pp')
- Call Format Description ( Description )
- yi = interp1 (x, Y, xi) returns the values of y determined by the vectors X and Y according to the input node xi. Vector Y is a function mapping of vector X.
- If Y is a matrix, then the interpolation result is a corresponding matrix.
- [==================================================== ==
- yi = interp1 (x, Y, xi) returns vector yi containing elements corresponding to the elements of xi and determined by interpolation within vectors x and Y. The vector x specifies the points at which the data Y is given. If Y is a matrix , then the interpolation is performed for each column of Y and yi is length (xi) -by-size (Y, 2).
- ======================================================== =]
- yi = interp1 (x, Y, xi, method) interpolation methods:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- [==================================================== ===
- yi = interp1 (x, Y, xi, method) interpolates using alternative methods:
- methodDescription
- nearestNearest neighbor interpolation
- linearLinear interpolation (default)
- splinesplineCubic spline interpolation
- pchipPiecewise cubic Hermite interpolation
- cubic (Same as 'pchip')
- v5cubicCubic interpolation used in MATLAB 5
- ======================================================== ====]
- Simple program example
- >> x = [0.0 0.1 0.195 0.3 0.401 0.5];
- >> y = [0.39849 0.39695 0.39142 0.38138 0.36812 0.35206];
- >> plot (x, y);
- >> T = interp1 (x, y, .25, 'linear')% linear interpolation
- (Return result T = 0.3862)
- >> T = interp1 (x, y, .25, 'nearest')% two-point interpolation
- (Return result T = 0.3814)
- >> T = interp1 (x, y, .25, 'spline')% cubic spline interpolation
- (Return result T = 0.3867)
- >> T = interp1 (x, y, .25, 'cubic')% cubic interpolation
- (Return result T = 0.3867)