Engee 文档

1-D Lookup Table

近似一维函数

类型: LookupTableND

图书馆中的路径:

/Basic/Lookup Tables/1-D Lookup Table

说明

程序块 1-D Lookup Table 计算某个函数的近似值:

,

其中函数 可以是经验值。

图块图标 1-D Lookup Table 显示块中定义的函数的图形。

程序块使用内插法和外推法将输入数据映射到输出值表中。

程序块支持以下插值方法: Flat, Linear point-slope, Linear Lagrange, Nearest, Cubic spline`и `Akima spline.

有关插值法的更多信息,请点击此处:函数值近似方法

设置参考点和输出值表

这些程序块参数用于设置参考点和输出值表的值。

块参数 Назначение

Breakpoints 1

设置参考点向量。

Table data

定义相应的输出值集。

程序块如何生成输出数据

程序块 1-D Lookup Table 是如何生成输出数据的?

程序块输入数据 程序块行为 1-D Lookup Table

匹配参考点数据集中的值

输出表格值

与锚点数据集中的值不匹配,但在范围内。

使用所选值内插相应的表格值 Interpolation method

与参考点数据集中的值不匹配,且超出范围

使用所选值外推输出值 Extrapolation method

端口

输入

# IN_1 — 输入信号
标量 | 向量 | 矩阵

Details

输入信号 ,通过从数值表中搜索或插值,与输出值匹配。

数据类型

Float16, Float32, Float64, Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128, Fixed-point, Bool

复数支持

输出

# OUT_1 — 通过搜索或评估表值计算得出的输出信号
标量 | 向量 | 矩阵

Details

根据输入值查找或评估表值计算出的输出。

当程序块的输入数据为 则程序块 1-D Lookup Table …​

匹配参考点数据集中的值

输出表格值

与锚点数据集中的值不匹配,但在范围内

使用选定值对相应的表格值进行内插。 Interpolation method

与锚点数据集中的值不匹配,且超出范围

使用所选值外推输出值。 Extrapolation method

数据类型

Float16、Float32、Float64、Int8、Int16、Int32、Int64、Int128、UInt8、UInt16、UInt32、UInt64、UInt128、Fixed-point、Bool。

复数支持

参数

主机

# Table data — 输出值表
Array of real and/or complex numbers

Details

输出值表

默认值

tanh.(collect(-5:5))

程序使用名称

Table

可调谐

可计算

# Breakpoints 1 — 第一次测量的参考点值
Array of real numbers

Details

第一次测量的参考点。

默认值

collect(-5:5)

程序使用名称

BreakpointsForDimension1

可调谐

可计算

查询方法

# Interpolation method — 参考点数值之间的内插法
Flat | Nearest | Linear point-slope | Linear Lagrange | Cubic spline | Akima spline

Details

当输入信号介于参考点值之间时,设备会使用邻近点对输出值进行内插。

点击此处了解更多插值方法:函数值近似方法

依赖关系

  • 如果选择 `Cubic spline`则区块只支持标量信号。其他插值方法支持非标量信号。

  • 如果选择 Akima spline,外推法只能是 Akima spline.

Flat | Nearest | Linear point-slope | Linear Lagrange | Cubic spline | Akima spline

默认值

Linear point-slope

程序使用名称

InterpMethod

可调谐

可计算

# Extrapolation method — 处理超出参考点数据集范围的输入值的方法
Clip | Linear | Cubic spline | Akima spline

Details

选择外推法。

点击此处了解有关外推法的更多信息:函数值近似方法

依赖关系

  • 要选择 `Cubic spline`外推法*,还必须选择 `Cubic spline`内插法*。

  • 要选择 `Akima spline`外推法*,还必须选择 `Akima spline`内插法*。

Clip | Linear | Cubic spline | Akima spline

默认值

Linear

程序使用名称

ExtrapMethod

可调谐

可计算

数据类型

# Table data — 表值数据类型
Inherit: auto | Same as output | Float64 | Float32 | Float16 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point

Details

指定表值的数据类型。

Inherit: auto | Same as output | Float64 | Float32 | Float16 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point

默认值

Same as output

程序使用名称

TableDataTypeStr

可调谐

可计算

# Table fixed-point type — 表格的定点数据类型
Data type

Details

指定表格的定点数据类型。

依赖关系

要使用此参数,请设置参数 Table dataFixed-point.

默认值

fixdt(1, 16, 0)

程序使用名称

TableDataTypeStrFixed

可调谐

可计算

# Breakpoints 1 — 第一次测量参考点数值的数据类型
Inherit: auto | Same as input | Float64 | Float32 | Float16 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point

Details

为第一次测量的参考点值指定数据类型

Inherit: auto | Same as input | Float64 | Float32 | Float16 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point

默认值

Same as input

程序使用名称

BreakpointsForDimension1DataTypeStr

可调谐

可计算

# Breakpoints 1 fixed-point type — 第一次测量参考点值的定点数据类型
Data type

Details

为第一次测量的参考点值指定定点数据类型。

依赖关系

要使用此选项,请设置参数 Breakpoints 1Fixed-point.

默认值

fixdt(1, 16, 0)

程序使用名称

BreakpointsForDimension1DataTypeStrFixed

可调谐

可计算

# Fraction — 分数数据类型
Inherit: auto | Float64 | Float32 | Fixed-point

Details

指定分数的数据类型。

Inherit: auto | Float64 | Float32 | Fixed-point

默认值

Inherit: auto

程序使用名称

FractionDataTypeStr

可调谐

可计算

# Fraction fixed-point type — 定点分数数据类型
Data type

Details

指定定点分数数据类型。

依赖关系

要使用该参数,请设置参数 FractionFixed-point.

默认值

fixdt(1, 16, 0)

程序使用名称

FractionDataTypeStrFixed

可调谐

可计算

# Intermediate results — 中间结果数据类型
Inherit: auto | Same as output | Float64 | Float32 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point

Details

指定中间结果的数据类型。

Inherit: auto | Same as output | Float64 | Float32 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point

默认值

Same as output

程序使用名称

IntermediateResultsDataTypeStr

可调谐

可计算

# Intermediate results fixed-point type — 中间结果的定点数据类型
Data type

Details

指定中间结果的定点数据类型。

依赖关系

要使用此参数,请设置参数 Intermediate resultsFixed-point.

默认值

fixdt(1, 16, 0)

程序使用名称

IntermediateResultsDataTypeStrFixed

可调谐

可计算

# Output — 输出数据类型
Inherit from `Table data` | Same as input | Float64 | Float32 | Float16 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point

Details

指定输出数据类型。

Inherit from `Table data` | Same as input | Float64 | Float32 | Float16 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point

默认值

Same as input

程序使用名称

OutDataTypeStr

可调谐

可计算

# Output fixed-point type — 定点输出数据类型
Data type

Details

指定定点输出类型。

依赖关系

要使用此参数,请将参数设置为 OutputFixed-point.

默认值

fixdt(1, 16, 0)

程序使用名称

OutDataTypeStrFixed

可调谐

可计算

# Integer rounding mode — 定点操作的四舍五入模式
Ceiling | Convergent | Floor | Nearest | Round | Zero

Details

选择定点运算的舍入模式。您可以选择

  • Floor- 将正数和负数向下舍入(向负无穷)。

  • Ceiling- 将正数和负数向上舍入(向正无穷舍入)。

  • Convergent- 将数字四舍五入到最接近的可表示值。如果一个数字的小数部分以 5 结尾,则该数字四舍五入为最接近的偶数整数。

  • Nearest- 将数字舍入到最接近的可表示值。如果数字的小数部分以 5 结尾,则数字向上舍入(向正无穷)。

  • Round- 将数字四舍五入到最接近的可表示值。如果数字的小数部分以 5 结尾,正数向上舍入(向正无穷),负数向下舍入(向负无穷)。

  • Zero- 将数字向 0 舍入。

程序块参数总是四舍五入到最接近的可表示值。

Ceiling | Convergent | Floor | Nearest | Round | Zero

默认值

Floor

程序使用名称

RndMeth

可调谐

可计算

# Saturate on integer overflow — 溢出动作方法
Logical

Details

选中时,饱和将应用于所有内部块操作,而不仅仅是输出或结果。

操作a 执行此操作的原因a 溢出时会发生什么情况 示例

选中此复选框。a

模型中可能存在溢出,需要在生成的代码中提供显式饱和保护。

溢出将饱和到该数据类型可表示的最小值或最大值。a

与有符号 8 位整数相关的溢出可能饱和到 -128127

请勿选择此复选框。

您希望优化生成代码的效率。
您希望避免过度指定程序块如何处理超出范围的信号。

溢出会被包裹在一个可以用数据类型表示的适当值中。a

数字 130 不适合带符号的 8 位整数,因此被折叠为 -126

默认值

false (关掉)

程序使用名称

SaturateOnIntegerOverflow

可调谐

可计算

附加选项

C 代码生成: 是