Simulink matrix multiplication error

37 views (last 30 days)
pachu
pachu on 5 Oct 2014
Commented: pachu on 7 Oct 2014
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

Answers (1)

Sandip Kumar
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.
  1 Comment
pachu
pachu on 7 Oct 2014
Thanks you! You were indeed right that the 4x12 matrix was not being read in correctly.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!