Approximate two-dimensional function using specified lookup method

Physical Signals/Lookup Tables

The PS Lookup Table (2D) block computes an approximation
to some function `f=f(x1,x2)`

given the `x1`

, `x2`

, `f`

data
points. The two inputs and the output are physical signals.

You define the lookup table by specifying the **Table
grid vector 1** parameter (vector of data points along the
first axis), the **Table grid vector 2** parameter
(vector of data points along the second axis), and the **2D
array of table values** (array of output values). The block
works on Cartesian mesh, i.e., function values must be specified at
vertices of a rectangular array.

The `x1`

and `x2`

data vectors
must be strictly monotonic, either increasing or decreasing. The array
size of the tabulated function values must match the dimensions defined
by the input vectors. That is, if the inputs are a 1-by-`m`

vector
and a 1-by-`n`

vector, supply an `m`

-by-`n`

matrix
of output values.

The block generates output based on the input grid lookup using the selected interpolation and extrapolation methods. You have a choice of two interpolation methods and two extrapolation methods. You also have an option for the block to issue an error if any of the input signal values is outside the respective table grid vector range.

**Table grid vector 1**Specify the vector of input values along the first axis as a 1-by-

`m`

array. The input values vector must be strictly monotonic, either increasing or decreasing. The values can be nonuniformly spaced. For smooth interpolation, the vector must contain at least three values. For linear interpolation, two values are sufficient.**Table grid vector 2**Specify the vector of input values along the second axis as a 1-by-

`n`

array. The input values vector must be strictly monotonic, either increasing or decreasing. The values can be nonuniformly spaced. For smooth interpolation, the vector must contain at least three values. For linear interpolation, two values are sufficient.**2D array of table values**Specify the output values as an

`m`

-by-`n`

matrix, defining the function values at the input grid vertices. The matrix size must match the dimensions defined by the input vectors.**Interpolation method**Select one of the following interpolation methods for approximating the output value when the input value is between two consecutive grid points:

`Linear`

— Uses an extension of linear algorithm for multidimensional interpolation. The method performs linear interpolation first in-direction and then in`x1`

-direction. Select this option to get the best performance.`x2`

`Smooth`

— Uses a modified Akima interpolation algorithm. For details, see

. Select this option to produce a continuous surface with continuous first-order derivatives.`tablelookup`

**Extrapolation method**Select one of the following extrapolation methods for determining the output value when the input value is outside the range specified in the argument list:

`Linear`

— Extends from the edge of the interpolation region linearly. The slope of the linear extrapolation is equal to the slope of the interpolated surface at the edge of the interpolation region.`Nearest`

— Extends from the edge of the interpolation region as a constant. The value of the nearest extrapolation is equal to the value of the interpolated surface at the edge of the interpolation region. Select this option to produce an extrapolation that does not go above the highest point in the data or below the lowest point in the data.`Error`

— Issues an error if any of the input signals is outside the range of the table. Select this option to avoid going into the extrapolation mode when you want your data to be within the table range.

The block has two physical signal input ports and one physical signal output port.

Was this topic helpful?