Week 3 - Solving second order ODEs
Aim:-To program the codes that will simulate the pendulum motion.
Governing Equations:-
1.[t,results]=ode45(@(t,theta) ode_func(t,theta,b,g,l,m),t_span,theta_0)
2.[dtheta_dt]=ode_func(t,theta,b,g,l,m)
3.dtheta_dt=[dtheta1_dt;dtheta2_dt]
Code:-The main purpose of the program is to create a simulation of the pendulum motion .As ode45 solver is used for calculation of first order differential equation.After giving required inputs,codes and commands,we achieved to plot the time and displacement of the motion which is shown in figure(1)

After achieving the figure (1),The motion of pendulum is simplified according to the dispalcement and velocity.Using for loop command and the codes,we achieved the motion figure(2)

Result:-The motion of simple pendulum has been achieved and observed.
Animation video:-youtube.com/watch?v=PNwNNg9fscg