Simulink Reference | ![]() ![]() |
First stage of high-performance constant or linear interpolation that performs index search and interval fraction calculation for input on a breakpoint set
Library
Description
The PreLook-Up Index Search block calculates the indices and interval fractions for the input value in the Breakpoint data parameter. By using this combination of blocks, you can replace multiple Interpolation (n-D) blocks with one set of PreLook-Up Index Search blocks. In models that have many interpolation blocks simulation performance can be greatly increased.
To use this block, you must define a set of breakpoint values. In normal use, this breakpoint data set corresponds to one dimension of a Table data parameter in an Interpolation (n-D) using PreLook-Up block. The block generates a pair of outputs for each input value by calculating the index of the breakpoint set element that is less than or equal to the input value and the resulting fractional value that is a number 0 f < 1 that represents the input value's normalized position between the index and the next index value for in-range input.
For example, if the breakpoint data is
and the input value u
is 55, the (index, fraction) pair is (4, 0.1), denoted as k
and f
on the block icon. Note that the index value is zero-based.
Note
The interval fraction can be negative or greater than 1 for out-of-range input. See the documentation for the block's Process out of range input parameter for more information.
|
Data Type Support
A PreLook-Up Index Search block accepts signals of types double or single, but for any given block the inputs must all be of the same type. The Breakpoint data parameter must be of the same type as the inputs. The output data type is set to the input data type.
Parameters and Dialog Box
Breakpoint data
Index search method
Binary search, evenly spaced points, or linear search. Use linear search in combination with Begin index search using previous index result for higher performance than a binary search when the input values do not change much from one time step to the next. For large breakpoint sets, a linear search can be very slow if the input value changes by more than a few intervals from one time step to the next.
Begin index search using previous index result
Select this option if you want the block to start its search using the index that was found on the previous time step. For inputs that change slowly with respect to the interval size, you can realize a large performance gain.
Output only the index
If this block is not being used to feed an Interpolation (n-D) Using PreLook-Up block, the interval fraction output can be dropped and the resulting index value output is a uint32
instead.
Process out of range input
Specifies how to handle out-of-range input. Options include:
0
) and 0
for the interval fraction. If the input is greater than the last breakpoint, return the index of the next-to-the-last breakpoint and 1
for the interval fraction. For example, suppose the range is [1 2 3]
and this option is selected. Then, if the input is 0.5
, the block returns [0 0]
; if the input is 3.5
, the block returns [1 1]
.
an
interval fraction that represents the linear distance from the next-to-the-last breakpoint to the input. For example, suppose the range is [1 2 3]
and this option is selected. Then, if the input is 0.5
, the block returns [0 -0.5]
; if the input is 3.5
, the block returns [1 1.5]
.
Action for out of range input
Specifies whether to produce a warning or error message if the input is out of range. The options are None
(the default, no warning or error message), Warning
(display a warning message in the MATLAB command window and continue the simulation), Error
(halt the simulation and display an error message in the Simulink Diagnostic Viewer).
Characteristics
Direct Feedthrough |
Yes |
Sample Time |
Inherited from driving blocks |
Scalar Expansion |
Yes |
Dimensionalized |
Yes |
Zero Crossing |
No |
![]() | Polynomial | Product | ![]() |