| Simulink Reference | ![]() |
Approximate a one-dimensional function using a selected lookup method and a dynamically specified table
Library
Description
The Lookup Table Dynamic block computes an approximation to some function y=f(x) given x, y data vectors. The lookup method can use interpolation, extrapolation, or the original values of the input.
The x data vector must be strictly monotonically increasing after conversion to the input's fixed-point data type. Note that due to quantization, the x data vector may be strictly monotonic in doubles format, but not so after conversion to a fixed-point data type.
You define the lookup table by inputting the x and y table data to the block as 1-by-n vectors. To help reduce the ROM used by the code generated for this block, you can use different data types for the x table data and the y table data. However, these restrictions apply:
y table data and the output vector must have the same sign, the same bias, and the same fractional slope.
x table data and the x data vector must have the same sign, the same bias, and the same fractional slope. Additionally, the precision and range for the x data vector must greater than or equal to the precision and range for the x table data.
The block generates output based on the input values using one of these methods selected from the Lookup 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 the input vector. Instead, the end-point values are used.
Use Input Nearest--This method does not interpolate or extrapolate. Instead, the element in x nearest the current input is found. The corresponding element in y is then used as the output.
Use Input Below--This method does not interpolate or extrapolate. Instead, the element in x nearest and below the current input is found. The corresponding element in y is then used as the output. If there is no element in x below the current input, then the nearest element is found.
Use Input Above--This method does not interpolate or extrapolate. Instead, the element in x nearest and above the current input is found. The corresponding element in y is then used as the output. If there is no element in x above the current input, then the nearest element is 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.
|
The table data is converted from doubles to the x data type offline using round-to-nearest and saturation.
Data Type Support
The Lookup Table Dynamic block accepts signals of any data type supported by Simulink, including fixed-point data types.
Parameters and Dialog Box
The Main pane of the Lookup Table Dynamic block dialog appears as follows:
The Signal data types pane of the Lookup Table Dynamic block dialog appears as follows:
Specify via dialog, the Output data type and Output scaling parameters appear.
Specify via dialog for the Output data type and scaling parameter.
Specify via dialog for the Output data type and scaling parameter.
Examples
For an example that illustrates the lookup methods supported by this block, see the example included in the Lookup Table block reference pages.
Characteristics
| Direct Feedthrough |
Yes |
| Scalar Expansion |
No |
See Also
Lookup Table, Lookup Table (2-D), Lookup Table (n-D)
| Lookup Table (n-D) | Magnitude-Angle to Complex | ![]() |
© 1994-2005 The MathWorks, Inc.