| Simulink Reference | ![]() |
Approximate a two-dimensional function using a selected lookup method
Library
Description
The Lookup Table (2-D) block computes an approximation to some function z=f(x,y) given x, y, z data points.
The Row index input values parameter is a 1-by-m vector of x data points, the Column index input values parameter is a 1-by-n vector of y data points, and the Matrix of output values parameter is an m-by-n matrix of z data points. Both the row and column vectors must be monotonically increasing. These vectors must be strictly monotonically increasing in the following cases:
Interpolation-Extrapolation.
The block generates output based on the input values using one of these methods selected from the Look-up method parameter list:
Interpolation-Extrapolation--This is the default method; it performs linear interpolation and extrapolation of the inputs.
Interpolation-Use End Values--This method performs linear interpolation as described above but does not extrapolate outside the end points of x and y. Instead, the end-point values are used.
Use Input Nearest--This method does not interpolate or extrapolate. Instead, the elements in x and y nearest the current inputs are found. The corresponding element in z is then used as the output.
Use Input Below--This method does not interpolate or extrapolate. Instead, the elements in x and y nearest and below the current inputs are found. The corresponding element in z is then used as the output. If there are no elements in x or y below the current inputs, then the nearest elements are found.
Use Input Above--This method does not interpolate or extrapolate. Instead, the elements in x and y nearest and above the current inputs are found. The corresponding element in z is then used as the output. If there are no elements in x or y above the current inputs, then the nearest elements are found.
Note
Note that there is no difference among the Use Input Nearest, Use Input Below, and Use Input Above methods when the input x corresponds exactly to table breakpoints.
|
To avoid parameter saturation errors, the automatic scaling script autofixexp employs a special rule for the Lookup Table (2-D) block. autofixexp modifies the scaling by using the output lookup values in addition to the logged minimum and maximum simulation values. The output lookup values are converted to the specified output data type. This prevents the data from being saturated to different values.
Data Type Support
The Lookup Table (2-D) block supports all data types supported by Simulink, including fixed-point data types.
For a discussion on the data types supported by Simulink, refer to Data Types Supported by Simulink in the Using Simulink documentation.
Parameters and Dialog Box
The Main pane of the Lookup Table (2-D) block dialog appears as follows:
-1. See Specifying Sample Time in the online documentation for more information.
The Data types pane of the Lookup Table (2-D) block dialog appears as follows:
Specify via dialog, the Output data type, Output scaling value, and Lock output scaling against changes by the autoscaling tool parameters become visible.
Specify via dialog for the Output data type mode parameter.
Specify via dialog for the Output data type mode parameter.
Specify via dialog for the Output data type mode parameter.
Examples
In this example, the block parameters are defined as
The first figure shows the block outputting a value at the intersection of block inputs that match row and column values. The first input is 1 and the second input is 4. These values select the table value at the intersection of the first row (row parameter value 1) and second column (column parameter value 4).
In the second figure, the first input is 1.7 and the second is 3.4. These values cause the block to interpolate between row and column values, as shown in the table at the left. The value at the intersection (28) is the output value.

Characteristics
| Direct Feedthrough |
Yes |
| Sample Time |
Specified in the Sample time parameter |
| Scalar Expansion |
Yes, of one input if the other is a vector |
| Dimensionalized |
Yes |
| Zero Crossing |
No |
See Also
Lookup Table, Lookup Table (n-D)
| Lookup Table | Lookup Table (n-D) | ![]() |
© 1994-2005 The MathWorks, Inc.