Simulink matrix multiplication error
25 views (last 30 days)
Show older comments
So, I have a simulink model that I am working on and am trying to multiply two matricies. The first matrix is a .mat file being read in using the source from file block. This is a 4x12 matrix. My second matrix is a 12x1 vector that I wish to generate from various inputs to the block. Currently I am using the vector concatenate and reshape blocks to try and make the vector. I then pass both of these into the matrix multiply block and am trying to read the output (4x1 vector) using a demux. However, I get the following error:
Error using QuadParams (line 115) Matrix multiply dimensions propagation error. Error occurred while setting input port 2 of 'QuadSimulink/LQR /Matrix Multiply' to have the dimensions [12 x 1]. A possible cause for this error is that these dimensions do not agree with the partial dimensions information present on other ports Error using QuadParams (line 115) Error in port widths or dimensions. Output port 1 of 'QuadSimulink/LQR /Reshape' is a [12x1] matrix.
Anyone have any ideas as to what I am doing wrong? Any help is appreciated.
Thanks,
Pachu
0 Comments
Answers (1)
Sandip Kumar
on 6 Oct 2014
Based on the error message, it looks like the second signal is 12x1, but the first signal is not as expected, i.e., 4x12. Maybe the first signal is 12x4 and hence the error.
One way to check this is switch on Signal dimensions: Display > Signals & Ports > Signal dimensions. Now, update the model.
If this errors out again, disconnect the signals going into matrix multiply block and attach 'Display' blocks to incoming signals. Once the model updates, there will be dimensions display over the signals.
Fixing the first incoming signal to have the right dimension of 4x12 will fix the issue.
See Also
Categories
Find more on Sources 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!