The
FixPt Look-Up Table (2-D) block is a masked S-function that computes an
approximation to some function z=f(x,y) given x, y,
z data points. The look-up method can use interpolation, extrapolation,
or the original values of the inputs. Also, the x and y data vectors
must be monotonically increasing. (see 1-D case)The
Row parameter is a 1 × m vector of x data
points, the Col parameter is a 1 × n vector of y
data points, and the Table parameter is an m × n
matrix of z data points. Both the row and column vectors must
be strictly monotonically increasing.
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.
-
If the inputs match row and column parameter values, the output is the
value at the intersection of the row and column.
-
If the inputs do not match row and column parameter values, then the block
generates output by linearly interpolating between the appropriate row
and column values. If either or both block inputs are less than the first
or greater than the last row or column values, the block extrapolates from
the first two or last two points.
-
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 elements in x and
y nearest the current inputs are found. The corresponding element
in z is then used as the output.
-
Use Input Below -- This method does
not interpolate or extrapolate. Instead, the elements in x and
y nearest and below the current inputs are found. The corresponding
element in z is then used as the output.If there are no elements
in x or y below the current inputs, then the nearest
elements are found.
-
Use Input Above -- This method does not interpolate or extrapolate.
Instead, the elements in x and y nearest and above the
current inputs are found. The corresponding element in z is then
used as the output. If there are no elements in x or y
above the current inputs, then the nearest elements are found.
For a description of all other parameters, refer
to "Block Parameters".The
block icon displays m graphs based on the contents of the Table
parameter. When a parameter is changed on the block's dialog box, the graphs
are automatically redrawn when you press the Apply or OK
button. For a description of how the block icon displays the output data
type, refer to "Block Icon Display".
Note:
To avoid parameter saturation errors, the automatic
scaling script autofixexp employs a special rule for the FixPt
Look-Up Table (2D) 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. For this block, the look-up values are given by the
Table parameter (the TableDataPoints variable).
Parameters and Dialog Box
-
Row
-
Input row vector. It must be strictly monotonically increasing.
-
Col
-
Input column vector. It must be strictly monotonically increasing.
-
Table
-
Output vector. It must match the size defined by the Row and Col
parameters.
-
Method
-
Look-up method.
-
Output data type
-
Any data type supported by the Fixed-Point Blockset.
-
Output scaling
-
Radix point-only or slope/bias scaling. These scaling modes are only available
for generalized fixed-point data types.
-
Lock output scaling
-
If checked, Output scaling is locked. This feature is only available
for generalized fixed-point output.
-
Round toward
-
Rounding mode for the fixed-point output.
-
Saturate to max or min when overflows occur
-
If checked, fixed-point overflows saturate. Otherwise, they wrap.
-
Override with doubles
-
If checked, the Output data type is overridden with doubles.
-
Log minimums and maximums
-
If checked, minimum and maximum simulation values are logged to the workspace.
Conversions
The Row parameter is converted from doubles
to the first input's data type. The Column parameter is converted
from doubles to the second input's data type. The Table parameter
is converted from doubles to the output data type. All conversion are performed
offline using round-to-nearest and saturation. Refer to "Parameter Conversions"
in the manual for more information about parameter conversions.
Characteristics
| Input Ports |
Any data type supported by the blockset |
| Output Port |
Any data type supported by the blockset |
| Direct Feedthrough |
Yes |
| Sample Time |
Inherited |
| Scalar Expansion |
Of one input if the other is a vector |
| States |
0 |
| Vectorized |
Yes |
Example
This example illustrates the look-up methods supported
by the FixPt Look-Up Table (2D) block.Suppose you
have input row and column vectors given by [1:3] and a look-up
table given by [4 5 6; 16 19 20; 10 18 23]. Using the model
shown below,
these results were generated.
| Look-Up Method |
Input [x y] |
Output |
Comment |
Interpolation-Extrapolation
|
[1.6 2.5] |
13.9 |
N/A |
| [1.6 4.0] |
15.4 |
N/A |
Interpolation-Use End Values
|
[1.6 2.5] |
13.9 |
N/A |
| [1.6 4.0] |
14.4 |
The value for [1.6 3] was used. |
| Use Input Nearest |
[1.6 2.3] |
19 |
The value for [2 2] was used. |
Use Input Below
|
[1.6 2.3] |
5 |
The value for [1 2] was used. |
| [1.6 0.5] |
4 |
The value for [1 1] was used. |
Use Input Above
|
[1.6 2.3] |
20 |
The value for [2 3] was used. |
| [1.6 3.5] |
20 |
The value for [2 3] was used. |
[ Previous | Help
Desk | Next ]