After taking the time derivative of a symbolic expression, how do you then differentiate that new expression with respect to another variable's time derivative?

조회 수: 7 (최근 30일)
I apologize for such a poorly worded question, but I'm not quite sure how else to word it.
You're given, x and y, both symbolic variables as a function of time. y is also a function of x. You determine the time derivative of y, ydot. xdot also appears in ydot because y is a function of x, and x is a function of time. How do you then differentiate ydot with respect to xdot?
Here's my code:
syms y x(t) t
y = sin(x);
ydot = diff(y,t);
diff(ydot,D(x)(t))
I've also tried this method:
syms y x(t) t
y = sin(x);
ydot = diff(y,t);
syms Dx
ydot = subs(ydot,sym('D(x)'),Dx);
diff(ydot,Dx)
But that gives me an output of:
ans(t) = 0
The answer should be cos(x(t))

채택된 답변

Walter Roberson
Walter Roberson 2013년 8월 9일
No. MuPAD can only differentiate with respect to a variable, not with respect to a function.
  댓글 수: 1
Dominic
Dominic 2023년 3월 5일
You have to create the general diff function for partial differentiation. You can perform this using the limit definition of the derivative with an h value as close to 0 as possible. You can program in the algebraic steps to simplification and then return the resultant expression. This will work for any type of function assuming the derivative is well defined.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Paul
Paul 2023년 3월 5일
syms y x(t) t
y = sin(x);
ydot = diff(y,t)
ydot(t) = 
syms Dx(t)
ydot(t) = subs(ydot,diff(x,t),Dx(t))
ydot(t) = 
functionalDerivative(ydot,Dx(t))
ans(t) = 

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by