Any good resources on how to use "Matrix Interpolation" block in simulink?

1 回表示 (過去 30 日間)
Vinh
Vinh 2024 年 4 月 8 日
コメント済み: Vinh 2024 年 4 月 9 日
So I want to use the "Matrix Interpolation" block in simulink, but I am confused as to how to actually use it and the only resource I could find on it was the help page:
I have some 5x2 matrices I want to select based on two integer indices with a "nearest" selection (so if I pass in the indices (0.6, 2.7) I want to select the matrix specified by the indices (1,3)). I was wondering, how can this be done? I mainly dont know how to pass in the matrices such that it aligns with the "Table data" input in the matrix interpolation block parameter menu.

採用された回答

Fangjun Jiang
Fangjun Jiang 2024 年 4 月 9 日
What you need is the "2-D Lookup Table" block. Drag that from the library and select "Nearest" at the "Algorithm" tab. The Help page gives you the general n-D Lookup Table block, which sometimes is hard to understand.
The "Matrix Interpolation" block can be regarded as the expansion of the Lookup Table block. It allows you to provide matrix input (as index input) to get multiple points at a time.
  5 件のコメント
Fangjun Jiang
Fangjun Jiang 2024 年 4 月 9 日
Okay, use a Selector block to select data from A_, which is a multi-dimension array. Round your indices to provide as the 3rd and 4th dimension input.
A_=rand(5,2,2,3);
A_(:,:,1,1)
ans = 5x2
0.3705 0.0462 0.7544 0.8008 0.1469 0.7097 0.2789 0.6740 0.9496 0.7416
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
A_(:,:,2,3)
ans = 5x2
0.0886 0.8163 0.2355 0.7434 0.5893 0.3653 0.0105 0.1403 0.6884 0.2630
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Vinh
Vinh 2024 年 4 月 9 日
Awesome, many thanks!

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by