Fixed-Point Prelookup and Interpolation
This example shows some of the features of Prelookup and Interpolation Using Prelookup blocks.
- Prelookup and Interpolation Using Prelookup blocks support both floating-point data types and fixed-point data types.
- The algorithms that perform fraction calculation and evenly-spaced index search do not saturate. Therefore, the Prelookup block does not have a saturation parameter. Press Ctrl+b to generate code for the example. Observe the saturation-free algorithms in the generated code.
- Even if the Saturate on integer overflow parameter is checked, the algorithms that perform interpolation will saturate only when the Intermediate results data type cannot hold the intermediate results, or the Output data type can not hold the result. Press Ctrl+b to generate code for the example model. Observe the saturation-free algorithms in the generated code.
- Prelookup and Interpolation Using Prelookup blocks support all rounding modes, including Simplest rounding mode. Double-click the blocks to open their dialogs and specify the rounding modes.
- When evenly-spaced index search is used with breakpoints spaced apart by a power of two in Prelookup blocks, the division needed to calculate indices is optimized using an efficient shift operation in the generated code.
- Simulink® always checks dimensional consistency between the Breakpoint data parameter of the Prelookup block and the Table data parameter of the Interpolation Using Prelookup block.
- Prelookup and Interpolation Using Prelookup blocks support two different indexing conventions, specified by the Use last breakpoint for input at or above upper limit parameter in the Prelookup block and the Valid index input may reach last index parameter in the Interpolation Using Prelookup block. Simulink® always checks the consistency of indexing conventions between these blocks.