Regarding discrete integration through ode45

조회 수: 2 (최근 30일)
Varad
Varad 2011년 4월 6일
Hi,
I am studying a software written in simulink, which includes the signal integration block. The entire system is in a closed loop, where the current input to the integration block is dependent on the previous value given at the output of the block. Basically, the input to the block is a complex function. It is mentioned in the solver pane that the ode method used is ode45.
My intention is to convert the entire simulink block to a pure MATLAB/C code. Is it possible to know how the discrete integration is implemented by MATLAB/Simulink?
Thank you, Varad.

채택된 답변

Arnaud Miege
Arnaud Miege 2011년 4월 6일
Can I ask why you want to convert the Simulink model to MATLAB or C code?
Simulink use complex semantics and mechanisms to solve the underlying mathematical equations of the system (see How Simulink Works and Choosing a Solver in the documentation for more details). It's not possible to convert a Simulink model to MATLAB code, which is why I ask what are the reasons for doing so.
It is however possible to automatically generate C code from Simulink models with Real-Time Workshop. This is typically for embedding control or signal processing algorithms onto real-time embedded systems, but can also be use for speeding-up simulations, integrating in larger simulation environments, batch processing, etc...
HTH,
Arnaud
  댓글 수: 2
Varad
Varad 2011년 4월 6일
Hi Arnaud,
My main intent is to convert the whole software to C. The main reason is that some of the functions the MATLAB part implements are very slow, and I have managed to optimize a great deal of it in C. However, the simulink part is the toughest to translate. Also, since I am translating manually, I'd really like to understand how it works. Is that possible?
Thanks for your time,
Varad Deshmukh
Arnaud Miege
Arnaud Miege 2011년 4월 7일
I wouldn't recommend doing a manual translation. Express your software in Simulink and then use Real-Time Workshop to generate the C code. Once the model is configured correctly to generate the C code, it's very easy to make modifications to the model and regenerate the code, rather than having to manually recode it and introducing potential coding errors.
Arnaud

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 General Applications에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by