Simulink matrix multiplication error

24 次查看(过去 30 天)
pachu
pachu 2014-10-5
评论: pachu 2014-10-7
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

回答(1 个)

Sandip Kumar
Sandip Kumar 2014-10-6
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 个评论
pachu
pachu 2014-10-7
Thanks you! You were indeed right that the 4x12 matrix was not being read in correctly.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by