3.5.1.1.24 Interp


Description

Minimum Origin Version Required: 2015 SR0

This function is used to perform 1D interpolation or extrapolation on a group of XY data to find Y at the given X value using 4 alternative methods.

Syntax

double Interp( double x, vector vx, vector vy [, int method=0,
 int bound=1, double smooth=0, int extrap=0])

Parameters

x

The x coordinate for finding interpolated/extrapolated y coordinate.

vx

The source x coordinates used for interpolation.

vy

The source y coordinates used for interpolation.

method

Interpolation methods, supported value 0 (linear, default), 1 (cubic spline), 2 (cubic B-spline), 3 (Akima spline).

bound

Boundary condition only available in cubic spline method, supported value 0 (Natural), 1 (Not-A-Knot, default).

smooth

A non-negative parameter that specifies the smoothness of the interpolated curve in Cubic B-Spline interpolation.

extrap

Controls how to extrapolate Y values when X values are outside the reference X range, supported value 0 (default value, extrapolate Y using the last two points), 1 (set all Y values in the extrapolated range to be missing values), 2 (use the Y value of the closest input X value for all values in the extrapolated range).

Return

Return the interpolated/extrapolated value y coordinate at specified x coordinate.

Example

newbook;
worksheet -a 2;
col(a)={0:0.5:10};
col(b)=sqrt(10*col(a)-col(a)^2);
col(c)={0:0.2:5};
col(d)=Interp(col(c),col(a),col(b),1,0,1);

See Also

Integrate, IntegrateXY