Strange behavior of functionalDerivative()

1 view (last 30 days)
Hey all,
I've encountered the issue where functionalDerivative() gives a wrong result:
clear
syms x(t)
f = diff(x, t)^2 * x^2
functionalDerivative(f,x)
results in
- 2*x(t)*diff(x(t), t)^2 - 2*x(t)^2*diff(x(t), t, t)
while it should be (at least if my knowledge of partial derivates is still correct)
2*x(t)*diff(x(t), t)^2
How can this be?
If encountered this while trying to get the dynamics equation of a system using the Lagrangian approach.
Interestingly this error leads to -dL/dx = 0 producing the correct end result, while usually the equation d/dt( dL/ddiff(x,t) ) - dL/dx = 0 should produce this result. (with L=T-V, T being the kinetic and V the potential Energy of the system)

Answers (0)

Community Treasure Hunt

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

Start Hunting!