Prelookup - Compute index and fraction for Interpolation Using Prelookup block

Library

Lookup Tables

Description

The Prelookup block is intended for use with the Interpolation Using Prelookup block. The Prelookup block calculates the index and interval fraction that specifies how its input value relates to the breakpoint data set. You feed the resulting index and fraction values into an Interpolation Using Prelookup block to interpolate an n-dimensional table. This combination of blocks performs the equivalent operation that a single instance of the Lookup Table (n-D) block performs. However, the Prelookup and Interpolation Using Prelookup blocks offer greater flexibility that can result in more efficient simulation performance.

To use this block, you must define a set of breakpoint values. In normal use, this breakpoint data set corresponds to one dimension of the Table data parameter in an Interpolation Using Prelookup block. The block generates a pair of outputs for each input value by calculating the

For example, if the breakpoint data set is

[ 0 5 10 20 50 100 ]

and the input value u is 55, the index is 4 and the fractional value is 0.1, denoted respectively as k and f on the block. Note that the index value is zero-based.

Data Type Support

The Prelookup block accepts real signals of any numeric data type supported by Simulink software, except Boolean. The Prelookup block supports fixed-point data types.

For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink in the Simulink documentation.

Parameters and Dialog Box

The Main pane of the Prelookup block dialog appears as follows:

Breakpoint data

The set of numbers to search. Specify a strictly monotonically increasing vector that contains two or more elements.

Click the Edit button to open the Lookup Table Editor (see Lookup Table Editor in the Simulink documentation).

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 more efficient performance than Binary search when the input values do not change much from one time step to the next. For large breakpoint data 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. Use Evenly spaced points if the elements of the Breakpoint data parameter are spaced apart evenly.

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 at 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 Using Prelookup block, the interval fraction output can be dropped. In this case, the block outputs only the resulting index value.

Process out of range input

Specifies how to handle out-of-range input. Options include:

Use last breakpoint for input at or above upper limit

Specifies how to index inputs that are greater than or equal to the last breakpoint. If enabled when the block input equals the last breakpoint, the block returns the index of the last element in the breakpoint data set and 0 for the interval fraction. If disabled in this situation, the block returns the index of the next-to-last breakpoint and 1 for the interval fraction. Note that the index value is zero-based.

This parameter is visible only if Output only the index is unchecked and Process out of range input is Clip to range. However, if Output only the index is checked and Process out of range input is Clip to range, the block behaves as if this parameter is enabled even though it is invisible.

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

Sample time

Specifies the time interval between samples. To inherit the sample time, set this parameter to -1. See Specifying Sample Time in the Simulink documentation for more information.

The Signal Attributes pane of the Prelookup block dialog appears as follows:

Index data type

Specify how the data type of the index is designated. You can choose a built-in integer data type from the list, or you can specify an integer data type using a fixed-point representation. The data type that you specify must be capable of indexing all elements in the Breakpoint data parameter.

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Index data type parameter.

See Using the Data Type Assistant for more information.

Fraction data type

Specify how the data type of the interval fraction is designated. You can choose a built-in data type from the list, specify that the data type is inherited through an internal rule, or specify a fixed-point data type using either the [Slope Bias] or the binary-point-only scaling representation. If using the [Slope Bias] representation, the scaling must be trivial — i.e., the slope is 1 and the bias is 0. If using the binary-point-only representation, the fixed power-of-two exponent must be less than or equal to zero.

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Fraction data type parameter.

See Using the Data Type Assistant for more information.

Lock output scaling against changes by the autoscaling tool

Select to lock scaling of outputs. This parameter is visible only if you enter an expression for the Fraction data type parameter.

Round integer calculations toward

Select the rounding mode for fixed-point operations. For more information, see Rounding in the Simulink Fixed Point User's Guide.

Block parameters such as Breakpoint data are always rounded to the nearest representable value. To control the rounding of a block parameter, enter an expression using a MATLAB rounding function into the mask field.

Characteristics

Direct Feedthrough

Yes

Sample Time

Specified in the Sample time parameter

Scalar Expansion

Yes

Dimensionalized

Yes

Zero Crossing

No

See Also

Interpolation Using Prelookup

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS