Why does my generated code produce slightly different output than my Simulink model when using ODE4 solver?
Afficher commentaires plus anciens
A project I’m working on would like to use Embedded Coder to create C++ code from an existing Simulink block, so we’ve been testing the encoder options on a simpler model.
I noticed that the output given by the C++ code and the output given by the Simulink block are slightly different. The difference is more than anything that could be caused by numerical precision but the answers are close enough that the calculation seems to be doing the right thing. Also, when I switched the solver in Simulink to ODE1 (as opposed to ODE4), both the C++ and the Simulink gave the same answer. Do you know of any differences between the C++ coded version of the ODE4 algorithms versus the Simulink ODE4 algorithm?
The differences were small – on the scale of 0.1%, but after only a single time step.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Simulink Coder dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
