Mathematics    

One-Dimensional Interpolation

There are two kinds of one-dimensional interpolation in MATLAB:

Polynomial Interpolation

The function interp1 performs one-dimensional interpolation, an important operation for data analysis and curve fitting. This function uses polynomial techniques, fitting the supplied data with polynomial functions between data points and evaluating the appropriate function at the desired interpolation points. Its most general form is

y is a vector containing the values of a function, and x is a vector of the same length containing the points for which the values in y are given. xi is a vector containing the points at which to interpolate. method is an optional string specifying an interpolation method:

If any element of xi is outside the interval spanned by x, the specified interpolation method is used for extrapolation. Alternatively, yi = interp1(x,Y,xi,method,extrapval) replaces extrapolated values with extrapval. NaN is often used for extrapval.

All methods work with nonuniformly spaced data.

Speed, Memory, and Smoothness Considerations

When choosing an interpolation method, keep in mind that some require more memory or longer computation time than others. However, you may need to trade off these resources to achieve the desired smoothness in the result.

The relative performance of each method holds true even for interpolation of two-dimensional or multidimensional data. For a graphical comparison of interpolation methods, see the section Comparing Interpolation Methods.

FFT-Based Interpolation

The function interpft performs one-dimensional interpolation using an FFT-based method. This method calculates the Fourier transform of a vector that contains the values of a periodic function. It then calculates the inverse Fourier transform using more points. Its form is

x is a vector containing the values of a periodic function, sampled at equally spaced points. n is the number of equally spaced points to return.


  Interpolation Function Summary Two-Dimensional Interpolation