Simulink filtering of a table

2 visualizaciones (últimos 30 días)
Lucas Maiß
Lucas Maiß el 25 de Mayo de 2020
Respondida: Jonas el 28 de Mayo de 2020
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 comentarios
Nishant Gupta
Nishant Gupta el 28 de Mayo de 2020
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ß el 28 de Mayo de 2020
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)

Iniciar sesión para comentar.

Respuestas (2)

Fangjun Jiang
Fangjun Jiang el 28 de Mayo de 2020
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.

Jonas
Jonas el 28 de Mayo de 2020
Use a Direct Lookup Table with 5 dimensions.

Categorías

Más información sobre Programmatic Model Editing en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by