How can i differentiate diff(q(t), t) again?
Show older comments
Hello..
I started to compute a function which has a variable depending on time which I defined as q(t). In the computation, the variable was differentiated and I ended up with diff(q(t), t). Now I want to further differentiate this resulting function wrt diff(q(t), t) i.e. q' but when I wrote "diff(exp3, diff(q(t), t));" matlab showed an error: "Second argument must be a variable or a nonnegative integer specifying the number of differentiations".
Can anybody help me figure this out.
So far I have tried to use functionalDerivative but that doesnt seem to work as well. Also I have found a way around this: I can use the sub function to substitute diff(q(t), t)) by qdot and do this diff(exp3, qdot); but that isnt what I intend to do.
Please Help.
3 Comments
Dev Sahu
on 26 Feb 2020
Benjamin Großmann
on 26 Feb 2020
Sorry, i got you wrong so i deleted my Answer.
As compensation for my misunderstanding I prepared a MWE. Is this rebuilding your problem?
clearvars, close all
clc
syms q(t)
exp = q(t).^2;
exp2 = diff(exp,t);
Ouput of exp2 is
exp2 = 2*q(t)*diff(q(t), t)
Now, we want to differentiate exp2 w.r.t. diff(q(t),t).
Dev Sahu
on 26 Feb 2020
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!