char produces ln instead of log
2 views (last 30 days)
Show older comments
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 Comments
Kevin Holst
on 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?
Accepted Answer
Walter Roberson
on 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 Comments
More Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!