# 2.8.10 interp1

Analysis: Mathematics: Interpolate/Extrapolate Y from X

## Brief Information

Interpolate or extrapolate XY data at a given set of X values

## Command Line Usage

 

1. interp1 ix:=Col(3) iy:=(Col(1), Col(2)); 

2. interp1 ix:=Col(3) iy:=Col(2) ox:=Col(4); 

3. interp1 ix:=Col(3) iy:= Col(2) method:= bspline coef:=Col(4); 

4. interp1 ix:=Col(3) iy:=(Col(1), Col(2)) method:=spline; 

5. interp1 ix:=Col(3) iy:=Col(2) method:=spline ox:=<new> coef:=<new>; 

## Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
X Values to Interpolate ix

Input

vector

<unassigned>
The vector to interpolate on.
Input iy

Input

XYRange

<active>
The XY range to be interpolated.
Method method

Input

int

linear
Interpolation methods

Option list:

• linear:Linear{0}
method:=0, Linear interpolation is a fast method of estimating a data point by constructing a line between two neighboring data points. The resulting point may not be an accurate estimation of the missing data.
• spline:Cubic Spline{1}
method:=1, This method splits the input data into a given number of pieces, and fits each segment with a cubic polynomial. The second derivative of each cubic function is set equal to zero. With these boundary conditions met, an entire function can be constructed in a piece-wise manner.
• bspline:Cubic B-Spline{2}
method:=2, This method also splits the input data into pieces, each segment is fitted with discrete Bezier splines.
• akima:Akima Spline{3}
method:=3, This method is based on a piecewise function composed of a set of polynomials. The akima interpolation is stable to outliers.

You could refer to the algorithm of each interpolation methods.

Extrapolate Option option

Input

int

0
When parts of the data range specified by ix is outside that of the X range specified by iy, these range parts will be considered as the extrapolated range, because the resulted Y values for these parts will be computed from extrapolation. This option can then be used to specify how to extrapolate the corresponding Y values.

Option list:

• extrap:Extrapolate{0}
Extrapolate Y using the last two points
• miss:Set missing{1}
Set all Y values in the extrapolated range to be missing values.
• repeat:Repeat the last value{2}
Use the Y value of the closest input X value for all values in the extrapolated range.
Boundary boundary

Input

int

notaknot
Boundary condition only available in cubic spline method

Option list:

• natural:Natural{0}
2nd derivatives are 0 on both end
• notaknot:Not-A-Knot{1}
3rd derivatives are continuous on the second and last-second point
Smoothing Factor sf

Input

double

0
A non-negative parameter that specifies the smoothness of the interpolated curve in Cubic B-Spline interpolation. The factor helps user control the balance between the smoothness and fidelity to actual data. Larger values produce smoother curves.
Result of interpolation ox

Output

vector

<new>
The output vector interpolated on ix.
Coefficients coef

Output

vector

<optional>
Spline coefficients when using spline or B-spline method.

## Examples

1. Import Interpolation.dat on \Samples\Mathematics folder.

2. Highlight column B and click Analysis: Mathematics: Interpolate/Extrapolate Y from X on the menu to bring up the dialog.

3. Now the Input branch have filled with proper data range, click the drop-down list beside X Values to Interpolate edit box, and select Col(C).

4. Select Cubic B-spline interpolate method.

5. Click OK to do interpolation.