Create diagonal matrix from vector in Simulink without DSP toolbox and without knowing the dimension of the vector

조회 수: 2 (최근 30일)
Hey!
I need to convert a vector signal into a diagonal matrix in Simulink. The problem is that I do not have the DSP toolbox so I cannot use the corresponding block that exists. Also, I do not know the dimension of the signal therefore I cannot use a constant block with "eye(<dimension>)" to create the diagonal matrix with the help of the identity matrix.
Do you have any idea to accomplish this?
Thanks!
Cedric

답변 (1개)

Paul
Paul 2022년 1월 16일
The easiest way, perhaps not without drawbacks, is to use an Interpreted Matlab Function block. In the dialog box make the 'Matlab function' diag, and make sure the box for 'Collapse 2-D results to 1-D' is not checked.

카테고리

Help CenterFile Exchange에서 Array and Matrix Mathematics에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by