0% found this document useful (0 votes)
6 views6 pages

Double Pendulum

The report details a simulation of a double pendulum using the Runge Kutta Method with 4th degree accuracy, including the initialization of parameters and arrays. Various initial conditions were tested, resulting in different oscillation behaviors, such as in-phase, out-of-phase, and chaotic motions. The findings highlight the complex dynamics of the double pendulum, influenced by changes in angle and angular velocity.

Uploaded by

ch23b012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views6 pages

Double Pendulum

The report details a simulation of a double pendulum using the Runge Kutta Method with 4th degree accuracy, including the initialization of parameters and arrays. Various initial conditions were tested, resulting in different oscillation behaviors, such as in-phase, out-of-phase, and chaotic motions. The findings highlight the complex dynamics of the double pendulum, influenced by changes in angle and angular velocity.

Uploaded by

ch23b012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

CH2061 Computational Techniques

Double Pendulum Simulation Report


1 Introduction
I have attempted to solve the Double Pendulum Equation using the Runge Kutta Method,
accurate up to the 4th degree. The values of length and size of the bob are taken as
provided in the question. I have plotted the graph and simulated the motion for various
initial theta values.

2 Code
2.1 Initializing values and arrays

1 % Define
2
Parameters
g = 9.81;
3 L1 = 1;
4 L2 = 1;
5 m1 = 0.5;
6 m2 = 0.25;
7

8
% Array of time elements
dt = 0 .001 ;
9
t = 0: dt :25;
10

11 % Define arrays to store values


12
theta 1 = zeros (1 , length ( t));
theta 2 = zeros (1 , length ( t));
13 omega 1 = zeros (1 , length ( t));
omega 2 = zeros (1 , length ( t));
14

15
% Updating initial values of the
16 arrays theta 1 (1) = 1;
17
theta 2 (1) = 0;
omega 1 (1) = 0;
18
omega 2 (1) = 0;
19

20

21

22

2.2 Runge Kutta Method (4th Degree Accuracy)

1 % Looping across the whole array length


2 for i = 1:1:( length ( t) -1)
3 % Defining another array to store values of each iteration
4 y = [ theta 1 ( i); omega 1 ( i); theta 2 ( i); omega 2 ( i)];
5 % Calculating k values based on RK4 formulae
6 k1 = dt * double Pendulum ODE (y, g, L1 , L2 , m1 , m2 );
7 k2 = dt * double Pendulum ODE ( y + 0.5 * k1 , g, L1 , L2 , m1 , m2
);
1
CH2061 Computational Techniques

8 k3 = dt * double Pendulum ODE ( y + 0.5 * k2 , g, L1 , L2 , m1 , m2


);
9 k4 = dt * double Pendulum ODE ( y + k3 , g, L1 , L2 , m1 , m2 );
10 % Store final RK4 Method answers
11 y_next = y + (( k1 + (2 * k2 ) + (2 * k3 ) + k4 ) / 6);
12 % Update values in array
14 omega 1 ( i+1) = y_next (2);
15 theta 2 ( i+1) = y_next (3);
16 omega 2 ( i+1) = y_next (4);
17 end
18

19
% Displaying output of the
20 array disp ( theta 1 )
21 disp ( omega
1 ) disp (
22 theta 2 ) disp
23
( omega 2 )

2.3 Plotting the data

1 % Plots of theta 1 and 2 vs time


plot(t, theta 1 );
2
hold on;
3 plot(t, theta 2 );
4
hold off;
xlabel(’ Time ’);
5
ylabel(’ Theta ␣Values ’);
6 legend (’ Theta 1 ’, ’ Theta 2 ’);
7
title (’ Theta ␣values ␣VS␣Time ’);
8

2.4 ODE Equation

1 % Define the function for the double pendulum ODEs


2 function f = double Pendulum ODE (y, g, L1 , L2 , m1 ,
3
m2 )
% Stating values for each iteration
4 theta 1 = y (1);
5
omega 1 = y
(2); theta 2 =
6 y (3); omega 2
7
= y (4);
% Equations of motion for the double
8 pendulum f = zeros (4 , 1);
9
delta = theta 1 - theta 2 ;
f(1) = omega 1 ;
10 f(2) = (- g *
(2 * m1 + m2 * sin ( theta 1 ) - m2 * g * sin (
11
‹ theta ) - 2 * sin ( delta ) * m2 * ( omega
12 → 1 - 2 * theta 2 ) * 2
cos^2 ( delta ))) / ( * (2 * m1
omega 1 ^2 *
‹ *m2L2- m2 * cos (2 * deltaL1))); +

f(3) = omega 2 ;
f(4) = (2 * sin ( delta ) * ( omega 1 ^2 * L1 * ( m1 + m2 ) + g
* ( m1 2
‹→ + m2 ) * cos ( theta 1 ) + omega 2 ^2 * L2 * m2 * cos (
end
CH2061 Computational Techniques

13

14

15

3
CH2061 Computational Techniques

3 Graphs
As values of theta change, the motion of the double pendulum also varies greatly. I have
plotted different graphs of different initial theta values.

3.1 θ1 = 0.5,θ2 = 0.5,ω1 = 0,ω2 = 0


In this setup, there was a small deviation of both the pendulums in the same direction,
resulting in smooth oscillations with both pendulums being in phase to each other.

3.2 θ1 = 0.5,θ2 = −0.5,ω1 = 0,ω2 = 0


In this setup, there was a small deviation of both the pendulums in the opposite
direction, resulting in smooth oscillations with both pendulums being out of phase to
each other.

4
CH2061 Computational Techniques

3.3 θ1 = 90,θ2 = 45,ω1 = 0,ω2 = 0


In this setup, there was a large deviation of both the pendulums with a greater dis-
placement of one of the bobs, resulting in chaotic oscillations with the bottom
pendulum having a full circular motion.

3.4 θ1 = 1,θ2 = 0,ω1 = 5,ω2 = 0


In this setup, there was a small deviation of one of the pendulums with a non-zero angular
displacement, resulting in chaotic oscillations with the bottom pendulum having a full
circular motion.

5
CH2061 Computational Techniques

4 Conclusion
I have observed that the double pendulum showcases a range of motion, with the in
phase, out of phase and chaotic motion being the extremes. These different motions
can be viewed by modifying the angle or the angular velocity or both.

You might also like