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 Center および File ExchangeArray 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