Approximate one-dimensional function using specified lookup method
Simscape / Foundation Library / Physical Signals / Lookup Tables
The PS Lookup Table (1D) block computes an
approximation to some function
f=f(x) given data vectors
f. Both the input and the output are
The length of the
f data vectors provided
to this block must match. Also, the
x data vector must be strictly
monotonic, either increasing or decreasing.
You define the lookup table by specifying the Table grid vector
parameter as a 1-by-
n vector (
x data vector) and
the Table values parameter as a 1-by-
f data vector). The block generates output based on the input
values using the selected interpolation and extrapolation methods. You have a choice of
two interpolation methods and two extrapolation methods. You also have an option for the
block to issue an error if the input signal value is outside the table grid vector
Plotting a lookup table lets you visualize the data before simulating the model, to make sure that the table is correct. The plot reflects tabulated data specified for the block, as well as the selected interpolation and extrapolation options.
To plot the data, right-click the block in your model and, from the context menu, select Foundation Library > Plot Table. For more information, see Plot Lookup Tables.
x— Input value along the x-axis, unitless
Input value along the x-axis.
f— Output function value, unitless
Output function value, based on applying the lookup table to the input value.
Table grid vector— Vector of input values along the x-axis
Specify the vector of input values as a one-dimensional array. The input values vector must be strictly monotonic, either increasing or decreasing. The values can be nonuniformly spaced. For smooth interpolation, the vector must contain at least three values. For linear interpolation, two values are sufficient.
Table values— Vector of output values along the f-axis
Specify the vector of output values as a one-dimensional array. The output values vector must be of the same size as the input values vector.
Interpolation method— Select the interpolation method
Select one of the following interpolation methods for approximating the output value when the input value is between two consecutive grid points:
Linear — Uses a linear function.
Select this option to get the best performance.
Smooth — Uses a modified Akima
interpolation algorithm. For details, see
tablelookup. Select this option to produce a
continuous curve with continuous first-order derivatives.
Extrapolation method— Select the extrapolation method
Select one of the following extrapolation methods for determining the output value when the input value is outside the range specified in the argument list:
Linear — Extends from the edge
of the interpolation region linearly. The slope of the linear
extrapolation is equal to the slope of the interpolated curve at the
edge of the interpolation region.
Nearest — Extends from the edge
of the interpolation region as a constant. The value of the nearest
extrapolation is equal to the value of the interpolated curve at the
edge of the interpolation region. Select this option to produce an
extrapolation that does not go above the highest point in the data
or below the lowest point in the data.
Error — Issues an error if the
input signal is outside the range of the table. Select this option
to avoid going into the extrapolation mode when you want your data
to be within the table range.