How to get a time derivative in symbol form

4 views (last 30 days)
Maarten
Maarten on 13 Aug 2012
Hello
Im currently working with the Lagrange Equation to create an equation of motion which i will solve with an odesolver.
In order to use the Lagrange Equation i need the time derivative of the kinetic energy that has been derived to the dq's
q(t) = the generalized coordinates in matrix form (they are a function of time)
q(t) = [q1; q2]
dq(t) = the first time derivative of the q's, also in matrix form (normally indicated with a dot above the q)
d/dt(q(t)) = dq(t) = [dq1; dq2]
ddq(t) = the second time derivative of the q's, also in matrix form (normally indicated with two dots above the q)
d/dt(dq(t)) = ddq(t) = [ddq1; ddq2]
T = kinetic energy
T(q(t),dq(t)) T is a function of q(t) and dq(t)
then it will be derived to the dq(t) and transposed
(T,dq)^T (^T = transpose, in matlab .')
This is how far I get with my limited knowledge of Matlab, now it gets tricky for me
I need the time derivative of (T,dq)^T
I call (T,dq)^T = Tdq
Tdq(q,dq) is a function of q and dq
d/dt(Tdq) Time derivative of Tdq where q becomes dq, dq becomes ddq.
Example:
(9/4)*(m1+4*m2)*L^2*dq1+3*m2*L*dq2*cos(q1+q2)
Tdq =
3*m2*L^2*dq1*cos(q1+q2)+(4/3)*m2*L^2*dq2
And the time derivative should be:
(9/4)*(m1+4*m2)*L^2*ddq1+3*m2*L^2*dqq2*cos(q1+q2)-3*m2*L^2*dq2*(dq1+dq2)*sin(q1+q2)
d/dt(Tdq) =
3*m2*L^2*ddq1*cos(q1+q2)-3*m2*L^2*dq1*(dq1+dq2)*sin(q1+q2)+(4/3)*m2*L^2*ddq2
This Time derivative is pretty large, but still can be solved by hand, the ones i have now are nearly impossible to solve with the hand. Thats why i need matlab to solve it.
So basically i need matlab to recognise that d/dt(q) = dq and that d/dt(cos(q)) = -dq*sin(q) (chain rule) ect
Their has to be a simple solution ( I can't be the first one who tries to use the lagrange equation of motion in matlab), But i just can't seem to find it. I am new to matlab and still a student, so a simple solution with a simple example would be much appreciated.
Please help me solve this
Thanx
Maarten

Answers (0)

Categories

Find more on Symbolic Math Toolbox 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!