How to implement a simulink model to perform Matrix multiplication ?

조회 수: 5 (최근 30일)
Shravankumar P
Shravankumar P 2014년 8월 4일
댓글: Satheesh Appukuttan 2019년 12월 10일
A =
8 1 6
3 5 7
4 9 2
>> B=magic(3)
B =
8 1 6
3 5 7
4 9 2
>> C=A*B
C =
91 67 67
67 91 67
67 67 91
How to model this.

답변 (2개)

Christopher Berry
Christopher Berry 2014년 8월 7일
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!
  댓글 수: 1
Satheesh Appukuttan
Satheesh Appukuttan 2019년 12월 10일
Similar to this question. I would like to perform a element wise multiplication 2 matrices. for example
say I have MxN and Nx1 matrix. I would like to implement using one product block by shifting input data. that way I will be using only one multiplier. How do I shift the data in simulink,so that element wise multiplication can be done by single product block with 2 scalar inputs.
For eg: [ 2 3 ] [ 1 = 2+6
2]

댓글을 달려면 로그인하십시오.


SAGAR SONI
SAGAR SONI 2018년 10월 23일
how to done inverse kinematics for 5 dof robotic manipulator in simulink? please provide any suggestion and information or any material please

카테고리

Help CenterFile Exchange에서 Block Libraries에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by