Simulink matrix multiplication error
24 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!