Why do I receive different results from the DIFF function with char inputs between MATLAB 7.0 (R14) and MATLAB 6.5.1 (R13SP1)?
1 view (last 30 days)
Show older comments
For example, if I have the Symbolic Math Toolbox, and I execute the following command within MATLAB 6.5.1 (R13SP1):
diff('x^2')
I receive the expected result:
ans =
2*x
However, in MATLAB 7.0 (R14), I receive the unexpected result:
ans =
-26 -44
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
This bug has been fixed for Release 14 SP1 (R14SP1). For previous releases, please read below for any possible workarounds:
This has been verified as a bug within MATLAB 7.0 (R14) in the way some functions that are overloaded for char inputs convert the inputs to double precision values rather than symbolic expressions.
Currently, to work around this issue, convert your char expressions to symbolic expressions prior to supplying them to the DIFF function.
0 Comments
More Answers (0)
See Also
Categories
Find more on Function Creation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!