How to perform implicit derivative?

100 Views Asked by At

I'm going to perform some symbolic calculus for a project and I'm starting with something simple. I'm ttrying to calculate the derivative of L function in respect to variable fi, but using the following code I get the error shown.

syms x(t) y(t) fi(t) m IR t;

L = 1/2*(m*(diff(x(t),t)^2+diff(y(t),t)^2) + IR*diff(fi(t),t)^2)
D1 = diff(L,diff(fi(t),t))

ERROR: Error using sym/diff (line 70) Second argument must be a variable or a nonnegative integer specifying the number of differentiations.

Could anyone tell me what's going on? Thanks. [1]: https://i.stack.imgur.com/fTpEM.png

1

There are 1 best solutions below

0
On

You have a nested diff in the second line. For the outer diff, the second argument cannot be the inner diff - it should be a variable or non-negative integer.