How to find a symbolic derivative?

1 回表示 (過去 30 日間)
Mike Meyers
Mike Meyers 2017 年 11 月 19 日
編集済み: Jose Marques 2017 年 11 月 19 日
Assume you are writing a complex function - in my case, to find the equations of motion of a coupled drives system (CE108).
Is there a way to differentiate a symbolic variable (say, x) so that you get its symbolic derivative (in our case, dx)?
Example:
syms x, m
T = 0.5*m*x^2
y = SymbolicDerivative(T,x); %is there something like this
y = m*dx % that gives this?
Any custom made functions or any prebuilt ones you know?

回答 (1 件)

Jose Marques
Jose Marques 2017 年 11 月 19 日
編集済み: Jose Marques 2017 年 11 月 19 日
Use diff function:
syms f(x)
f(x) = sin(x^2);
df = diff(f,x)
Result:
df(x) = 2*x*cos(x^2)

カテゴリ

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