Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

Lookup Table - Approximate one-dimensional function

Library

Lookup Tables

Description

The Lookup Table block computes an approximation to a function y = f(x) given data vectors x and y.

The length of the x and y data vectors provided to this block must match. Also, the x data vector must be strictly monotonically increasing (i.e., the value of the next element in the vector is greater than the value of the preceding element) after conversion to the input's fixed-point data type. However, the x data vector may be monotonically increasing (i.e., the value of the next element in the vector is greater than or equal to the value of the preceding element) if all of the following apply:

For more information about size and monotonicity requirements, see Characteristics of Lookup Table Data. To learn how to model a discontinuous function using a Lookup Table block, see Representation of Discontinuities in Lookup Tables.

You define the table by specifying the Vector of input values parameter as a 1-by-n vector and the Table data parameter as a 1-by-n vector. The block generates output based on the input values using one of these methods selected from the Lookup method parameter list:

The Lookup Table icon displays a graph of the input vector versus the output vector. If you change a parameter on the block's dialog box, the graph is automatically redrawn when you click the OK or Apply button.

To avoid parameter saturation errors, the Simulink Fixed Point software's automatic scaling script employs a special rule for the Lookup Table block. autofixexp modifies the scaling by using the output lookup values in addition to the logged minimum and maximum simulation values. This prevents the data from being saturated to different values. The lookup values are given by the Table data parameter.

Data Type Support

The Lookup Table block supports all numeric data types supported by Simulink software, including fixed-point data types.

For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink in the Simulink documentation.

Parameters and Dialog Box

The Main pane of the Lookup Table block dialog box appears as follows:

Vector of input values

Specify the vector of input values. The input values vector must be the same size as the Table data. Also, the input values vector must be strictly monotonically increasing after conversion to the input's fixed-point data type. However, the input values vector may be monotonically increasing if the input and output signals are both either single or double, and if the lookup method is Interpolation-Extrapolation. Note that due to quantization, the input values vector may be strictly monotonic in doubles format, but not so after conversion to a fixed-point data type.

The Vector of input values parameter is converted offline to the data type of the input signal using round-to-nearest and saturation.

Click the Edit button to open the Lookup Table Editor (see Lookup Table Editor).

Table data

Specify the vector of output values. The table data must be the same size as the Vector of input values.

The Table data parameter is converted offline to the Output data type using round-to-nearest and saturation.

Lookup method

Specify the lookup method. See Description for a discussion of the options for this parameter. For an example that demonstrates values that the Lookup Table block returns based on different lookup methods, see Example Output for Lookup Methods.

Sample time (-1 for inherited)

Specify the time interval between samples. To inherit the sample time, set this parameter to -1. See How to Specify the Sample Time in the online documentation for more information.

The Signal Attributes pane of the Lookup Table block dialog box appears as follows:

Output minimum

Specify the minimum value that the block should output. The default value, [], is equivalent to -Inf. Simulink software uses this value to perform:

Output maximum

Specify the maximum value that the block should output. The default value, [], is equivalent to Inf. Simulink software uses this value to perform:

Output data type

Specify the output data type. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Inherit via back propagation

  • The name of a built-in data type, for example, single

  • The name of a data type object, for example, a Simulink.NumericType object

  • An expression that evaluates to a data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Output data type parameter.

See Specifying Block Output Data Types for more information.

Lock output data type setting against changes by the fixed-point tools

Select to lock the output data type setting of this block against changes by the Fixed-Point Tool and the Fixed-Point Advisor. For more information, see Fixed-Point Tool and Fixed-Point Advisor in the Simulink Fixed Point documentation.

Integer rounding mode

Select the rounding mode for fixed-point lookup table calculations that occur during simulation or execution of code generated from the model. For more information, see Rounding in the Simulink Fixed Point User's Guide.

Note that this option does not affect rounding of block parameters values, such as Table data. Simulink software rounds such values to the nearest representable integer value. To control the rounding of a block parameter, enter an expression using a MATLAB rounding function into the parameter's edit field on the block dialog box.

Saturate on integer overflow

Select to have overflows saturate. Otherwise, they wrap.

When you select this check box, saturation applies to every internal operation on the block, not just the output or result. In general, the code generation process can detect when overflow is not possible, in which case, no saturation code is necessary.

Characteristics

Direct Feedthrough

Yes

Sample Time

Specified in the Sample time parameter

Scalar Expansion

No

Dimensionalized

Yes

Zero-Crossing Detection

No

See Also

Lookup Table (2-D), Lookup Table (n-D)

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS