MATLAB Answers

Simulink filtering of a table

1 ビュー (過去 30 日間)
Lucas Maiß
Lucas Maiß 2020 年 5 月 25 日
回答済み: Jonas 2020 年 5 月 28 日
Hello,
I have a table with 5 col of input states and one as output.
So for 0.6 & 0.4 & 0.5 & 310 & 100 as input I would like to output 0.0453 (row 1).
So my question is how do I perform such a task in Simulink, as the inputs are signals in a Simulink Model?
Have a nice day!

  2 件のコメント

Nishant Gupta
Nishant Gupta 2020 年 5 月 28 日
You can use 'Matlab Function' block to do this. Just write the relationship between inputs and outputs inside the block, then you will get the resultant output corresponding to input signals.
Refer to the following link to know how to implement MATLAB function using block:
Lucas Maiß
Lucas Maiß 2020 年 5 月 28 日
I have tried it with the Matlab Function by setting using 'Edit Data' and defining the table as 'parameter'. So that does work for arrays but not for tables. I have also managed to search in the array but I think that is not so efficient than searching in a table, am I right ?
And my solution to that are not much more efficient:
  • Loading a .mat file with the table inside the function -> has to load complete table every time step
  • Converting to a table -> will be performed also every time step
(The table is quiet large (45000x6) so an efficient way would be great, I am also willing to restructure the table if necessary)

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

回答 (2 件)

Fangjun Jiang
Fangjun Jiang 2020 年 5 月 28 日
The straightforward way to do this is to use "n-D Lookup Table". You have a 5-D lookup table here. The first 5 columns are the loopup axis, the sixth column is the output data.
Notice the firtst 4 columns of data you show here didn't change value? I imagine the large (45000x6) array is the expanded view of the loopup table data. Take a look at the help and example model of the Simulink n-D Lookup Table block and figure out the proper data for it.

  0 件のコメント

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


Jonas
Jonas 2020 年 5 月 28 日
Use a Direct Lookup Table with 5 dimensions.

  0 件のコメント

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by