20.6.6.5. Lookup Table

The Lookup Table block computes an approximation based on the given vectors of input values and output values using the specified lookup method. The length of the given vectors should be equal. Also, values in the input vector should be strictly monotonically increasing.

The Lookup method:

  • Interpolation-Extrapolation

    If the input signal is equal to an element of the input vector of the table, the output signal is the corresponding element in the output vector of the table.

    If no element of the input vector is equal to the input signal, the block implements linear interpolation between the two closest elements of the input vector to determine the output value. If the input signal is less than the first or greater than the last element of the input vector, the block extrapolates the first two or last two elements of the input vector to obtain the output value.

  • Interpolation-Use End Values

    Same as the above interpolation, but does not extrapolate. Instead, the end element of the output vector is used as the output signal.

  • Use Input Nearest

    This method does not interpolate or extrapolate. Instead, the nearest element of the input vector to the input signal is selected and the corresponding element in the output vector is used for the output signal.

  • Use Input Below

    This method does not interpolate or extrapolate. Instead, the element of the input vector nearest and below the input signal is selected to find the corresponding element in the output vector. If no element is below the input signal, the nearest element is used.

  • Use Input Above

    This method does not interpolate or extrapolate. Instead, the element of the input vector nearest and above the input signal is selected to find the corresponding element in the output vector. If no element is above the input signal, the nearest element is used.

Dialog box

../_images/image1662.png

Figure 20.102 Lookup Table dialog box

Table 20.51 Parameters

Parameter(s)

Description

Lookup method

Select a lookup method.

Input values

Enter the vector of input values.

Output values

Enter the vector of output values.

Sample time

Enter the time interval between samples.

20.6.6.5.1. Example

We can test the Lookup Table block with the CoLink model shown in the below figure. Let’s make a sin() function using Lookup Table block instead of the sin() function block. The Sine block is configured to a frequency of 1rad/sec and an amplitude of 90.

Table 20.52 Input values and output values for Lookup Table block

radian

value

0

0

30*π/180

0.5000

60*π/180

0.8660

90*π/180

1

../_images/image1671.png

Figure 20.103 colink model

../_images/image1682.png

Figure 20.104 values in Lookup Table block

../_images/image1692.png
../_images/image170.png

Figure 20.105 Results according to the Lookup method [Interpolation-Extrapolation]

../_images/image1711.png
../_images/image1721.png

Figure 20.106 Results according to the Lookup method [Interpolation-Use End Values]