主要内容

Guidelines for Choosing a Lookup Table

Data Set Dimensionality

In some cases, the dimensions of your data set dictate which of the lookup table blocks is right for your application. If you are approximating a one-dimensional function, consider using either the1-D Lookup Table或者Lookup Table Dynamic堵塞。If you are approximating a two-dimensional function, consider the2-D Lookup Table堵塞。Blocks such as then-D Lookup TableDirect Lookup Table (n-D)allow you to approximate a function ofNvariables.

Data Set Numeric and Data Types

数据集的数字和数据类型会影响哪个查找表块最合适的决定。尽管所有查找表块都支持实数,但金宝appDirect Lookup Table (n-D),1-D Lookup Table,2-D Lookup Table, 和n-D Lookup Tableblocks also support complex table data. All lookup table blocks support integer and fixed-point data in addition todoublesingledata types.

Note

对于直接查找表(N-D)块,支持表数据,输出端口和可选表输入端口的固定点类型。金宝app

数据准确性和平滑度

The desired accuracy and smoothness of the data returned by a lookup table determine which of the blocks you should use. Most blocks provide options to perform interpolation and extrapolation, improving the accuracy of values that fall between or outside of the table data, respectively. For instance, theLookup Table Dynamicblock performs linear interpolation and extrapolation, while then-D Lookup Tableblock performs either linear, cubic spline interpolation and extrapolation, or Akima spline interpolation and extrapolation. In contrast, theDirect Lookup Table (n-D)block performs table lookups without any interpolation or extrapolation. You can achieve a mix of interpolation and extrapolation methods by using thePrelookupInterpolation Using Prelookup堵塞。

Dynamics of Table Inputs

The dynamics of the lookup table inputs impact which of the lookup table blocks is ideal for your application. The blocks use a variety of index search methods to relate the lookup table inputs to the table's breakpoint data sets. Most of the lookup table blocks offer a binary search algorithm, which performs well if the inputs change significantly from one time step to the next. The1-D Lookup Table,2-D Lookup Table,n-D Lookup Table, 和Prelookupblocks offer a linear search algorithm. Using this algorithm with the option that resumes searching from the previous result performs well if the inputs change slowly. Some lookup table blocks also provide a search algorithm that works best for breakpoint data sets composed of evenly spaced breakpoints. You can achieve a mix of index search methods by using thePrelookupInterpolation Using Prelookup堵塞。

Efficiency of Performance

When the efficiency with which lookup tables operate is important, consider using thePrelookupInterpolation Using Prelookup堵塞。这些块将表查找过程分为两个组件 - 将输入与表数据相关联的索引搜索,然后是计算输出的插值和外推阶段。这些块使您可以执行单个索引搜索,然后重用结果以在多个表中查找数据。另外,Interpolation Using Prelookup块可以执行子桌选择,其中块插值表的一部分而不是整个表。例如,如果您的3-D表数据构成要插值的2D表的堆栈,则可以指定选择端口输入以从堆栈中选择一个或多个2-D表以进行插值。完整的3-D插值具有7个子插值,但2D插值仅需要3个子接口。结果,当将表的某些维度用于数据堆叠而不是用于插值时,可以进行显着提高速度。这些功能使桌子查找操作更有效,减少了计算工作和仿真时间。

查找表块特征的摘要

Use the following table to identify features that correspond to particular lookup table blocks, then select the block that best meets your requirements.

Feature 1-D Lookup Table 2-D Lookup Table Lookup Table Dynamic n-D Lookup Table Direct Lookup Table (n-D) Prelookup Interpolation Using Prelookup
Interpolation Methods
平坦的
Nearest
Linear
线性点斜率
Linear Lagrange
Cubic spline
Akima样条
Extrapolation Methods
Clip
Linear
Cubic spline
Akima样条
Numeric & Data Type Support
Complex
Double, Single
Integer
Fixed point
Index Search Methods
Binary
Linear
Evenly spaced points
Start at previous index
Miscellaneous
Sub-table selection
Dynamic breakpoint data
Dynamic table data
输入范围检查

相关话题