Spring Pendulum

1. Introduction

Consider a mass m attached to a spring of spring constant k swinging in a vertical plane as shown in Figure 1. The equations of motion can be derived easily by writing the Lagrangian and then writing the Lagrange equations of motion.

Where l is equilibrium length of the pendulum, m is mass of the bob attached to spring. Let l+r(t) be the length of the spring, and θ(t) be the angle of the spring w.r.t vertical.

Figure 1: Spring Pendulum

2. Lagrange’s Equations of motion for Spring Pendulum

The kinetic and potential energies of the mass are given as follows

[2.1]

[2.2]

Where x is the stretch in the spring beyond its equilibrium. Therefore the Lagrangian is given is

[2.3]

The Lagrange’s equations are given by

[2.4]

The equations of motion for spring pendulum are as follows:

[2.5]

[2.6]

Where ωr and ωθ are the springs frequency along its length and pendulums frequency of oscillation respectively and are given by

[2.7]

[2.8]

3. Numerical Integration of System of Equations

The system of equations (2.5) and (2.6) can be time integrated to know the trajectory/ position of the spring pendulum using methods like Euler method, Runge-Kutta method etc,. Runge-Kutta method is better and more accurate. To apply these techniques the system of equations are transferred to first order differential equations as follows:

[3.1]

Equation (3.1) defines the state of the system. Its first order time derivative is given by

[3.2]

To solve the above first order differential equations initial values are required i.e.  are required.

4.  Code of SpringPendulum

A code is written in MATLAB for spring pendulum. Systems of equations are solved using ODE45 of the MATLAB. Animation of the spring pendulum motion is plotted. Phase plane plots of the spring motion and pendulum motion are plotted in the same animation plot. The following are the values used in the code and can be changed accordingly.

### Mass of the bob, M = 2 N Length of the pendulum, L = 2 mSpring constant of the pendulum, K = 5 N mAcceleration due to gravity, g = 9.81 m/s2

The following are the initial values used in the code:

Initial values can be changed accordingly to the requirement. The following picture shows a screen shot of the plots obtained for the spring pendulum with the above values run for 60 seconds.

Figure 2: Simulation of Spring Pendulum

The values of the spring pendulum can be changed and the motion of spring pendulum can be studied.

The following video shows the animation of the Spring Pendulum done using the above code:

Click on the following link to see the code and more details.

http://www.mathworks.in/matlabcentral/fileexchange/33168-springpendulum

Simple Pendulum   << Prev                                                                    Next >>  Bead on Hoop