Matrix times vector with Simulink

조회 수: 2 (최근 30일)
Zynk
Zynk 2014년 6월 25일
답변: Zynk 2014년 6월 25일
I need to perform a multiplication of a matrix 3x3 times a three-element column vector with Simulink, but I'm not obtaining the proper answer.
For example, these are matrix A and vector B:
A=[1 2 3;4 5 6;7 8 9]; B=[4; 7; 9];
If I perform A*B, I should obtain the vector:
45
105
165
Now, if I build this in Simulink a simple multiplication A*B with the block "Product" and changing the multiplication type to "Matrix", I get the following answer:
M =
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
45 105 165
This matrix M has size 1001x3 (I deleted lines to avoid too long message).
Could anyone please help me? Thank you in advance.

답변 (2개)

Rajiv Ghosh-Roy
Rajiv Ghosh-Roy 2014년 6월 25일
How are you getting the results (i.e. where does M come from)? Remember that Simulink will execute the multiplication once every time step; hence you will get [45 105 165] every time step. The result you are seeing is probably the log over 1001 time steps.

Zynk
Zynk 2014년 6월 25일
I'm checking the value of M in the Matlab workspace.
Yes, it is probably because of that, but is there any way to get it only one time? I need this result for other operations later on.
Thank you very much

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by