Look-up table with changing table

21 ビュー (過去 30 日間)
Virginia
Virginia 2013 年 11 月 7 日
コメント済み: SIMONE PARENTELA 2021 年 1 月 6 日
Hello, I have a problem whe using look-up table, for now I solved by implementing a function myself in simulink (user-defined funcion), but I hope there is someway to do it with the provided blocks. I want to look in a vector, so I want to use soemthing like a 1D lookup table, but the vector into which I look comes from another block, so is changing. In the Lookup table block there is no means to put the table as an input... I know the Look-up table dynamic, but it has the restriction of : "strictly monotonically increasing in x". In my case is usually decreasing and eventually has some values that do not fit... Hope someone can help me . Thank you

採用された回答

Jonathan LeSage
Jonathan LeSage 2013 年 11 月 7 日
From what you are describing as requirements, you are correct that you need to use the 'Lookup Table Dynamic' block. You are also correct that the requirements of this block specify that the xdat input vector must be strictly monotonically increasing. This constraint arises from the fact that the lookup table models a proper function. If you have a non-unique lookup for the same x-value, then a lookup table cannot uniquely determine the output value.
My recommendation is that you sort your x table data and then correspondingly use the sorted indices to sort your y table data. With your vectors monotonically sorted, you can directly use the 'Lookup Table Dynamic' block. The Sort and Permute Matrix Simulink blocks seem to be the most straightforward method of implementing my suggestion. Note: the Permute Matrix block is part of the DSP System Toolbox.
To help you get started, here is a simple Simulink model that would allow you to use the Dynamic Lookup block:
Hope this helps!
  3 件のコメント
rasool alturfi
rasool alturfi 2018 年 4 月 6 日
Dear Jonathan LeSage, Could you please help with the same issue but for two inputs and one output! Thanks..
SIMONE PARENTELA
SIMONE PARENTELA 2021 年 1 月 6 日
Can you share the code?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLookup Tables についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by