Turn a numeric function into a symbolic one
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi all,
do you know ho to turn a function with numeric input and output into a symbolic function?
Thanks!
0 comentarios
Respuestas (2)
Doug Hull
el 11 de Mayo de 2012
You will have to enter the function manually if you know it.
2 comentarios
Walter Roberson
el 11 de Mayo de 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 comentarios
Walter Roberson
el 11 de Mayo de 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)
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!