Should I prefer using Simulink blocks or write custom MATLAB functions, if I plan on using the Simulink coder to convert my Simulink model in C?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
giulionap93
le 25 Sep 2021
Réponse apportée : Rishabh Singh
le 5 Oct 2021
Hello,
I am building an astrodynamic simulator in Simulink, that simulates both real physics and control algorithms for a spacecraft. The idea is that all the control part will be transformed into C code (and possibily part of the physics simulation). I have never used the Simulink coder, so I'm not sure about how it works yet.
I'm wondering, when building up the various pieces of the simulator, should I prefer using combinations of Simulink blocks (say for example a control logic, or writing math for simulating some physics effects), or is it better to write MATLAB functions, given my goal of using the Simulink coder in the future? What is the difference between the two approaches? Also, in terms of running Simulink simulations only, is there a difference between using the two (e.g. using one or the other is better for execution and/or compiling speed)
Thank you
0 commentaires
Réponse acceptée
Rishabh Singh
le 5 Oct 2021
As per my understanding you want to use SIMULINK coder and wish to know if using custom MATLAB function will improve execution performance of your model.
SIMULINK blocks are optimized but the optimization of custom MATLAB functions depend upon the skill set of the programmer. Considering the hassle involved, using SIMULINK blocks is a better alternative.
If you choose to write your MATLAB code for certain application, consider looking at Techniques to Improve Performance.
Hope this helps.
0 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!