20.6.6.6. Lookup Table (2D)

The Lookup Table (2D) block computes an approximation of output value with given values of two (2D) inputs and outputs using the specified lookup method. If the Row index of one input parameter is a 1-by-m vector and the Column index of the other input parameter is a 1-by-n vector, the Matrix of output parameter should be an m-by-n matrix. Also, the Row and Column values of input parameters should be strictly monotonically increasing.

The Lookup method:

  • Interpolation-Extrapolation

    If the input signals are equal to an element of the Row index and an element of the column index, respectively, the output signal is the corresponding element in the output matrix of the table.

    If the input signals are not equal to elements of the Row and Column index of the input parameters, the block implements a linear interpolation between the appropriate elements of the Row and Column index of the input parameters to determine an output value. If either or both the input signals are less than the first or greater than the last elements of the Row or Column index of the input parameters, the block extrapolates using the first two or last two elements of the Row or Column index of the input parameters.

  • Interpolation-Use End Values

    Same as the above interpolation, but does not extrapolate. Instead, the end elements of the Row and Column index of the input parameters are used to determine the output signal.

  • Use Input Nearest

    This method does not interpolate or extrapolate. Instead, the elements of the Row and Column index of the input parameters nearest to the input signals are selected and the corresponding element in the Matrix of the output parameter is used for the output signal.

  • Use Input Below

    This method does not interpolate or extrapolate. Instead, the elements of the Row and Column index of the input parameters nearest and below the input signals are selected to find the corresponding element in the Matrix of the output parameter. If no element is below the input signals, the nearest element is used.

  • Use Input Above

    This method does not interpolate or extrapolate. Instead, the elements of the Row and Column index of the input parameters nearest and above the input signals are selected to find the corresponding element in the Matrix of the output parameter. If no element is above the input signals, the nearest element is used.

Dialog box

../_images/image1731.png

Figure 20.107 Lookup Table (2D) dialog box

Table 20.53 Parameters

Parameter(s)

Description

Lookup method

Select a lookup method.

Row index of input values

Enter the values for an input parameter.

Column index of input values

Enter the values for the other input parameter.

Matrix of output values

Enter the matrix of output values.

Sample time

Enter the time interval between samples.

20.6.6.6.1. Example

We can test the Lookup Table2D block with the CoLink model shown in the below figure. The block gets values from two inputs; columns and rows and can express as a numerical formula;:math:z=f(x,y).

Let’s make a numerical formula as following figures.

\(z={{x}^{2}}+{{y}^{2}}\)

\(\begin{aligned} & x=\left[ \begin{matrix} 1 & 2 & 3 \\ \end{matrix} \right] \\ & y=\left[ \begin{matrix} 1 & 2 & 3 \\ \end{matrix} \right] \\ & z=\left[ \begin{matrix} 2 & 5 & 10 \\ 8 & 8 & 13 \\ 10 & 13 & 18 \\ \end{matrix} \right] \\ \end{aligned}\)

../_images/image174.png

Figure 20.108 CoLink model

../_images/image1751.png

Figure 20.109 values in Lookup Table2D block

../_images/image1761.png

Figure 20.110 A result from scope

Table 20.54 Lookup Table2D

1 2

2.3

3

12

2 5 5 8

10

13

2.5

3

10 13

18