Week 3 - Solving second order ODEs
AIM:
To create and solve the second order ordinary derivative equation and create a animation using MATLAB
OBJECTIVE:
To write program for solving the below ODE with a graph of velocity v/s displacement with animation
where
g=gravity in m/s^2,
L=lenth of a pendulum in m,
m=mass of the ball in kg
b=damping coefficient
GOVERNING EQUATION:


GIVEN DATA:
L=1 metre
m=1kg
b=0.05
g=9.81 m/s^2
Simulate the motion between 0-20 sec,
for angular displacement=0,
angular velocity=3 rad/sec at time t=0.
CODE:
1. code for function ode 45 for the ode program
%function calling for a ODE and the inputs are the t,thet,b,g,l,m
this program could saved ode function.m in the same folder where the main code saved it is for the function calling
2.main ode program
EXPLANATION FOR THE CODE:
1.Initially the given details in the question are aasignned as the inputs and the time is varied and boundary is created by linspace coommand ahge theta valuev is assigned as a column matrix
2.Then the ode45 which is the inbuilt function which is used for function call in program it is set as equal (t,results)
3.Then we use the plot command for plot the graph for the time and velocity and the legend command is used for ideentifying the each values
4.The looping statements is used for the correct and accurate simulation t
5.Next we have to assign the fixed coordinates (x0=1,y0=1,ct=1)
6.For getting the bob in the animation we use the marker command
7. The use of the axis command axis are fixed(axis([0 2 -0.5 2]))
8. the counter variable which ct is used and its value also changed for each loop(ct=ct+1)
9.next we have to create a movie for that so we need to create a videofile and saved in AVI file with compressed format
10. And then add the title for the video
RESULTS:
OUTPUTS-
1. graph for velocity and time and it shows the displacement and angular velocity

this above graph shows that displacement and velocity is decreasing while time is increasing because of the damper(the damper that absorbs the vibration for body kept in equilibirium position)
2.Animation
https://youtu.be/bvNlxKWBqKo
ERRORS:
1. small mistake has been made bytyping which is used this \ symbol instesd of this /
2.another mistake is assigning in nthe function calling program
this rectified by the experts through one to one sessions
CONCLUSION:
1. the graph for velocity and time is obtained
2. the animation also created and uploaded