Turn a numeric function into a symbolic one

7 次查看(过去 30 天)
Hi all,
do you know ho to turn a function with numeric input and output into a symbolic function?
Thanks!

回答(2 个)

Doug Hull
Doug Hull 2012-5-11
You will have to enter the function manually if you know it.
  2 个评论
Antonio
Antonio 2012-5-11
Ok, so I guess it is not possible since my numerical function depends on other numerical functions to be defined.
Antonio
Antonio 2012-5-11
I should define all the functions as symbolic ones

请先登录,再进行评论。


Walter Roberson
Walter Roberson 2012-5-11
In the case where the numeric function only involves mathematical calculations with respect to the parameter you wish to be symbolic, then pass a symbol to the numeric function.
If the numeric function has any part that is conditional on the input value (e.g., an "if" statement) then there is no mechanical way of handling the situation.
  3 个评论
Walter Roberson
Walter Roberson 2012-5-11
Just call the function passing in a symbolic variable. Operator overloading takes care of the details.
For example,
f = @(x) sin(cos(x)^2-tan(x))
then
syms p
f(p)

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by