How to implement a simulink model to perform Matrix multiplication ?
50 views (last 30 days)
Christopher Berry on 7 Aug 2014
Matrix multiplication in Simulink is almost as easy as it is in MATLAB itself. See the block diagram below:
Select a Constant block for your matrix and use magic(3) as the "Constant Value". Then, select a Product bock to perform the multiplication. This Product block performs both element multiplication .* as well as matrix * multiplication, so you will have to select which one you would like from the "Multiplication" drop down inside the block parameters.
Then, use the To Workspace block to output your result to the Workspace so you can check it.
Just note that unlike MATLAB, Simulink always has a built notion of time, so this setup will calculate C = A*A at every timestep, so select an appropriate step size/simulation time to avoid wasted computations!