How to Generate C code of Continuous time blocks?

조회 수: 7 (최근 30일)
Muhammad Shoaib Ullah
Muhammad Shoaib Ullah 2015년 8월 23일
답변: SRance 2020년 11월 17일
Hey Everyone, I want to know how should i generate C code from models that are utilizing continuous time blocks such as transformers?

답변 (1개)

SRance
SRance 2020년 11월 17일
Each Simulink block or MATLAB functions defines whether or not it can be generated to C/C++ code, which can be checked against the general list of MATLAB supported functions for code generation or with each block, listed at the bottom of the help page for that function of block. I.e. even if you wrote a MATLAB function for Simulink, it doens't neccessarily mean the function can be converted to C code.
For C code it is good to avoid continuous states as much as possible so that you can control the discrete time steps of your model when it is deployed to hardware, else you are likely to run into overflow quite quickly.
Use the Debug tab in Simulink to check the discrete and continous parts of your model, noting that for most continuous blocks there is a discrete alternative.
Once your are happy with you model, simply set-up your model to generate code for your specific hardware, noting you will need the Embedded or Simulink coder, or relevant support package for Arduino or Raspberry Pi.

카테고리

Help CenterFile Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by