Fixed-Point Blockset | ![]() ![]() |
Approximate a one-dimensional function using a selected look-up method
Description
The FixPt Look-Up Table block is a masked S-function that computes an approximation to some function y=f(x)
given x
, y
data vectors. The look-up method can use interpolation, extrapolation, or the original values of the input.
The length of the x
and y
data vectors provided to this block must match. Also, the x
data vector must be strictly monotonically increasing after conversion to the input's fixed-point data type. Note that due to quantization, the x
data vector may be strictly monotonic in doubles format, but not so after conversion to a fixed-point data type. To map two inputs to an output, use the FixPt Look-Up Table (2D) block.
You define the table by specifying the Vector of input values parameter as a 1-by-n vector and the Vector of output values parameter as a 1-by-n vector. The block generates output based on the input values using one of these methods selected from the Method parameter list:
Interpolation-Extrapolation
- This is the default method; it performs linear interpolation and extrapolation of the inputs.Interpolation-Use End Values
- This method performs linear interpolation as described above but does not extrapolate outside the end points of the input vector. Instead, the end-point values are used.Use Input Nearest
- This method does not interpolate or extrapolate. Instead, the element in x
nearest the current input is found. The corresponding element in y
is then used as the output.Use Input Below
- This method does not interpolate or extrapolate. Instead, the element in x
nearest and below the current input is found. The corresponding element in y
is then used as the output. If there is no element in x
below the current input, then the nearest element is found.Use Input Above
- This method does not interpolate or extrapolate. Instead, the element in x
nearest and above the current input is found. The corresponding element in y
is then used as the output. If there is no element in x
above the current input, then the nearest element is found.For a detailed description of all other block parameters, refer to Block Parameters.
Remarks
To avoid parameter saturation errors, the automatic scaling script autofixexp
employs a special rule for the FixPt Look-Up Table block. autofixexp
modifies the scaling by using the output look-up values in addition to the logged minimum and maximum simulation values. This prevents the data from being saturated to different values. The look-up values are given by the Vector of output values parameter (the YDataPoints
variable).
Parameters and Dialog Box
Conversions
The Vector of input values parameter is converted from doubles to the input data type. The Vector of output values parameter is converted from doubles to the output data type. Both conversion are performed offline using round-to-nearest and saturation. Refer to Parameter Conversions for more information about parameter conversions.
Example
Suppose the FixPt Look-Up Table block is configured to use a vector of input values given by [-5:5]
, and a vector of output values given by sinh([-5:5])
. Using the model shown below,
the following results were generated.
Characteristics
Input Port(s) |
Any data type supported by the blockset |
Output Port |
Any data type supported by the blockset |
Direct Feedthrough |
Yes |
Sample Time |
Inherited |
Scalar Expansion |
No |
States |
0 |
Vectorized |
Yes |
![]() | FixPt Logical Operator | FixPt Look-Up Table (2D) | ![]() |