Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

interpolate1d (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info
Download Help (Windows Only)

Owning Classes: approximation and resampling

Requires: MathScript RT Module


y2 = interpolate1d(y1, x2)

y2 = interpolate1d(x1, y1, x2)

y2 = interpolate1d(x1, y1, x2, method)

Legacy Name: interp1


Interpolates y-values based on sample data using a specified method.



Name Description
y1 Specifies the sample y-values. If y1 is a matrix, LabVIEW performs interpolation for each column in the matrix. If y1 is complex, LabVIEW performs interpolation for the real part and the imaginary part, respectively. y1 is a real or complex, double-precision vector or matrix.
x2 Specifies the x-values at which you want to interpolate y-values. x2 is a real, double-precision vector.
x1 Specifies the sample x-values. If you do not specify x1, LabVIEW sets x1 to the values of 0 ... length(y1) - 1. x1 is a real, double-precision vector.
method Specifies the interpolation method to use. method is a string that accepts the following values.

'cubic' Performs cubic Hermite interpolation.
'linear' (default) Performs linear interpolation.
'nearest' Chooses the y1 value corresponding to the x1 value that is nearest to the current x2 value. LabVIEW sets the interpolated value to the nearest data point.
'spline' Performs spline interpolation.


Name Description
y2 Returns the y-values interpolated at the values of x2. y2 is a real or complex, double-precision vector or matrix.


The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes
Supported on RT targets Yes
Suitable for bounded execution times on RT Not characterized


X1 = -4:0.5:4;
Y1 = 1.02*X1.^3+0.5*X1.^2+2;
X2 = -4:0.1:4;
Y2 = interpolate1d(X1, Y1, X2, 'spline')

Related Topics



 Was this document helpful?  submit
  Helpful Not Helpful