Matrix times vector with Simulink

1 Ansicht (letzte 30 Tage)
Zynk
Zynk am 25 Jun. 2014
Beantwortet: Zynk am 25 Jun. 2014
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.

Antworten (2)

Rajiv Ghosh-Roy
Rajiv Ghosh-Roy am 25 Jun. 2014
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 am 25 Jun. 2014
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

Kategorien

Mehr zu Simulink Functions finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by