Effacer les filtres
Effacer les filtres

Turn a numeric function into a symbolic one

7 vues (au cours des 30 derniers jours)
Antonio
Antonio le 11 Mai 2012
Hi all,
do you know ho to turn a function with numeric input and output into a symbolic function?
Thanks!

Réponses (2)

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

Connectez-vous pour commenter.


Walter Roberson
Walter Roberson le 11 Mai 2012
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 commentaires
Antonio
Antonio le 11 Mai 2012
and eventually get a symbolic result?
Walter Roberson
Walter Roberson le 11 Mai 2012
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)

Connectez-vous pour commenter.

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!

Translated by