The ability to accept two vectors of different lengths is not supported by the '2-D Lookup Table' block in Simulink 7.2(R2008b).
The block does not loop through each possible input combination. The case is different in case of one scalar and one vector input when the scalar expansion rule applies - the '2D Lookup Table' block supports scalar expansion.
As a possible workaround, the matrix of values can be prepared in advance. This can be done using two methods:
a) Embedded MATLAB block
b) FOR loop iterating subsystem
The Embedded MATLAB block can be easily implemented using the MESHGRID function. However, the FOR loop iterating subsystem is more complicated, because all the values have to be put back together. We can use the fact that the '2D Lookup Table' block can handle scalar expansion to avoid using nested for loop.
Although either of the above two methods can be used, please note that the decision of the better approach of the above two depends on the size of his matrix and the operation involved.If Embedded MATLAB block with the MESHGRID function is used, it will create two buffers of the same signal and for large matrices this may cause a memory issue.
If the FOR loop iterating method is used, the '2D Lookup Table' block has to be called multiple times and it might increase the length of execution time.
In addition, code is generated for the model, the generated code will be different depending on the approach that is adopted.
Best Answer