Lagrange is a function that calculate equations of motion (Lagrange's equations)
It Uses the Lagrangian that is a function that summarizes the
dynamics of the system. Symbolic Math Toolbox is required.
Great code, but how do I have to write the equation of system composed for example by a mass, a damper, a spring and an external force?
T = m/2*dx^2; %kinetic energy
D = c/2*dx^2; %dissipative
V = k/2*x^2; %elastic
L = F*x; %external force
How do I have to insert them inside? I tried Lag = T + D - V - T but there are some issues.
Good job! Thank you!
Why did you use the simple() and collect() commands in this function? Is it functional? Because it seems to work just as well and much faster without those.
a g is missing at this row in the code:
16 % syms x dx ddx t m g
This code worked exactly the way I expected it to. It is totally deserving of the original rating, in my opinion.
very nice work with symbolic toolbox!
Nice code. easy to understand. would be great if you could extend it to include the torque and moment terms too.
Don't rate your own code. Obviously you think your own stuff is good.
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.