Substituting the partial differentiation

34 Ansichten (letzte 30 Tage)
Tae Woo Lee
Tae Woo Lee am 25 Jul. 2023
Kommentiert: Tae Woo Lee am 25 Jul. 2023
I am trying to substitute the partial differential equation but I can't find appropriate function.
Here is the sample code I have to modify.
syms u v x(u,v) y(u,v) z(x,y)
z = exp(x*y) ;
x = 2*u+v ;
y = u/v ;
dx = diff(x,u)
dy = diff(y,u)
dz_du = diff(z,u)
dz_du = subs(dz_du, {diff(x,u),diff(y,u)}, {dx, dy})
The result is
dx =
2
dy =
1/v
dz_du(u, v) =
exp(x(u, v)*y(u, v))*(y(u, v)*diff(x(u, v), u) + x(u, v)*diff(y(u, v), u))
dz_du(u, v) =
exp(x(u, v)*y(u, v))*(y(u, v)*diff(x(u, v), u) + x(u, v)*diff(y(u, v), u))
The point is, those diff(x(u, v), u) & diff(y(u, v), u) haven't substituted.
(what I want is the result below)
exp(x(u, v)*y(u, v))*(y(u, v)*2 + x(u, v)*1/v)
*At first, I changed the last line
subs(dz_du, {diff(x(u,v),u),diff(y(u,v),u)}, {dx, dy})
but it only returns error.
** I found some answers asking the version of my MATLAB and it is R2021a
Is there any way to guide matlab to substitute those partial differentiations?
  3 Kommentare
VBBV
VBBV am 25 Jul. 2023

It seems you have defined z = exp(x*y) first. You should define it after x and y. Then do the diff(z,u) which will give the same result but in u and v. There's no need for subs in the equation

Tae Woo Lee
Tae Woo Lee am 25 Jul. 2023
Problem has solved. Thank you very much.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by