Code covered by the BSD License  

5.0

5.0 | 2 ratings Rate this file 58 Downloads (last 30 days) File Size: 2.72 MB File ID: #42196
image thumbnail

Euler–Lagrange equation

by

 

Solve Euler–Lagrange equation automatically.

| Watch this File

File Information
Description

# Information #
   You will be able to obtain dynamic system equation automatically when you define energies.

# Required Products #
   * MATLAB
   * Symbolic Math Toolbox (MuPAD)

# MATLAB Release #
   MATLAB 8.1 (R2013a)

Required Products Symbolic Math Toolbox
MATLAB release MATLAB 8.1 (R2013a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
30 May 2014 Zhiyuan

Hi Hitoshi,

Great sharing, and I really like your work.

The might be an error when you take partial derivative of q.

For example after
tmpeq2 := subs(tmpeq0, repeqL1 ):
The diff(th(t),t) was also replaced by diff(q, t), which would be wrongly evaluated to be zero.

One way to solve this, first use
tmpeq2 := subs(tmpeq0, repeqL2, repeqL1);
after the partial derivative of tmpeq2, then use
subs( term2, inveqL1, inveqL2);

This won't be an issue if diff(th(t),t) and th(t) are not multiplied together in the Kinematic energy term, but it would if they are, like in the case in file Step10.

Also in Step10, a tiny typo for bar2's y-position:cos(th1(t)) should be sin(th1(t)).

Thanks for sharing.

Best regards,
Zhiyuan Zuo

18 Oct 2013 Deepak Ramaswamy  

Contact us