Week 3 - Solving second order ODEs
Solving 2nd order ODE's
Aim:
To write a program that solves the equation of motion of a simple pendulum with damping.
Theory:
A 2nd order differential cut and dried equation is which, any derivatives apropos of the free-spirited variable have order number greater than 2.
Simple-pendulum:
an ideal pendulum consisting of a point mass suspended by a trivial inextensible perfectly flexible thread and free to vibrate without friction.
the way pendulum moves depends on the newton's 2nd law,
Newton's second law of motion pertains to the behavior of objects for which all existing forces are not balanced. The second law states that the acceleration of an object is dependent upon two variables, the net-force acting upon the object and the mass of the object. The acceleration of an object depends directly upon the net force acting upon the object, and inversely upon the mass of the object. As the force acting upon an object is increased, the acceleration of the object is increased. As the mass of an object is increased, the acceleration of the object is decreased.

mathematical equation:

where,
b= damping
m= mass of the bob (kg)
g= acceleration due to gravity (m/s^2)
l= length of the string (m)
by substituting ,


by solving the above equation we get,

Coding:
calling function
Program explanation:
Clear all, close all, clc are used to clear the work space, to clear the graphs that’s exists, and clear the command window.
The inputs are for the simple pendulum are specified and the b = damping coefficient = 0.05 (n-m/s), g = acceleration due to gravity = 9.81 (m/s), l = length of the string = 1(m), m = mass of the bob = 1 (kg).
t_span is a command used in the ode45 solver which specifies the time span of the iterations that are going to solve the ordinary differential equation.

Screen Recording 2022-07-16 at 11.10.35 PM
conclusion:
We have animated the simple pendulum using the ode45 solver where the second order is reduced to a simple differential equation where it is easy to solve the given equation.
The animation is made using the different points of the bob and the motion of the simple pendulum is created.