필터 지우기
필터 지우기

How can I get a derivated function df/dt?

조회 수: 14 (최근 30일)
Felix Lauwaert
Felix Lauwaert 2015년 8월 7일
댓글: Star Strider 2015년 8월 7일
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