The state of the slider-crank mechanism can be described completely by two angles

,

and the distance

of the slider from origin:
Define the force that is exerted on the slider:
The equations of motion are derived by resolving the forces and applying Newton's law

and

. The crank and connecting rod have mass and therefore inertia:
The algebraic equations define the geometry of the system:
Define the physical parameters for the system. Here
J1 and
J2 are the moment of inertia:
Solve and visualize the system: