char produces ln instead of log
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Sergei
le 26 Mar 2012
Modifié(e) : Walter Roberson
le 30 Oct 2023
I have a system of symbolic equations f, one of which contains log(x). When I try to evaluate it with eval(f), it calls at some point char(x), which replaces "log" with "ln", and matlab cannot process it. Did anybody experience a similar problem? Is there a workaround? Thanks!
2 commentaires
Kevin Holst
le 26 Mar 2012
Have you tried eval('char([102 108 105 112 108 114 40 39 116 105 120 101 39 41])')?
Why are you needing to use eval in this code? Could you post some of your code?
Réponse acceptée
Walter Roberson
le 26 Mar 2012
Don't eval() a symbolic equation. There are too many subtle syntax and function differences.
If you have all of the values needed for the symbolic equation, you can subs() the values into the equation.
If you will be evaluating the same symbolic equation repeatedly with numeric values substituted for all of the variables, use matlabFunction() to transform the symbolic function to an anonymous function.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!