FixPt Dynamic Look-Up Table
Approximate a one-dimensional function using a selected look-up method and a dynamically specified table
Description
The FixPt Dynamic Look-Up Table block is a masked S-function that computes an approximation to some function y = f(x) given x, y data vectors. The look-up 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.
Unlike the Fixpt Look-Up Table block, the FixPt Dynamic Look-Up Table block allows you to change the table data without stopping the simulation. For example, you may want to automatically incorporate new table data if the physical system you are simulating changes.
You define the look-up 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:
The y table data and the output vector must have the same sign, the same bias, and the same fractional slope.
The 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 Look-up method parameter list:
Interpolation-Extrapolation - This is the default method; it performs linear interpolation and extrapolation of the inputs.
If a value matches the block's input, the output is the corresponding element in the output vector.
If no value matches the block's input, then the block performs linear interpolation between the two appropriate elements of the table to determine an output value. If the block input is less than the first or greater than the last input vector element, then the block extrapolates using the first two or last two points.
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.
For a detailed description of all other block parameters, refer to Block Parameters.
Parameters and Dialog Box
Look-up method - Look-up method.
Output data type and scaling - Specify the output data type and scaling via the dialog box, or inherit the data type and scaling by back propagation.
Output data type - Any data type supported by the Fixed-Point Blockset.
Output scaling - Radix point-only or slope/bias scaling. These scaling modes are available only for generalized fixed-point data types.
Lock output scaling so autoscaling tool can't change it - If checked, Output scaling is locked. This feature is available only for generalized fixed-point output.
Round toward - Rounding mode for the fixed-point output.
Saturate to max or min when overflows occur - If checked, fixed-point overflows saturate. Otherwise, they wrap.
Override with data type(s) with doubles - If checked, the Output data type is overridden with doubles.
Log minimums and maximums - If checked, minimum and maximum simulation values are logged to the workspace.
Characteristics
Input Port(s) | Any data type supported by the blockset |
Output Port | Any data type supported by the blockset |
Direct Feedthrough | Yes |
Sample Time | Inherited |
Scalar Expansion | No |
States | 0 |
Vectorized | Yes |