matlab prelookup,Using the Prelookup and Interpolation Blocks

Introduction

This model uses Prelookup and Interpolation Using Prelookup blocks. The Prelookup block minimizes the number of index searches performed across a set of lookup tables. It also mixes clipping, extrapolation, and index search algorithms within one table calculation. Note how the Prelookup blocks perform the index search portion of the computation and the Interpolation Using Prelookup blocks perform the rest:

9984590e4498f2d62580b4ce358cfcac.png

These blocks are in the Simulink® block library in the Lookup Tables sublibrary:

54cefe18f112136dd1a95e417610233d.png

Optimization: PreLookup and Interpolation Using Prelookup Blocks

Consider using PreLookup block for tables with intensive index searches in breakpoint sets. The Prelookup blocks allow you to perform an index search once and reuse the result in many table lookups. In this model, three index search results are used in five blocks in a total of ten uses. Equivalent regular lookup tables such as the example to the right would have required ten index searches instead of three.

1fb8ad56b9fff3d4fcc8ceb91ae726c4.png

Optimization: Subtable Selection Option in the Interpolation Using Prelookup Blocks

One of the interpolation blocks in this model is configured using a capability: trailing dimensions of an n-D table can be marked as "selection dimensions", meaning that the input for that dimension is an integer used only to make a subtable selection, such as picking a 2-D plane from a 3-D table. The subtable is then interpolated normally.

Interpolation of subtables can save tremendous amounts of computation. For every dimension eliminated from interpolation, the computation almost halves. Since an N-dimensional interpolation takes (2^N)-1 individual interpolation operations (y = ylow + f*(yhigh-ylow)), just one dimension of selection can almost double the speed of the interpolation. Extreme example: a 5-D table with three dimensions of subtable selection and 2-D interpolation: 5-D interpolation would take 2^5-1 = 31 interpolations, but a 2-D interpolation takes only 2^2 - 1 = 3.

The selection ports support vectorization to allow multiple subtable selection/interpolations in a single block.

3f5a56e0d8fd79e285976db98bc310e9.png

The subtable or multitable mode of operation is activated by setting a positive integer for the 'Number of sub-table selections dimensions' parameter in the block parameter dialog. The number you set is interpreted as the number of dimensions to select from the highest dimensions. For example, if you have a 3-D table and choose 2, that means the first dimension will be interpolated and dimensions 2 and 3 will be selected:

NOTE: You can remove highlighting from a model using the View/Remove highlighting menu item or this command:

set_param(mdl,'HiliteAncestors','none')

Breakpoint and Table Data Consistency Checking

Using Prelookup and Interpolation Using Prelookup blocks introduces a need to ensure that the length of the 'Breakpoint data' parameter in the Prelookup blocks matches the corresponding dimension of the 'Table data' parameter in the connected Interpolation Using Prelookup blocks. Simulink® always checks the consistency between the two blocks when updating the block diagram. Simulink reports errors if it encounters inconsistent breakpoint and table data. For example:

try

evalc(['sim(', mdl, ')']);

catch E

disp(['Error:', E.message]);

end

Error:The range of values for input port k2 of block 'sldemo_bpcheck/Interpolation on an 11x11 table ERROR IN DIM 2 ' does not match the size of the corresponding table dimension of 11. Specify a different table dimension or modify the range of values for input port k2.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值