How to solve a first order ODE system with coupled equations
Show older comments
Hello,
I have a system of equations describing a double pendulum on a cart as described below.
</matlabcentral/answers/uploaded_files/135839/double_pendulum.png> My aim is to solve the equation numerically using ode45. I have defined the state vector
y=[x, theta1, theta2, x_dot, theta1_dot, theta2_dot]
=[y1, y2, y3, y4, y5, y6]
to transform the 2nd order equations into a system of 1st order equations. After expanding the terms, I get the following 1st order equations:
1> dy1/dt = y4
2> dy2/dt = y5
3> dy3/dt = y6
4> dy4/dt = {f - [0.75cos(y2)*dy5/dt + 0.25cosy3*dy6/dt - 0.75(y5^2) * sin(y2) - 0.25(y6^2)* sin(y3)]}/2
5> dy5/dt = -[0.75cos(y2)*dy4/dt + 0.25cos(y2-y3)*dy6/dt + 0.25(y6^2)*sin(y2-y3) - 7.3575*sin(y2)]/0.67
6> dy6/dt = -[0.25cos(y3)*dy4/dt + 0.25cos(y2-y3)*dy5/dt - 0.25(y5^2)*sin(y2-y3) - 2.4525sin(y3)]/0.16
I have substituted all the constants to make the equations easy to read. The equations 4,5 and 6 above have 1st order terms on LHS and RHS so I am unsure how to use ode45 and solve the system.
Thank you!
Accepted Answer
More Answers (0)
Categories
Find more on Numerical Integration and Differential Equations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!