Element-wise product in Simulink
이전 댓글 표시
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
TAB
2018년 8월 22일
For element-wise multiplication (Hadamard product) in Matlab using ".*", both matrix dimesions must be same.
How can it work in Matlab ?
Ryan Takatsuka
2018년 8월 22일
편집: Ryan Takatsuka
2018년 8월 22일
Walter Roberson
2018년 8월 23일
R2016b and later implemented automatic expansion as if you had written bsxfun()
Ryan Takatsuka
2018년 8월 23일
Walter Roberson
2018년 8월 23일
I wonder if you could get somewhere switching between sample based and frame based ?
답변 (1개)
madhan ravi
2023년 12월 27일
0 개 추천
Desired can be achieved using For Each or For Iterator subsystem
카테고리
도움말 센터 및 File Exchange에서 Simulink Functions에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!