How to substitute a function after differentiation?

2 visualizaciones (últimos 30 días)
AntonioMG_MX
AntonioMG_MX el 15 de Sept. de 2013
Hi everybody,
Suppose I do:
syms f(x,y)
df=diff(f,x)
df(x, y) =
D([1], f)(x, y)
Now I assign an expression to " f ", i.e.:
f(x,y) = y/x^2+x*y
f(x, y) =
x*y + y/x^2
My question is, how can I substitute " f " in " df "? The idea is to perform ther derivative automatically during substitution. Is this possible?
I have tried " subs ", " eval ", " compose ", direct substitution etc...
The problem seems to be that " df " has dependency on " x " and " y ", which makes sense, thus I am only able to make substitutions on " x " and " y " but " f ".
I know that I can assign the expression to " f " since the beginning, however that does not fit my application.
Thanks!

Respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 15 de Sept. de 2013
Editada: Azzi Abdelmalek el 15 de Sept. de 2013
I think you can not make substitution, because the derivative is not yet calculated. what you have to do is
syms x y;
f=y/x^2+x*y;
df(x)=diff(f,x)
  2 comentarios
AntonioMG_MX
AntonioMG_MX el 15 de Sept. de 2013
Editada: AntonioMG_MX el 15 de Sept. de 2013
Thanks! My idea was to perform some operations with the derivative before derivating. Since this is possible in Maple, I thought it was possible also with Matlab too.
Azzi Abdelmalek
Azzi Abdelmalek el 15 de Sept. de 2013
I'am not sure if it's possible or not

Iniciar sesión para comentar.

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!

Translated by