How to find the time and partial derivative?

Hello!
I have this:
How to represent the above in matlab in order to find the partial derivative w.r.t. q1_dot, that is the below
And after that i want to find the time derivative from the above.
Thanks in advance

8 Comments

Is q1_dot the same as diff(q1) ? That is, are you trying to find a partial derivative with respect to a derivative? Or is q1_dot just an unusual variable name? Or is it an unusual function name ?
Yes q1_dot is the diff(q1(t))
syms q1(t) q2(t) l1 l2 m I
K = 1/2*m*diff(q1(t),t)^2+1/2*(m*l2^2+I)*diff(q2(t),t)^2-m*diff(q1(t),t)*l2*sin(q2)*diff(q2(t),t)
diff(K,t)
I tried the above in live script but I'm not sure
syms q1(t) q2(t) l1 l2 m I
K = 1/2*m*diff(q1(t),t)^2+1/2*(m*l2^2+I)*diff(q2(t),t)^2-m*diff(q1(t),t)*l2*sin(q2)*diff(q2(t),t)
K(t) = 
That does seem to be the same as your equatiom
diff(K,t)
ans(t) = 
This is, however, not the same as diff(K,q1_dot)
syms Q1_dot
Ks = subs(K(t), diff(q1), Q1_dot)
Ks = 
diff(Ks, Q1_dot)
ans = 
Ok, I think it's same with yours
But how to find the second part of my question, that is the time derivative?
syms q1(t) q2(t) l1 l2 m I
K = 1/2*m*diff(q1(t),t)^2+1/2*(m*l2^2+I)*diff(q2(t),t)^2-m*diff(q1(t),t)*l2*sin(q2)*diff(q2(t),t)
K(t) = 
syms Q1_dot
Ks = subs(K(t), diff(q1), Q1_dot)
Ks = 
dK_q1_dot = diff(Ks, Q1_dot)
dK_q1_dot = 
dK_q1_dot_dt = diff(dK_q1_dot, t)
dK_q1_dot_dt = 

Sign in to comment.

 Accepted Answer

You don't really need the power of MATLAB here; elementary calculus will do:

1 Comment

Yes indeed, but i want the power of MATLAB to verify my maths.

Sign in to comment.

More Answers (0)

Asked:

on 22 Dec 2020

Commented:

on 22 Dec 2020

Community Treasure Hunt

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

Start Hunting!