- Since you intend to generate embedded code for these blocks, S-functions will require you to write TLC scripts, whereas, Embedded MATLAB takes care of code generation for you.
- S-functions allow you much more control over your block, such as maintaining state vectors and customizing block callback methods such as mdlEnable, mdlUpdate, mdlZeroCrossings, etc. Embedded MATLAB blocks have only one function (which is the equivalent of a combined mdlUpdate and mdlOutputs).
S-function or embedded MATLAB function
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am creating various subsystems for a vehicle control system and I have come to a point where I would like to implement some blocks written by myself. I have been teaching myself C++ and I would be able to create an S-function if needed but I also know how to program with MATLAB so an embedded MATLAB function is also possible. My question is which of these two options is more efficient in terms of computing power and speed? Keep in mind that the program I'm writing is going to be flashed to a dSPACE microautobox.
0 commentaires
Réponse acceptée
Kaustubha Govind
le 1 Fév 2011
In terms of performance, I don't believe that there is a significant difference between Embedded MATLAB Function and C/C++ S-functions (although I suspect S-functions are leaner). However, there are a couple of differences I can think of, otherwise:
In summary, the choice is between speed of development and control over block implementation.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Simulink Coder dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!