# Interpolate 1D (Rational) (G Dataflow)

Interpolates or extrapolates a function f by using a rational function. The rational function passes through all the points formed by arrays of dependent and independent values.

## x is monotonic?

A Boolean that specifies whether the values of the independent variable increase monotonically with the index.

 True The values of the independent variable increase monotonically with the index. This node does not sort x or reorder y. False The values of the independent variable does not increase monotonically with the index. This node sorts x to be in ascending order and reorders y accordingly.

This input is available only if you wire an array of double-precision, floating-point numbers to x or y.

Default: False

## reset

A Boolean that specifies whether to reset the internal state of the node.

 True Resets the internal state of the node. False Does not reset the internal state of the node.

This input is available only if you wire a double-precision, floating-point number to x or y.

Default: False

## y

Tabulated values of the dependent variable.

This input accepts a double-precision, floating-point number or a 1D array of double-precision, floating-point numbers.

When x and y are 1D arrays of double-precision, floating-point numbers, the length of x must equal the length of y.

## x

Tabulated values of the independent variable.

This input accepts a double-precision, floating-point number or a 1D array of double-precision, floating-point numbers.

When x and y are 1D arrays of double-precision, floating-point numbers, the length of x must equal the length of y.

## xi

Points at which the interpolation or extrapolation is performed.

This input accepts a double-precision, floating-point number or a 1D array of double-precision, floating-point numbers.

If the value of xi is in the range of x, the node performs interpolation. Otherwise, the node performs extrapolation. If xi is too far from the range of x, the extrapolation error may be large. It is not a satisfactory extrapolation.

## ntimes

Number of times that this node interpolates values repeatedly and evenly between each x element to generate xi used. ntimes determines the locations of the interpolation values.

This input yields interpolated values between every y element when xi is empty. The node ignores ntimes if you wire the xi input.

This input is available only if you wire an array of double-precision, floating-point numbers to xi.

Default: 1

## sample length

Length of each set of data. The node performs computation for each set of data.

sample length must be greater than zero.

This input is available only if you wire a double-precision, floating-point number to x or y.

Default: 10

## error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error

## yi

Interpolation of the function f at the points you specified.

This output can return a double-precision, floating-point number or a 1D array of double-precision, floating-point numbers.

## xi used

Values of the independent variable at which this node computes interpolated values of the dependent variable.

This output is available only if you wire an array of double-precision, floating-point numbers to xi.

If xi is empty, xi used returns 2 ntimes *(N - 1) + 1 points with (2 ntimes - 1) points located evenly between each two adjacent elements in x, where N is the length of x. If you wire the xi input, xi used equals xi.

## interpolation error

An estimate of the errors for each interpolated values.

This output can return a double-precision, floating-point number or a 1D array of double-precision, floating-point numbers.

## error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

## Algorithm for Calculating the Interpolation Value

The following rational function passes through all the points formed by y and x:

${y}_{i}=\frac{P\left({x}_{j}\right)}{Q\left({x}_{j}\right)}=\frac{{p}_{0}+{p}_{1}{x}_{j}+...{p}_{m}{x}_{j}^{m}}{{q}_{0}+{q}_{1}{x}_{j}+...{q}_{m}{x}_{j}^{m}}$

where

• P and Q are polynomials and the rational function is unique
• (x j , y j ) is a set of n points of y and x
• n is the total number of points formed by y and x

This node calculates the interpolation value with the following equation:

$\mathrm{yi}=\frac{P\left(\mathrm{xi}\right)}{Q\left(\mathrm{xi}\right)}$

If n is odd, the degrees of freedom of P and Q are $\frac{n-1}{2}$. If n is even, the degrees of freedom of P are $\frac{n}{2}-1$ and the degrees of freedom of Q are $\frac{n}{2}$.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported

Web Server: Not supported in VIs that run in a web application