Lookup Table (n-D) - Approximate N-dimensional function

Library

Lookup Tables

Description

The Lookup Table (n-D) block evaluates a sampled representation of a function in N variables, , where the function F might be known only empirically. The block efficiently maps its inputs to an output value by looking up or interpolating a table of values as defined by the block's parameters. The block supports flat (constant), linear, and cubic spline interpolation methods. You can apply any of these methods to 1-D, 2-D, 3-D, or higher dimensional tables.

To use this block, specify the number of dimensions of your lookup table using the Number of table dimensions parameter. In the Breakpoints for dimension parameter, enter a breakpoint vector that corresponds to each dimension of your lookup table. Define the associated set of output values as the Table data parameter. You can customize the block's lookup and estimation behaviors by specifying, for example, values for its Index search method, Interpolation method, and Extrapolation method parameters.

The first block input identifies the first dimension (row) breakpoints, the next block input identifies the second dimension (column) breakpoints, and so on. See Changing the Orientation of a Block for a description of the port order for various block orientations.

During simulation, the Lookup Table (n-D) block generates its output by looking up or estimating table values based on its input values:

Alternatively, you can use the Interpolation Using Prelookup block with the Prelookup block to perform the equivalent operation of a Lookup Table (n-D) block. This combination of blocks offers greater flexibility that can result in more efficient simulation performance for linear interpolations in certain circumstances.

For noninterpolated table lookups, use the Direct Lookup Table (n-D) block when the lookup operation is a simple array access, for example, if you have an integer value k and you want the kth element of a table, y = table(k).

Data Type Support

The Lookup Table (n-D) block supports all 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.

Inputs for indexing must be real; table data can be complex.

Parameters and Dialog Box

The Main pane of the Lookup Table (n-D) block dialog appears as follows:

Number of table dimensions

Enter the number of dimensions of the Table data parameter by specifying an integer from 1 to 30. This determines the number of independent variables for the table and hence the number of block inputs. It also determines the number of dimensions that appear in the Breakpoints for dimension parameter.

Breakpoints for dimension

Define breakpoint sets that correspond to the dimensions of the Table data parameter. For each dimension, specify breakpoints as a vector whose values are strictly monotonically increasing.

The breakpoint sets are converted offline to their corresponding input signal's data type using round-to-nearest and saturation.

Index search method

Select Evenly spaced points, Linear search, or Binary search (the default). Each search method has speed advantages in different circumstances:

A suboptimal choice of index search method can lead to slow performance of models that rely heavily on lookup tables.

Begin index search using previous index result

Select this option if you want the block to start its search using the index that was found at the previous time step. For inputs that change slowly with respect to the interval size, enabling this option can improve performance. Otherwise, the linear search and binary search methods might take significantly longer, especially for large breakpoint sets.

Use one input port for all input data

Instead of having one input port per independent variable, the block is configured with just one input port that expects a signal that is N elements wide for an N-dimensional table. This might be useful in removing line clutter on a block diagram with many lookup tables.

Process out-of-range input

Specifies whether to produce a warning or error message if the input is out of range. The options are:

Table data

The table of output values. During simulation, the matrix size must match the dimensions defined by the Number of table dimensions parameter. However, during block diagram editing, you can enter either an empty matrix (specified as []) or an undefined workspace variable as the Table data parameter. This technique allows you to postpone specifying a correctly dimensioned matrix for the Table data parameter and continue editing the block diagram. For information about how to construct multidimensional arrays in MATLAB, see Multidimensional Arrays in the MATLAB documentation.

The Table data parameter is converted offline to the Output data type using the specified rounding and saturation.

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

Interpolation method

Select None - Flat, Linear (the default), or Cubic spline. See Interpolation Methods for more information.

Extrapolation method

Select None - Clip, Linear (the default), or Cubic spline. See Extrapolation Methods for more information.

Use last table value for inputs at or above last breakpoint

Specify the indexing convention that the block uses internally to address the last element of a breakpoint vector and its corresponding table value. If selected, the block addresses the end of a breakpoint vector and its table value using the last element's index and 0 for the interval fraction. Otherwise, the block addresses those same values using the index of the next-to-last breakpoint and 1 for the interval fraction.

This parameter is visible only if the Interpolation method specifies Linear and the Extrapolation method is None - Clip.

Sample time (-1 for inherited)

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

The Signal Attributes pane of the Lookup Table (n-D) block dialog appears as follows:

Require all inputs to have the same data type

Select to require all inputs to have the same data type.

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:

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 scaling against changes by the autoscaling tool

Select to lock scaling of outputs. This parameter is visible only if you enter an expression for the Output data type parameter.

Round integer calculations toward

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 values of block parameters, 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.

The Internal Attributes pane of the Lookup Table (n-D) block dialog appears as follows:

Fraction data type

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

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

See Using the Data Type Assistant for more information.

Characteristics

Direct Feedthrough

Yes

Sample Time

Specified in the Sample time parameter

Scalar Expansion

Yes

Dimensionalized

Yes

Zero Crossing

No

See Also

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

  


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