FixPt Look-Up Table (2D)

Approximate a two-dimensional function using a selected look-up method.

Description

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 strictly monotonically increasing as described in the FixPt Look-Up Table reference pages.

The Row parameter is a 1-by-m vector of x data points, the Col parameter is a 1-by-n vector of y data points, and the Table parameter is an m-by-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 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 (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. 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.

  • Look-up method - Look-up method.

  • Output data type and scaling - Specify the output data type and scaling via the dialog box, or inherit the data type and scaling by back propagation.

  • 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 available only for generalized fixed-point data types.

  • Lock output scaling so autoscaling tool can't change it. - If checked, Output scaling is locked. This feature is available only 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 data type(s) 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 for more information about parameter conversions.

Example

Suppose the FixPt Look-Up Table (2D) block is configured to use 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,
the following 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.

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

Â