Project

SIMPLE PENDULUM with DAMPING - SIMULATION using Second Order ODE

AIM:

To solve an Ordinary Differential Equation which represents the Equation of Motion of a Simple Pendulum with damping and to simulate the motion of the Pendulum using MATLAB.

INITIAL INPUTS:

Damping Coefficient, b = 0.05

Mass, m = 1kg

Length of pendulum, L = 1m

Acceleration of gravity, g = 9.81 m/s^2

CODE:

Code consists of 2 parts

1) Main Program

% Solving and Simulating an ODE representing motion of a PENDULUM
clear all 
close all
clc

%Fixing the inputs
b= 0.05;
L=1;
g=9.81;
m=1;

%initial conditions (angular displacement and angular velocity)
theta_O = [0;3];

%Defining the Time interval
time = linspace(0,20,500);

%Calling the function to get the results
[t,result] = ode45(@(t,theta) ode_function(t,theta,b,g,L,m),time,theta_O);

%f variable used to store the frame at each value of theta
f=1;

%Using for loop to obtain each position of the Pendulum.
for i = 1:length(result)
  %Defining the co-ordinates to obtain plot of the Pendulum
  x0=0;
  y0=0;
  x1=(L)*sin(result(i,1));
  y1=(-L*cos(result(i,1)));

  %Plotting out position of pendulum with change in velocity, displacement and  time
  plot([x0 x1],[y0 y1],'linewidth',2)
  hold on

  %Using marker to produce bob of the Pendulum
  plot(x1,y1,'o','Markersize',15,'MarkerFaceColor',[1 0.5 0])
  hold on
  plot([-1 1],[0 0],[-1 1],[0.08,0.08],'color','k','linewidth',3)
  hold on

  %PLotting the rest position using dashed line
  plot([0 0],[0 -1],'color','k','linestyle','- -')
  hold off

  %Naming the plot using text command
  c = {'ODE - SIMULATION','SIMPLE PENDULUM'};
  text(-1.75,0.75,c)

  %Fixing the plot Axes
  axis([-2 2 -2 1])
  pause(0.5)

  %Defining the variable to store the each frame.
  A(f) = getframe(gcf);
  f=f+1;
end

%Creating the animation using each frame
movie(A)
Animation=VideoWriter('Pendulum.avi','Uncompressed AVI');
open(Animation)
writeVideo(Animation,A)
close(Animation)

2) Function defining the ODE

function [dtheta_dt] = ode_function(t,theta,b,g,L,m)

 theta1 = theta(1)
 theta2 = theta(2)
 dtheta1_dt = theta2;
 dtheta2_dt = (-(b/m)*theta2)-((g/L)*sin(theta1));
 dtheta_dt = [dtheta1_dt;dtheta2_dt];

end

RESULT:

The Second Order Differential Equation for motion of Simple Pendulum with damping

was solved and the Simulation depicting the motion of the Pendulum was made using MATLAB. For Simulation video,Please follow the link :

https://youtu.be/KADSku-7jtU

CONCLUSION:

From the motion of Simple pendulum with damping, it can be observed that the energy of the Pendulum dissipates continuously. This may be accounted because of the drag force due to the air resistance on the bob of the Pendulum and the damping produced by the Damper . Normally the air resistance on the string of the Pendulum is assumed to be negligibly small. Hence the pendulum motion can be assumed to be a series of damped oscillation, an oscillation that fades away with time.

The level of dampness of the system have a direct impact on the motion of pendulum. For a high level of damping, the pendulum comes to state of rest at very faster time interval when compared to low level of damping.

Refer the following plots which describes the nature of motion and time taken for the Pendulum to reach state of rest that changes with the level of damping.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.