Symbolic Toolbox: How to substitute partial derivative resulting from chain rule?

Consider the following:
syms f(r,s) R(x,y) S(x,y) dfdr
dfdx = diff(f(R,S), x)
which gives as ouput:
dfdx =
D([1], f)(R(x, y), S(x, y))*diff(R(x, y), x) + D([2], f)(R(x, y), S(x, y))*diff(S(x, y), x)
Now, how can I subsitute
D([1], f)(R(x, y), S(x, y))
with
dfdr
?
My attempt with
subs(dfdx, D([1], f)(R(x, y), S(x, y)), dfdr)
fails with the error message:
Error: ()-indexing must appear last in an index expression.
Any help is appreciated, thanks!

Answers (0)

Products

Release

R2018b

Asked:

on 26 Feb 2019

Community Treasure Hunt

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

Start Hunting!