Question about Symbolic Differentiation

3 次查看(过去 30 天)
Hello,
If I write the following code:
syms x t
answer = diff(x,t)
then answer = 0.
Is it possible to declare that x is some unknown function of t, so that diff(x,t) will return dxdt instead of 0?
(I'm asking because I'm trying to use MATLAB to automatically derive differential equations for certain user input for a specific application.)
Thank you,
Kevin

采纳的回答

Walter Roberson
Walter Roberson 2013-2-13
If you have a fairly new version of MATLAB (R2011b I think was the first), then
syms x(t)
diff(x,t)
  6 个评论
Kevin Bachovchin
Kevin Bachovchin 2013-2-14
Thanks again. When I try to take the partial derivative of function f with respect to x1(t), I'm getting an error saying Error using mupadmex Error in MuPAD command: Invalid variable. [stdlib::diff]
Is there any special way to take the partial derivative of f with respect to x1(t), or is it necessary to define a new syms x1 and substitute that in for x1(t) in f before taking the derivative?
Walter Roberson
Walter Roberson 2013-2-14
It is not possible to take a derivative with respect to a function.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Properties and Assumptions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by