Element-wise product in Simulink
55 次查看(过去 30 天)
显示 更早的评论
I would like to perform an element-wise multiplication (Hadamard product) between 2 matrices in Simulink. The "multiply" block only allows for element-wise multiplication when the dimensions of both arguments are equal. For example, I would like to perform the following in Simulink (which works in MATLAB):
a = [1,2,3
4,5,6
7,8,9];
b = [1,2,3];
c = a.*b; % element-wise multiplication [3X3] x [1X3]
The only method I have found that works in Simulink is to copy each row of the b vector to produce 2 matrices that have the same dimensions:
a = [1,2,3
4,5,6
7,8,9];
b = [1,2,3
1,2,3
1,2,3];
c = a.*b;
This method is not ideal because my matrices are very large and I am trying to avoid duplicating the b vector to save memory.
6 个评论
Walter Roberson
2018-8-23
I wonder if you could get somewhere switching between sample based and frame based ?
回答(1 个)
另请参阅
类别
在 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!