All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
INTRODUCTION The simple pendulum is another mechanical system that moves in an oscillatory motion. It consists of a point mass 'm' suspended by means of light inextensible string of length L from a fixed support. The motion occurs in a vertical plane and is driven by a gravitational force. fig 1-shows the basic movement…
Gokul Krishnan R S
updated on 05 Jul 2022
INTRODUCTION
The simple pendulum is another mechanical system that moves in an oscillatory motion. It consists of a point mass 'm' suspended by means of light inextensible string of length L from a fixed support. The motion occurs in a vertical plane and is driven by a gravitational force.
fig 1-shows the basic movement of a simple pendulaum.
fif 2-shows the second order differential equation of a pendulum.
SAMPLE PROGRAM
%SOLVING SECOND ORDER DIFFERENTIAL EQUATION
clear all
close all
clc
%inputs
%damping cofficent=b
b=0.05;
%gravity
g=9.81;
%length of pendulum
l=1;
%mass
m=1;
%initial condition
%initial displacement=0
%initial velocity=3m/s
theta_0=[0 3];
%time_intervals
t_span=linspace(0,20,100);
%solving ODE
[t,results]=ode45(@(t,theta) ode_func(t,theta,b,g,l,m),t_span,theta_0);
outcome=results(:,1);
%counter
ct=1;
for i=1:length(outcome)
pos=outcome(i);
%start points
x0=0;
y0=0;
%end points
x1=l*sin(pos);
y1=-1*cos(pos);
%plotting
figure(1)
plot([x0 x1],[y0 y1])
hold on
plot(x1,y1,'g.','markersize',15,'linewidth',2)
hold off
axis([-1.5 1.5 -1.5 1.5])
grid on
M(ct)=getframe(gcf);
ct=ct+1;
end
Videofile = VideoWriter('second_order_differntial.avi');
open(Videofile)
writeVideo(Videofile,M)
close(Videofile)
%damping graph
%plotting damping
figure(2)
plot(t,results(:,1))
hold on;
xlabel('time')
plot(t,results(:,2))
hold off;
axis([0 22 -3.5 3.5])
ylabel('plot')
legend('Angular displacement/time','Angular velocity/time')
FUNCTION CALLING
function[dtheta_dt]=ode_func(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
CODE EXPLANATION
We start with clear all and close all commands
Clear all- removes data from the workspace , freeing up the system memory
Close all-deletes the current figure or the specified figure
First we start with defining the basic parameters required such as gravity, mass ,mass of the ball, damping coefficient, length of the pendulum, time interval, angular displacement and angular velocity. Then the initial conditions for solving first order differential equation is required,so we provide value for displacement and velocity, initial displacement of the pendulum is taken a 0 and initial velocity as 3 and theta_0 as [0 3].
Time interval is the time span for which our pendulum shows transient motion and generating results by using command ODE 45 which is an inbuilt function for solving differential equations outcome is nothing but the results following first column. ODE 45 command here is hyperlinked code written to solve differential equation. The same code is written above.
We use a counter command which is used to change loop irretation after every motion X is equal to zero and Y is equal to zero depicts its initial position of the pendulum bob and using trigonometry functions we can generate transient motion of the pendulum and maximum positions of the pendulum motion using the marker of or viscircles command we can attach a bob to pendulum string.
At the end an animation is required for the results of the motion of the simple pendulum so we use an animation command and make a video of the same the code of which is provided above.
RESULTS/OUTPUTS
*The graph showing angular "displacement/time" and "angular velocity/time" is provide below.
*The link for the animation of the motion of the simple pendulum is given.
https://youtu.be/QkP9P-Q1M9A
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Design of backdoor
Aim : To develop the car Backdoor(Tail gate) with the reference of given skin data as per engineering standarad by using NX12 Back Door : The Back door is typically hinged, but sometimes attached by other mechanisms…
22 Oct 2022 06:40 AM IST
Roof Design
INTRODUCTION The roof of a car or other vehicle is the top part of it, which protects passengers or goods from the weather. The roof also protects the passenger from any injury when the car gets crashed or is rolled over or something heavy falls on the roof. OBJECTIVE: …
17 Oct 2022 06:53 AM IST
Fender Design
Objective To design various mounting points on the fender, according to the design parameters. Fender Fender is the US English term for part of an automobile (vehicle body of car) that frames the wheel well (the fender underside). A fender is the part of an automobile which may be a car, motorcycle or any other…
06 Oct 2022 02:51 PM IST
Fender Design - Wheel Arch Challenge
Aim: To calculate the Fender Wheel Arc area , to pass the European standards. Objective: Create the intersection point according to given degree angle. Follow the European standards…
01 Oct 2022 05:17 AM IST
Related Courses
0 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.