Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

interp1 (MathScript Function) (Windows, Not in Base Package)

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

Member of the approximation and the resampling classes.

Syntax

y2 = interp1(y1, x2)

y2 = interp1(x1, y1, x2)

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

Description

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

Examples

Inputs

Name Description
y1 Specifies the sample y-values. If y1 is a matrix, LabVIEW performs interpolation for each column in the matrix. y1 is a real, 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. If x1 is a matrix, LabVIEW performs interpolation for each column in the matrix. x1 is a real, double-precision vector or matrix.
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.

Outputs

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

Examples

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

Related Topics

interp
interp2
interpft
pchip


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit