Approximate one-dimensional function
AUTOSAR Blockset / Classic Platform / Library Routines / Interpolation
The Curve block performs one-dimensional interpolated table lookup, including index searches. The table is a sampled representation of a function. Breakpoint sets relate the input values to positions in the table. You can also use the Prelookup and Prelookup Using Curve blocks together to perform the same operations as this block.
If you select the AUTOSAR 4.0 code replacement library (CRL) for your AUTOSAR model, code generated from this block is replaced with the AUTOSAR library routine that you configure in the block parameters dialog box.
u1
— First-dimension inputsReal-valued inputs to the u1 port, mapped to an output value by looking up or interpolating the table of values that you define.
Example: 0:10
Data Types: single
| double
| int8
| int16
| int32
| uint8
| uint16
| uint32
| fixed point
Port_1
— Output computed by looking up or estimating table valuesOutput generated by looking up or estimating table values based on the input values. If the inputs match the index values of breakpoint sets the curve block provides a table value as output. If the block inputs do not match index values in breakpoint sets, but are within range, the block performs the interpolation method you selected and provides an estimated value from the table values as output.
Data Types: single
| double
| int8
| int16
| int32
| uint8
| uint16
| uint32
| fixed point
Targeted Routine Library
— Indicates the AUTOSAR routine library used for block code replacement If you select the AUTOSAR 4.0 code replacement library (CRL) for your model, code generated from this block is replaced from the selected AUTOSAR routine library. This parameter enables you to choose either fixed-point (IFX) or floating-point (IFL) code replacement and validation checks.
Targeted Routine
— AUTOSAR library routine used for code replacementIfx_IntIpoMap
(default)This parameter reflects the name of the AUTOSAR code replacement library (CRL) routine used to replace the code generated by this block. The naming convention includes the targeted routine library, interpolation method, and block type. This parameter is reference-only and must not be edited.
Data specification
— Method of table and breakpoint specificationTable and breakpoints
(default) | Lookup table object
From the list, select:
Table and breakpoints
— Specify the table
data and breakpoints. Selecting this option enables these parameters:
Table data
Breakpoints specification
Breakpoints
Edit table and breakpoints
Lookup table object
— Use an existing lookup
table (Simulink.LookupTable
) object. Selecting
this option enables the Name field and the Edit
table and breakpoints button.
Block Parameter:
DataSpecification |
Type: character vector |
Values:
'Table and breakpoints' | 'Lookup table object' |
Default:
'Table and breakpoints' |
Name
— Name of the lookup table object[]
(default) | Simulink.LookupTable
objectEnter the name of the lookup table (Simulink.LookupTable
) object.
To enable this parameter, set Data specification to
Lookup table object
.
Block Parameter:
LookupTableObject |
Type: character vector |
Values: name of a
Simulink.LookupTable object |
Default:
'' |
Table data
— Define the table of output values[1 2 4]
(default) | character vectorEnter the table of output values.
During simulation, the matrix must be one-dimensional. However, during block
diagram editing, you can enter an empty matrix (specified as []
) or
an undefined workspace variable. This technique lets you postpone specifying a
correctly dimensioned matrix for the table data and continue editing the block
diagram.
To enable this parameter, set Data specification to
Table and breakpoints
.
Block Parameter:
Table |
Type: character vector |
Values: matrix of table values |
Default:
'[1 2 4]' |
Breakpoints specification
— Method of breakpoint specificationExplicit values
(default) | Even spacing
Specify whether to enter data as explicit breakpoints or as parameters that generate evenly spaced breakpoints.
To explicitly specify breakpoint data, set this parameter to
Explicit values
and enter breakpoint data in the text
box next to the Breakpoints parameters.
To specify parameters that generate evenly spaced breakpoints, set this
parameter to Even spacing
and enter values for the
First point and Spacing parameters for
each dimension of breakpoint data. The block calculates the number of points to
generate from the table data.
To enable this parameter, set Data specification to
Table and breakpoints
.
Block Parameter:
BreakpointsSpecification |
Type: character vector |
Values:
'Explicit values' | 'Even spacing' |
Default:
'Explicit values' |
Breakpoints
— Explicit breakpoint values, or first point and spacing of breakpoints[10,22,31]
(default) | 1-by-n or n-by-1 vector of monotonically increasing valuesSpecify the breakpoint data explicitly or as evenly-spaced breakpoints, based on the value of the Breakpoints specification parameter.
If you set Breakpoints specification to
Explicit values
, enter the breakpoint set that
corresponds to each dimension of table data in each
Breakpoints row. For each dimension, specify breakpoints as
a 1-by-n or n-by-1 vector whose values are strictly monotonically
increasing.
If you set Breakpoints specification to Even
spacing
, enter the parameters First point and
Spacing in each Breakpoints row to
generate evenly-spaced breakpoints in the respective dimension. Your table data
determines the number of evenly spaced points.
To enable this parameter, set Data specification to
Table and breakpoints
.
Block Parameter:
BreakpointsForDimension1 |
Type: character vector |
Values: 1-by-n or n-by-1 vector of monotonically increasing values |
Default:
'[10, 22, 31]' |
First point
— First point in evenly spaced breakpoint data1
(default) | scalarSpecify the first point in your evenly spaced breakpoint data as a real-valued,
finite, or scalar. This parameter is available when you set the Breakpoints
specification to Even spacing
.
To enable this parameter, set Data specification to
Table and breakpoints
and Breakpoints
specification to Even spacing
.
Block Parameter:
BreakpointsForDimension1FirstPoint |
Type: character vector |
Values: real-valued, finite, scalar |
Default:
'1' |
Spacing
— Spacing between evenly spaced breakpoints1
(default) | scalarSpecify the spacing between points in your evenly-spaced breakpoint data.
To enable this parameter, set Data specification to
Table and breakpoints
and Breakpoints
specification to Even spacing
.
Block Parameter:
BreakpointsForDimension1Spacing |
Type: character vector |
Values: positive, real-valued, finite, scalar |
Default:
'1' |
Edit table and breakpoints
— Launch Lookup Table Editor dialog boxClick this button to open the Lookup Table Editor. You can then edit the object and save the new values for the object. For more information, see Edit Lookup Tables in the Simulink ® documentation.
Index search method
— Method of calculating table indicesLinear search
(default) | Evenly spaced points
| Binary search
Select Evenly spaced points
, Linear search
,
or Binary search
. Each search method has speed advantages in
different circumstances:
For evenly spaced breakpoint sets (for example, 10, 20, 30, and so on), you
achieve optimal speed by selecting Evenly spaced points
to
calculate table indices. This algorithm uses only the first two breakpoints of a
set to determine the offset and spacing of the remaining points.
Note
When using the Simulink.LookupTable
object to specify table
data and the Breakpoints Specification parameter of the
referenced Simulink.LookupTable
object is set to
Even spacing
, set the Index search
method to Evenly spaced points
.
For unevenly spaced breakpoint sets, follow these guidelines:
If input signals do not vary significantly between time steps, selecting
Linear search
with Begin index search using
previous index result produces the best performance.
If input signals jump more than one or two table intervals per time step,
selecting Binary search
produces the best
performance.
A suboptimal choice of an index search method can lead to slow performance of models that rely heavily on lookup tables.
The generated code stores only the first breakpoint, the spacing, and the number of breakpoints when:
The breakpoint data is not tunable.
The index search method is Evenly spaced points
.
Block Parameter:
IndexSearchMethod |
Type: character vector |
Values:
'Binary search' | 'Evenly spaced points' | 'Linear
search' |
Default:
'Linear search' |
Begin index search using previous index result
— Start using the index from the previous time stepoff
(default) | on
Select this check box when you want the block to start its search using the index found at the previous time step. For inputs that change slowly with respect to the interval size, enabling this option can improve performance. Otherwise, the linear search and binary search methods can take longer, especially for large breakpoint sets.
To enable this parameter, set Index search method to
Linear search
or Binary
search
.
Block Parameter:
BeginIndexSearchUsing PreviousIndexResult |
Type: character vector |
Values:
'off' | 'on' |
Default:
'off' |
Interpolation method
— Method of interpolation between breakpoint valuesLinear point-slope
(default) | Flat
When an input falls between breakpoint values, the block interpolates the output value by using neighboring breakpoints. For more information, see Interpolation Methods.
Block Parameter:
InterpMethod |
Type: character vector |
Values:
'Linear point-slope' | 'Flat' |
Default:
'Linear point-slope' |
Integer rounding mode
— Rounding mode for fixed-point operationsRound
(default) | Zero
Specify the rounding mode for fixed-point or floating-point lookup table calculations that occur during simulation or execution of code generated from the model.
This option does not affect rounding of block parameter values. Simulink rounds such values to the nearest representable integer value. To control the rounding of a block parameter, enter an expression using a MATLAB™ rounding function into the edit field on the block dialog box.
Block Parameter:
RndMeth |
Type: character vector |
Values:
'Round' | 'Zero' |
Default:
'Round' |
Table data
— Data type of table dataInherit: Same as output
(default) | double
| single
| int8
| uint8
| int16
| uint16
| int32
| uint32
| fixdt(1,16)
| fixdt(1,16,0)
| fixdt(1,16,2^0,0)
| <data type expression>
Specify the table data type. The block validates that the selected types are compatible with the specification of the targeted routine. You can set the table data type to:
A rule that inherits a data type, for example, Inherit: Same as
output
The name of a built-in data type, for example,
single
The name of a data type object, for example, a
Simulink.NumericType
object
An expression that evaluates to a data type, for example,
fixdt(1,16,0)
Click the Show data type
assistant button to display the Data Type
Assistant, which helps you set the data type attributes. For more
information, see Specify Data Types Using Data Type Assistant.
Tip
Specify a table data type different from the output data type in these cases:
Lower memory requirement for storing table data that uses a smaller type than the output signal.
Sharing of prescaled table data between two Map blocks that have different output data types.
Sharing of custom storage table data in the generated code for blocks that have different output data types.
Block Parameter:
TableDataTypeStr |
Type: character vector |
Values:
'Inherit: Inherit from 'Table data'' | 'Inherit: Same as output' |
'double' | 'single' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32'
| 'fixdt(1,16)' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)'|'<data type
expression>' |
Default:
'Inherit: Same as output' |
Breakpoints
— Breakpoint data typeInherit: Same as corresponding input
(default) | double
| single
| int8
| uint8
| int16
| uint16
| int32
| uint32
| fixdt(1,16)
| fixdt(1,16,0)
| fixdt(1,16,2^0,0)
| Enum: <class name>
| <data type expression>
Specify the data type for a set of breakpoint data. You can set the breakpoint data type to:
A rule that inherits a data type, for example, Inherit: Same as
corresponding input
The name of a built-in data type, for example,
single
The name of a data type class, for example, an enumerated data type class
The name of a data type object, for example, a
Simulink.NumericType
object
An expression that evaluates to a data type, for example,
fixdt(1,16,0)
A limitation for using enumerated data with this block is that it does not support out-of-range input for enumerated date. When specifying enumerated data, include the entire enumeration set in the breakpoint data set.
Click the Show data type
assistant button to display the Data Type
Assistant, which helps you set the data type attributes. For more
information, see Specify Data Types Using Data Type Assistant.
Block Parameter:
BreakpointsForDimension1DataTypeStr |
BreakpointsForDimension2DataTypeStr |
Type: character vector |
Values:
'Inherit: Same as corresponding input' | 'Inherit: Inherit from
'Breakpoint data'' | 'double' | 'single' | 'int8' | 'uint8' | 'int16' | 'uint16'
| 'int32' | 'uint32' | 'fixdt(1,16)' | 'fixdt(1,16,0)' |
'fixdt(1,16,2^0,0)'|'<data type expression>' |
Default:
'Inherit: Same as corresponding input' |
Curve Using Prelookup | Map | Map Using Prelookup | Prelookup