Lookup Table Dynamic
Approximate a one-dimensional function using dynamic table
Libraries:
Simulink /
Lookup Tables
Description
How This Block Differs from Other Lookup Table Blocks
The Lookup Table Dynamic block computes an approximation of a function
y = f(x)
using xdat
and
ydat
vectors. The lookup method can use interpolation,
extrapolation, or the original values of the input.
Using the Lookup Table Dynamic block, you can change the table data without stopping the simulation. For example, you can incorporate new table data if the physical system you are simulating changes.
Inputs for Breakpoint and Table Data
The xdat
vector is the breakpoint data, which must be
strictly monotonically increasing. The value of the next
element in the vector must be greater than the value of the preceding element after
conversion to a fixed-point data type. Due to quantization, xdat
can be strictly monotonic for a floating-point data type, but not after conversion
to a fixed-point data type.
The ydat
vector is the table data, which is an evaluation of
the function at the breakpoint values.
Note
The inputs to xdat
and ydat
cannot be
scalar (one-element array) values. If you provide a scalar value to either of
these inputs, you see an error upon simulation. Provide a 1-by-n vector to both
the xdat
and ydat
inputs.
Lookup Table Definition
You define the lookup table by feeding xdat
and ydat
as 1-by-n vectors to the block. To reduce ROM usage in the generated code for this
block, you can use different data types for xdat
and
ydat
.
Tip
Breakpoints with even spacing can make Simulink®
Coder™ generated code division-free. For more information, see fixpt_evenspace_cleanup
in
the Simulink documentation and Identify questionable fixed-point operations (Embedded Coder) in the Simulink
Coder documentation.
How the Block Generates Output
The block uses the input values to generate output using the method you select for Lookup Method:
Lookup Method | Block Action |
---|---|
Interpolation-Extrapolation
| Performs linear interpolation and extrapolation of the inputs.
Note If you select this lookup method, Simulink Coder software cannot generate code for this block. |
Interpolation-Use End Values (default) | Performs linear interpolation but does not extrapolate outside the end points of the breakpoint data. Instead, the block uses the end values. |
Use Input Nearest
| Finds the element in |
Use Input Below
| Finds the element in |
Use Input Above
| Finds the element in |
Note
The Use Input Nearest
, Use Input Below
,
and Use Input Above
methods perform the same action when the
input x
matches a breakpoint value.
Some continuous solvers subdivide the simulation time span into major and minor time steps. A minor time step is a subdivision of the major time step. The solver produces a result at each major time step and uses results at minor time steps to improve the accuracy of the result at the major time step. For continuous solvers, the output of the Lookup Table Dynamic block can appear like a stair step because the signal is fixed in minor time step to avoid incorrect results. For more information about the effect of solvers on block output, see Compare Solvers in the Simulink documentation.
Examples
Ports
Input
Output
Parameters
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Extended Capabilities
Version History
Introduced before R2006a