Symbolic Toolbox enforcing rational numbers when I want decimals
Afficher commentaires plus anciens
I am using the Symbolic Toolbox to generate analytical derivatives for optimization problems. However commonly I encounter something like the following in my models:
syms m1
fun = 0.123123*m1
where MATLAB generates the following:
fun = (8871947150731801*m1)/72057594037927936
As I am writing the analytical derivative to an m-file programmatically, I cannot substitute a value into m1 as it is not known beforehand, and therefore I am left with a large rational number!
So my question, is there a way to force the Symbolic Toolbox to use decimal / floating point numbers? It will keep my derivative files shorter and easier to inspect.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Common Operations 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!