필터 지우기
필터 지우기

How to Compile Simulink model which has fsolve function?

조회 수: 7 (최근 30일)
Amal Aljasmi
Amal Aljasmi 2022년 2월 24일
답변: Dheeraj 2024년 1월 8일
Hello everyone,
I am trying to compile a Simulink model with 'fsolve' fcn into a Python Package and since 'fsolve' is not supported for code-generation I can't use (Embedded) MATLAB Function block so I've put it in an Interpreted MATLAB Fcn block, as suggested here: https://www.mathworks.com/matlabcentral/answers/42811-fsolve-in-simulink-model#comment_1780841
But I cannot generate code from an Interpreted MATLAB Function block as was stated here too:
Is there any way to have fsolve in a Simulink model and be able to compile it?
Thanks in advance.

답변 (1개)

Dheeraj
Dheeraj 2024년 1월 8일
Hi,
I understand that you want to know any way to have fsolve in a Simulink model and be able to compile it.
fsolve is not supported for code generation and Interpreted MATLAB Function block for code generation in any release.
But you can use the following workarounds.
  1. Implementing a custom solver in Simulink using available blocks for code generation, you need to develop your own algorithm or use the available blocks to create custom solver that achieves the same purpose of “fsolve
  2. You could also use External Function Interface by writing the logic in any of the external languages compatible and use the external functional block from Simulink.
Choose among the alternatives depending upon the nature of your problem and requirements for code generation.
Hope this helps!

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by