Why do I receive different results from the DIFF function with char inputs between MATLAB 7.0 (R14) and MATLAB 6.5.1 (R13SP1)?

4 次查看(过去 30 天)
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

采纳的回答

MathWorks Support Team
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 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by