Simulink Matrix multiply error: unexpected scalar signal mismatch
Show older comments
I'm confused by a Simulink error relating to a "mismatched port size".
I have a scalar signal in a feedback loop -- the exact configuration isn't relevant (I think), but the point is that it's a number (not vector) as far as I can tell: I know this is a single number, because I can Display it as a single number, and/or Show Value of the wire during running.
If I insert a simple filter inline with this number output from the matrix multiply, I get an error of matrix multiply propagation error.
Here's what works:

I display dims on all signals, so no display means scalar.
This doesn't work:

SL is confused on dims for some reason.
Error:

Why? Isn't a matrix multiply output just a number, if the dimensions end up as 1x1?
What am I misunderstanding?
I haven't found any block options to force proper dims.
2 Comments
Walter Roberson
on 29 Apr 2023
Why would the dimension end up as 1 x 1? Your second calculation appears to do matrix multiplication of two 1 x 2, which would be an error.
Or possibly your [Kx] is intended to be 2 x 1 -- but Simulink notes 2 x 1 differently than 2 .
If [Kx] is intended to be 2 x 1 your might need to put it through a reshape block.
Accepted Answer
More Answers (0)
Categories
Find more on Event Functions 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!