Matrix times vector with Simulink
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuestas (2)
Rajiv Ghosh-Roy
el 25 de Jun. de 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.
0 comentarios
Ver también
Categorías
Más información sobre Simulink Functions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!