How can I get a derivated function df/dt?

30 visualizaciones (últimos 30 días)
Felix Lauwaert
Felix Lauwaert el 7 de Ag. de 2015
Comentada: Star Strider el 7 de Ag. de 2015
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!

Respuesta aceptada

Star Strider
Star Strider el 7 de Ag. de 2015
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 comentario
Star Strider
Star Strider el 7 de Ag. de 2015
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.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by