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 ?
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
Christine Tobler 2023년 11월 1일
I think, from reading the doc page example, you would write this as
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 CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by