Simulink matrix multiply, dimension error

8 views (last 30 days)
Pegah Hosseini
Pegah Hosseini on 17 Jan 2025
Edited: Cris LaPierre on 17 Jan 2025
Below is a small part of my Simulink model. The function is only a repmat that repeats the vector into 9 rows. When the matrix multiply is doing a "matrix" multiplication, all is good and I get a 9x9 matrix out.
I then need to change the Matrix Multiply to do "element-wise" multiplicaton. So, I remove uT and change the property to element-wise.
But as you can see, it fails to run and I get the below error message which does not make sence because it fails on the exact dimensions that are expected of it:
The only caveat to this whole scenario is that both the data that goes into Transpose2 and into "Matrix Multiply" is actually a 3D data in the form of 394x1x22 and 9x394x22, respectively. So, initially I thought it could be that Simulink mixes up this 3rd dimension somehow. However, this 3rd dimension exists in the rest of my model and Simulink is happy with it AND when I change the element-wise to matrix-multiplication again, Simulink is happy. So, I cannot see how that 3rd dimension will only go wrong in this specific scenario that I am interested in, i.e. element-wise multiplication.
Any ideas are greatly welcome.
  3 Comments
Pegah Hosseini
Pegah Hosseini on 17 Jan 2025
Thanks for your response. Funnily enough, it does not throw an error for the matrix multiplication case but for the element-wise case.
Cris LaPierre
Cris LaPierre on 17 Jan 2025
Edited: Cris LaPierre on 17 Jan 2025
You display the dimensions of the signals. None of them are 3D within the model shown in the screenshots.
It is interesting that you would have dimensions on one side of the signal but a question mark on the other. I'm not able to duplicate the issue using a simple model.
Can you share what block you are using for your Window Cordic Function1 block is? It appears you have somehow set the input signal size in this block, and your signal is not that size. Check you properties and try setting it to inherit the size by setting the corresponding parameter to -1.

Sign in to comment.

Answers (0)

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!