Matrix times vector with Simulink
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!