How to use eig() function inside Matlab function block, Can this inbuild function of matlab, be used in simulink or replaced with Simulink block. Suggest any Tool if required.
3 次查看(过去 30 天)
显示 更早的评论
I am trying to find Eigen values of an array (vectors). In Matlab, I am able to find it with eig() function. However if i write the same code inside simulink's Matlab functiion block. It is not giving the same answers. Can anyone please suggest me how to deal with it ?
I also looked into people who have faced similar issues as in these threads - Why does the eig function return different values in a Simulink 'MATLAB Function' block versus the MatLab command line? - MATLAB Answers - MATLAB Central (mathworks.com)
It is mentioned to use coder.extrinsic , Can anyone show me a small snippet of example code of how to do it or do it in someother way ?
1 个评论
Christine Tobler
2023-11-1
function mySimulinkMATLABfunctionBlock(A)
coder.extrinsic('eig')
[U, D] = eig(A); % Or your specific eig call
end
I don't have any experience with Simulink's MATLAB function block, though.
I would recommend that you also comment directly in the answer to the post you linked above. It's usually a good idea to make a new post for every new question, but here I imagine the person who answered the previous question may be the best contact for your question - and they are less likely to notice your follow-up question if it's in a new post.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!