Engee documentation

Interpolation Using Prelookup

Usage of precomputed index and fraction values to speed up the approximation of an N-dimensional function.

interpolation using prelookup

Description

The Interpolation Using Prelookup block is most effective with usage of the Prelookup block. The Prelookup block calculates the index and fraction of an interval, which determine how its input value u relates to a dataset of breakpoints. The resulting index and fraction values are fed into the Interpolation Using Prelookup block to interpolate the n-dimensional table. Both blocks have integrated algorithms.

The block icon changes depending on the parameters set.

Supported block operations

For usage of the Interpolation Using Prelookup block, you must set a set of tabular data values directly in the dialogue box. As a rule, these tabular values correspond to the data sets of the breakpoints defined in the Prelookup blocks. The Interpolation Using Prelookup block generates output by searching or estimating tabular values based on the index and interval fraction values supplied from the Prelookup blocks. The labels for index and interval fraction are displayed as k and f on the Interpolation Using Prelookup block icon.

When entering index and fraction of interval values…​ The Interpolation Using Prelookup block…​

Match against values in datasets with breakpoints

Outputs a table value at the intersection of rows, columns, and breakpoints of higher dimensionality

Not matched to values in data sets with breakpoints, but within range

Interpolates corresponding table values using the selected interpolation method

Not matched to the values in the breakpoint datasets and outside the range

Extrapolates the output value using the selected extrapolation method.

Ports

Input

k1 - index, k, for the first dimension of the table
scalar | vector | matrix

Index with the first value, k, specifying the interval containing the input value u, for the first dimensionality of the table.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64.

f1 - fraction, f, for the first dimension of the table
scalar | vector | matrix

A fraction, f, representing the normalised position of the input in the interval k for the first dimensionality of the table.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64.

kn - index, k, for the nth dimension of the table
scalar | vector | matrix

Index with the first value, k, specifying the interval containing the input value u for the n-th dimensionality of the table.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64.

fn - fraction, f, for the nth dimension of the table
scalar | vector | matrix

A fraction, f, representing the normalised position of the input in the interval k for the nth dimensionality of the table.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64.

Output

Port_1 - approximation of N-dimensional function
scalar | vector | matrix

An approximation of an N-dimensional function calculated by interpolation (or extrapolation) of tabular data by the values of the input index, k, and the fraction, f.

Data types: Float64.

Parameters

Number of dimensions - dimensionality of the table data
2 (by default) | an integer from 1 to 30

Specify the dimensionality that the table data should have. The number of dimensions defines the number of independent variables for the table.

The maximum table dimensionality supported by this block is 30.

Usage in program code

Block parameters

NumberOfTableDimensions 1 2 4 …​

Values

1 | 2 | 3 |4 |…​ | 30

By default

2

Value - values of tabular data
sqrt.(collect(1:11) * collect(1:11)') (by default) | multidimensional array of tabular data

Specifies tabular data as an N-dimensional array, where N is the value of the Number of dimensions parameter.

Table 1. Usage in program code

Block parameters

Table

Values

scalar | vector | matrix | multidimensional array

By default

sqrt.(collect(1:11) * collect(1:11)')

Interpolation method - interpolation method
Linear point-slope (by default) | Flat | Nearest | Linear Lagrange

The method by which the block interpolates the table data.

Usage in program code

Block parameters

InterpMethod Linear point-slope Flat Nearest Linear Lagrange

Values

Linear point-slope | Flat | Nearest | Linear Lagrange

By default

Linear point-slope

Extrapolation method - a method of handling input values that fall outside the range of the break point dataset
Linear (By default) | Clip

The method that the block uses to extrapolate values for all inputs that fall outside the range of the burst point dataset.

Variants: Clip or Linear.

If the Linear extrapolation method is specified, the value is calculated by linear interpolation. For example, if the interpolation method is Linear Lagrange, the extrapolation method inherits the Linear Lagrange equation to calculate the extrapolated value.

For the Prelookup and Interpolation Using Prelookup blocks to replicate the behaviour of the n-D Lookup Table block, the extrapolation method for both the Prelookup and Interpolation Using Prelookup blocks must be the same as for usage of the n-D Lookup Table block alone.

For example, to get the same behaviour of the n-D Lookup Table block with the extrapolation method set to Linear, set the extrapolation method to Linear for both the Prelookup block and the Interpolation Using Prelookup block.

Dependencies

To use the Extrapolation method parameter, set the Interpolation method parameter to Linear; otherwise a special error will be generated.

The Interpolation Using Prelookup block does not support linear extrapolation if the input or output signals are of fixed-point data type.

Usage in program code

Block parameters

ExtrapMethod

Values

Linear | Clip

By default

Linear