![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/594030/image.png)
implementing complex multiplication in simulink
조회 수: 37 (최근 30일)
이전 댓글 표시
how to build the complex mulitplication block with total 4 inputs(2 real,2 imaginary)
댓글 수: 0
답변 (3개)
Pratheek Punchathody
2021년 4월 23일
Using the MATLAB Function block, we can create a complex multiplication block with the required number of inputs.
Create a functional block in simulink, by double clicking on this function block write the below function which takes 2 real inputs and 2 imaginary inputs.
function y = fcn(a,b,c,d) %a,c are real inputs and b,d are imaginary inputs
c1=complex(a,b);
c2=complex(c,d);
y = c1*c2; % performing multiplication
end
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/594030/image.png)
The following MATLAB function block is created with 2 real inputs and 2 imaginary inputs. The multiplication operation of the two complex numbers are performed and the output is shown with the variable y.
Hope this helps..!
댓글 수: 4
Walter Roberson
2023년 5월 9일
Have you happened to explore using a Product block in Matrix mode with complex signals ?
Philipp Raffael Diel
2023년 5월 9일
Yes I have. Since I saw, that the results were different from my Matlab reference code, I figured the product block (matrix multiplication mode) doesn't work for complex signals.
Kiran Kintali
2023년 5월 9일
For HDL Code Generation you can use the Simulink and MATLAB function examples shown below.
These examples use FPGA/ASIC friendly full precision intermediate products in the complex multiplication.
>> Simulink start page / HDL Coder templates section
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1378309/image.png)
>> eml_design_patterns
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1378314/image.png)
댓글 수: 2
Philipp Raffael Diel
2023년 5월 10일
Thank you very much!
Is there also an example for complex multiplication of matrices?
Kiran Kintali
2023년 5월 10일
편집: Kiran Kintali
2023년 5월 10일
Here are few product examples for your reference that can be modified for your use.
HDL Coder has several examples. Can you share more details on your requirements?
Are you looking for streaming (sample by sample) implementation to be done on FPGA/ASIC ? Do you need Floating-point or fixed-point precision? Are some of the inputs constants (like state space matrix compuation), if yes, is the data sparse or dense? Is the data source stored on the internal memory or external memory? What is the context in which matrix multiplication be used?
Walter Roberson
2023년 5월 9일
You can use blocks to combine each real component with its corresponding imaginary component. Then you can use a Product block https://www.mathworks.com/help/simulink/slref/product.html . Just be sure not to set the output signal type to Inherit: Keep MSB, or to Inherit: Match Scaling, as those two do not support complex signals.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Native Floating Point에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!