Skip to main content

Interpolate2

Interpolate2 [flags ] [ xWave , ] yWave​

The Interpolate2 operation performs linear, cubic spline and smoothing cubic spline interpolation on 1D waveform or XY data. It produces output in the form of a waveform or an XY pair.

The cubic spline interpolation is based on a routine from "Numerical Recipes in C".

The smoothing spline is based on "Smoothing by Spline Functions", Christian H. Reinsch, Numerische Mathematic 10, 177-183 (1967).

For background information, see The Interpolate2 Operation.

Parameters​

xWave specifies the wave which supplies the X coordinates for the input curve. If you omit it, X coordinates are taken from the X values of yWave.

yWave specifies the wave which supplies the Y coordinates for the input curve.

Flags​

/A = aControls pre-averaging. Pre-averaging is deprecated - use the smoothing spline (/T=3) instead.
If a is zero, Interpolate2 does no pre-averaging. If a is greater than one, it specifies the number of nodes through which you want the output curve to go. Interpolate2 creates the nodes by averaging the raw input data.
Pre-averaging does not work correctly with the log-spaced output mode (/I=2). This is because the pre-averaging is done on linearly-spaced intervals but the input data is log-spaced.
/E = eControls how the end points are determined for cubic spline interpolation only.
e =1:Match first derivative (default)
e =2:Match second derivative (natural)
/F = ff is the smoothing factor used for the smoothing spline.
f =0 is nearly identical to the cubic spline.
f >0 gives increasing amounts of smoothing as f increases.
See Smoothing Spline Parameters for details.
/FREECreates output waves as free waves (see Free Waves).
/FREE is allowed only in functions. If you use /FREE then the output waves specified by /X and /Y must be either simple names or valid wave references.
/FREE was added in Igor Pro 9.00.
/I[ = i]Determines at what X coordinates the interpolation is done.
i =0:Gives output values at evenly-spaced X coordinates that span the X range of the input data. This is the default setting if /I is omitted.
i =1:Same as i=0 except that the X input values are included in the list of X coordinates at which to interpolate. This is rarely needed and is not available if no X destination wave is specified. /I is equivalent to /I=1. Both are not recommended.
i =2:Gives output values at X coordinates evenly-spaced on a logarithmic scale. Use this if your data is plotted on a logarithmic X axis. Ignores any non-positive values in your input X data.
This mode is not recommended. See Interpolating Exponential Data for an alternative.
i =3:Gives output values at X coordinates that you specify by setting the X coordinates of the destination wave before calling Interpolate2. You must create your destination wave or waves before doing the interpolation for this mode.
If you omit /X=xDest then the X coordinates come from the X values of the output waveform designated by /Y=yDest .
If you include /X=xDest then the X coordinates come from the data values of the specified X output wave.
When using /I=3, the number of output points is determined by the destination wave and the /N flag is ignored.
See Destination X Coordinates from Destination Wave for further details.
/J = jControls the use of end nodes with pre-averaging (/A). Pre-averaging is deprecated - use the smoothing spline (/T=3) instead.
j =0:Turns end nodes off.
j =1:Creates end nodes by cubic extrapolation.
j =2:Creates end nodes equal to the first and last data points of the input data set, not counting points that contain NaNs or INFs.
/N = nControls the number of points in the output wave or waves. n defaults to the larger of 200 and the number of points in the source waves. This value is ignored if you /I=3 (X from dest mode).
/S = ss is the estimated standard deviation of the noise of the Y data. It is used for the smoothing spline only. s is used as the estimated standard deviation for all points in the Y data.
If neither /S nor /SWAV are present, Interpolate2 arbitrarily assumes an s equal to .05 times the amplitude of the Y data.
/SWAV = stdDevWavestdDevWave is a wave containing the standard deviation of the noise of the Y data on a point-by-point basis. It is used for the smoothing spline only. stdDevWave must have the same number of points as the Y data wave.
If neither /S nor /SWAV are present, Interpolate2 arbitrarily assumes an s equal to .05 times the amplitude of the Y data.
/T = tControls the type of interpolation performed.
t =1:Linear interpolation
t =2:Cubic spline interpolation (default)
t =3:Smoothing spline interpolation
/X = xDestSpecifies the X destination wave name.
If /X is present the output is an XY pair.
If /X is omitted the output is a waveform.
The X destination wave may or may not exist when Interpolate2 is called except for "X from dest" mode (/I=3) when it must exist. Interpolate2 overwrites it if it exists.
/Y = yDestSpecifies the Y destination wave name.
If you omit /Y, a default wave name is generated. The name of the default wave is the name of the source Y wave plus "_L" for linear interpolation, "_CS" for cubic spline or "_SS" for smoothing spline.
The Y destination wave may or may not exist when Interpolate2 is called. Interpolate2 overwrites it if it exists.

See Also​

The Interpolate2 Operation

Demos​

Open Interpolate2 Log Demo

References​

"Numerical Recipes in C " for cubic spline.

"Smoothing by Spline Functions", Christian H. Reinsch, Numerische Mathematic 10, 177-183 (1967).