How do I implement a 2-D or n-D dynamic lookup table block in Simulink?
28 views (last 30 days)
Show older comments
MathWorks Support Team
on 23 May 2013
Edited: MathWorks Support Team
on 9 May 2023
Simulink -> Lookup Tables library has a 1-D Dynamic Lookup Table. How do I implement the same functionality for a 2-D or n-D Lookup tables?
In particular, is it possible to specify the table data or breakpoints via an input port for multidimensional lookup tables?
Accepted Answer
MathWorks Support Team
on 9 May 2023
Edited: MathWorks Support Team
on 9 May 2023
As of R2020b, the “n-D Lookup Table” block has been enhanced to accept breakpoints and table parameters via input ports as well as the block dialog. This allows you to easily create dynamic, multidimensional lookup tables by passing the Table as well as Breakpoints (up to three dimensions) in as signals.
Prior to R2020b, the “Prelookup” and “Interpolation” blocks already supported parameter specification via their input ports. In older releases, you may choose to use the following workaround.
First, connect 'n' number of "Prelookup" blocks to an "Interpolation Using Prelookup" block.
Please find attached a library model 'Dynamic_2D_Lookup_Table.mdl' that contains a Dynamic 2-D Lookup Table block and a test model 'TS_Dynamic_2D_Lookup.mdl' that uses this block.
'Look Under Mask' to view the implementation of the custom library block. You can extend the same functionality to create 3-D and 4-D dynamic lookup table blocks. Change the 'Number of Table Dimensions' parameter of the “Interpolation using Prelookup” block to 3 or 4 and use the corresponding number of 'Pre-Lookup' blocks.
Inside the custom library block, the 'Table Data Source' parameter of the 'Interpolation using Prelookup' block is set to 'From Input'. It is this feature that allows a dynamic implementation of the lookup table. Please note that the ‘From Input’ feature is not available in R2010a and earlier releases. Using the library block in these versions will crash MATLAB. There are no workarounds for R2010a and prior releases.
1 Comment
Sriram Narayanan
on 19 Jun 2015
Hi Nancy,
You should be able to build this subsystem for ert target by right-clicking and selecting "Build this subsystem".
More Answers (0)
See Also
Categories
Find more on Nonlinearity in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!