a problem about symbolic function diff

1 回表示 (過去 30 日間)
SANKU
SANKU 2014 年 6 月 16 日
編集済み: Lucas Carvalho 2017 年 5 月 13 日
syms x(t) y(t); f=x*y; I want get df/dx, how to use command diff? Thank you!

回答 (2 件)

Star Strider
Star Strider 2014 年 6 月 16 日
You do not get df/dx once you have defined x as x(t). You get the Chain Rule:
dfdx = diff(f)
produces:
dfdx(t) =
D(x)(t)*y(t) + x(t)*D(y)(t)
The command diff(f,x) or diff(f, x(t)) throws an error.

Lucas Carvalho
Lucas Carvalho 2017 年 5 月 13 日
編集済み: Lucas Carvalho 2017 年 5 月 13 日
In your case, the independent variable is only t, while x and y are dependent of t. To derive the f function partially in terms of x or y, you will need the fulldiff function:
https://www.mathworks.com/matlabcentral/fileexchange/7174-fulldiff-m

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by