N-D Look up Tables

6 views (last 30 days)
Ali Almakhmari
Ali Almakhmari on 19 Jun 2023
Answered: Fangjun Jiang on 20 Jun 2023
I have been at this for hours and I feel stupid. I keep getting the error: the number of diemsnions is 1, but the block parameter is 7. the dimensions and value....
So I have 8 vectors that are 10000 by 1. 7 of those vectors are input columns where each row has a different combination of those inputs, and the 1 output column correpsonds of the result/answer/output to those specific combinations of inputs. I would like to use the N-D Look up table block in Simulink to take all those 8 vectors into consideration, and then, given to it any combination of the 7 input values, it will try its best to estimate the output value. Is this not possible in the Look-up table? Or am I just doing something wrong.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 20 Jun 2023
You have a 10000x8 table. The first seven columns (10000x7) data is all the possible combinations of the seven input variables. For example, 2x5x2x5x2x5x10, a total of 10000 combinations.
You need to do a reshape() to make the last column 10000x1 data into a 2x5x2x5x2x5x10 matrix. Then use the n-D lookup table block to implement the lookup. The dimension would be 7.
It certainly is possible (dorable). You just need to make the data into the right format, the matrix mentioned above, and collect the breakpoints for all those seven input variables. For example, if the possible value for the first input varialbe is 10 and 100, then the breakpoints would be [10,100]. If the possible value for the second input variable is 5,4,3,2,1, then the breakpoints would be [1,2,3,4,5] (the value needs to be incremental).
The Matrix data needs to be arranged correctly according to the breakpoints.

More Answers (0)

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!