Create diagonal matrix from vector in Simulink without DSP toolbox and without knowing the dimension of the vector
1 次查看(过去 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
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!