How to solve for a derivative using symbols?
Afficher commentaires plus anciens
This is simple, but I cannot find the answer.
Here is my example:
syms u c ut
f= symfun(u-c, [u c])
ut = sym('u(c)')
df = subs(f,u,ut)
dff = diff(df,c)==0
Now I would like to solve it for du/dc, the answer is simple du/dc=1. But I can't do it, in reality my problems are much more complicated. Is it possible to substitute derivative expression into a variable following a derivative. I can create:
dudc=symfun(diff(ut,c), [u c])
but dudc is not recognize if I try to solve dff with it.
Thanks
Jerome
Réponses (1)
Walter Roberson
le 3 Déc 2015
You have
f= symfun(u-c, [u c])
ut = sym('u(c)')
The second line implies that u is a function of c, but you did not tell MATLAB that before you created f. You created f as if u is a variable, but in the second line you are talking about u as a function. What is it?
syms u(c)
f = symfun(u(c)-c, [u, c])
Catégories
En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!