Symbolic Math Toolbox - Derive a function with respect to another function
1 次查看(过去 30 天)
显示 更早的评论
Hello,
i want to verify a calculation I did already on paper. There the following problem occurs:
>> clear all
>> syms t x(t)
>> f=3*x
>> diff(f,x)
Error using sym/diff (line 26)
All arguments, except for the first one, must not be symbolic functions.
I want to derive a funtion woth respect to another function of time. And i even need the derivation of a function with respect to another derivative of a function of time.
I need this because I want to get the equations of motion of a system by using Lagrange equations of the second kind .
Can anybody help me with this problem? Thanks a lot. Johannes
0 个评论
回答(2 个)
Zoltán Csáti
2014-10-23
编辑:Zoltán Csáti
2014-10-23
I also bumped into this question when I wanted to create the equation of motion using this method. Matlab's Symbolic Math Toolbox uses the Maple engine, so you can try the following: Physics:diff(L(t), ydot(t)), where L(t) is the Lagrangian that you want to differentiate with respect to the time derivative of coordinate y(t). I stress again, that this code is in Maple. As I see from your error message, it can't be done in Matlab. Therefore use Maple or do it by hand.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!