Main Content

About Lookup Table Blocks

A lookup table is an array of data that maps input values to output values, thereby approximating a mathematical function. Given a set of input values, a lookup operation retrieves the corresponding output values from the table. If the lookup table does not explicitly define the input values, Simulink® can estimate an output value using interpolation, extrapolation, or rounding, where:

  • An interpolation is a process for estimating values that lie between known data points.

  • An extrapolation is a process for estimating values that lie beyond the range of known data points.

  • A rounding is a process for approximating a value by altering its digits according to a known rule.

A lookup table block uses an array of data to map input values to output values, approximating a mathematical function. Given input values, Simulink performs a “lookup” operation to retrieve the corresponding output values from the table. If the lookup table does not define the input values, the block estimates the output values based on nearby table values.

The following example illustrates a one-dimensional lookup table that approximates the function y = x3. The lookup table defines its output (y) data discretely over the input (x) range [-3, 3]. The following table and graph illustrate the input/output relationship:

An input of -2 enables the table to look up and retrieve the corresponding output value (-8). Likewise, the lookup table outputs 27 in response to an input of 3.

When the lookup table block encounters an input that does not match any of the table's x values, it can interpolate or extrapolate the answer. For instance, the lookup table does not define an input value of -1.5; however, the block can linearly interpolate the nearest adjacent data points (xi, yi) and (xi+1, yi+1). For example, given these two points:

  • (xi, yi) is (-2, -8)

  • (xi+1, yi+1) is (-1, -1)

The lookup table estimates and returns a value of -4.5.

Similarly, although the lookup table does not include data for x values beyond the range of [-3, 3], the block can extrapolate values using a pair of data points at either end of the table. Given an input value of 4, the lookup table block linearly extrapolates the nearest data points (2, 8) and (3, 27) to estimate an output value of 46.

Since table lookups and simple estimations can be faster than mathematical function evaluations, using lookup table blocks might result in speed gains when simulating a model. Consider using lookup tables in lieu of mathematical function evaluations when:

  • An analytical expression is expensive to compute.

  • No analytical expression exists, but the relationship has been determined empirically.

Simulink provides a broad assortment of lookup table blocks, each geared for a particular type of application. The sections that follow outline the different offerings, suggest how to choose the lookup table best suited to your application, and explain how to interact with the various lookup table blocks.

Related Topics