Challenge

Week 3 - Solving second order ODEs

Solving second order ODEs

Aim:

to purpose of this project is to create Solving second order ODEs using matlab

Equation:

Objectives:

the objective of this project is to Solving second order ODEs of a pendulum swinging freely

Programme:

clear all
close all
clc

b=0.05; (damping coefficient)
g=9.81;(gravity in m/s2)
l=1;(length of the pendulum in m)
m=1;(mass of the ball in kg)

%initial conditions

theta_0=[0;3];

%time points
t_span=linspace(0,10,500); time frame at which the pendulum is swinging
ct=1;

%solve ODE

[t,results]=ode45(@(t,theta) ode_func(t,theta,b,g,l,m),t_span,theta_0);
hold on
plot(t,results(:,1))
plot(t,results(:,2))
ylabel('plot')
xlabel('time')
M(ct)=getframe(gcf);
ct=ct+1;


movie(M)
videofile = VideoWriter('ode_main.mp4');
open(videofile)
writeVideo(videofile,M)
close(videofile)

Conclusion:

the free moment of pendulum is plotted in the graph as shown below & In the attached video.

Note:Due to short video size i am unable to upload the video on youtube ,however i have attached the video in the attached

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.