Why does Simulink Product block (element-wise .*) fail for [3x5] .* [1x5] while MATLAB Function block works?

I have a Simulink model with two signals:
  • U = repmat(2,3,5) → size [3x5]
  • x = [1 2 3 4 5] → size [1x5]
In a MATLAB Function block, this works, but with a Product block set to element-wise multiplication, I get dimension errors like:
I expected the Product block and MATLAB Function block to behave the same.
Does the Product block support implicit expansion/broadcasting for singleton dimensions (like [1x5] to [3x5])? If not, what is the recommended Simulink-native way to do this without a MATLAB Function block?

More Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Products

Release

R2024a

Community Treasure Hunt

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

Start Hunting!