How can I get a derivated function df/dt?

30 次查看(过去 30 天)
Hello,
I'm trying to calculate derivate functions like z(t)=cos(x(t))+y(t)^2 and I expect answers like z'(t)=-x'(t)*sin(x(t))+2*y(t)*y'(t).
I probably need to use MuPAD but I don't know the commands and what I've found on 'help' isn't exactrly what I want.
Thanks for your answers!

采纳的回答

Star Strider
Star Strider 2015-8-7
In R2015a, I get this result:
syms x(t) y(t) z(t)
z(t)=cos(x(t))+y(t)^2;
dzdt = diff(z, t)
dzdt(t) =
2*y(t)*diff(y(t), t) - sin(x(t))*diff(x(t), t)
  1 个评论
Star Strider
Star Strider 2015-8-7
It depends on whether it is an additive or multiplicative constant, and where it is in the expression.
Example 1 (multiplicative):
syms x(t) y(t) z(t) c
z(t) = c * cos(x(t)) + y(t)^2;
dzdt = diff(z, t)
dzdt(t) =
2*y(t)*diff(y(t), t) - c*sin(x(t))*diff(x(t), t)
Example 2 (additive):
syms x(t) y(t) z(t) c
z(t) = c + cos(x(t)) + y(t)^2;
dzdt = diff(z, t)
dzdt(t) =
2*y(t)*diff(y(t), t) - sin(x(t))*diff(x(t), t)
As expected, it disappears if an additive constant.
Example 3 (multiplicative inside expression):
syms x(t) y(t) z(t) c
z(t) = cos(c*x(t)) + y(t)^2;
dzdt = diff(z, t)
dzdt(t) =
2*y(t)*diff(y(t), t) - c*sin(c*x(t))*diff(x(t), t)
Example 4 (additive inside expression):
syms x(t) y(t) z(t) c
z(t) = cos(c + x(t)) + y(t)^2;
dzdt = diff(z, t)
dzdt(t) =
2*y(t)*diff(y(t), t) - sin(c + x(t))*diff(x(t), t)
One of these should work for you.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by