Matrix times vector with Simulink

1 vue (au cours des 30 derniers jours)
Zynk
Zynk le 25 Juin 2014
Réponse apportée : Zynk le 25 Juin 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.

Réponses (2)

Rajiv Ghosh-Roy
Rajiv Ghosh-Roy le 25 Juin 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 le 25 Juin 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

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by