All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
YOUTUBE LINK :- https://youtu.be/iD9owFov5Js GOOGLE DRIVE LINK :- https://drive.google.com/drive/folders/1JybKWW_MgbcbZldZRV-TBqvLK7COi6iY?usp=sharing AIM:- To solve the second order differential equation using MATLAB which mathematical of the motion of the pendulum and to create an animation for that equation. OBJECTIVE:-…
Babilu M S
updated on 10 Nov 2021
YOUTUBE LINK :-
GOOGLE DRIVE LINK :-
https://drive.google.com/drive/folders/1JybKWW_MgbcbZldZRV-TBqvLK7COi6iY?usp=sharing
AIM:-
To solve the second order differential equation using MATLAB which mathematical of the motion of the pendulum and to create an animation for that equation.
OBJECTIVE:-
To write a program that solves the following second order differential equation.This second order differential equation represents the equation of motion of a simple pendulum with damping.
GOVERNING EQUATIONS:-
In the above equation.
g = gravity in m/s2
L = length of the pendulum in m.
m = mass of the ball in kg.
b = damping coefficient
FIXED PARAMETERS:-
Length(L) = 1 meter
Mass(m) = 1kg
Damping coefficient(b) = 0.05
Acceleration due to gravity(g) = 9.81 m/s2
Time period = 0-20 sec
MAIN CODE:-
% input
% b = damping coefficient
b = .05;
% l = length of the pendulam in m
l = 1;
% g = gravity in m/s2
g = 9.81;
% m = mass of the ball in kg
m = 1;
% intial condition
theta_0 = [0 5];
% time point
t_span = linspace(0,20,100);
% solve ode
[t, result] = ode45(@(t,theta) ODE_func(t,theta,b,g,l,m),t_span,theta_0);
figure(1);
plot(t,[result(:,1) result(:,2)]);
grid on
ylabel('plot')
xlabel('plot')
legend('Displacement (m)','velocity (m/s^2)');
saveas(figure(1),'SHM.jpg');
theta = result(:,1);
i = 1;
for j = 1:length(theta)
Theta = theta(j);
% intial points
x0 = 0;
y0 = 0;
% movement of the pendulum
x1 = l*sin(Theta);
y1 = -l*cos(Theta);
figure (2);
% ploting string
plot([x0 x1],[y0 y1],'color','g');
hold on
% ploting the pendulum bob
plot(x1,y1,'o','markersize',10,'color','r','markerfacecolor','r');
hold off
axis([-1.2 1.2 -1.2 1.2]);
pause(0.001);
M(i) = getframe(gcf);
i = i+1;
end
movie(M);
videofile = VideoWriter('pendulum1.avi','Uncompressed avi');
open(videofile)
writeVideo(videofile,M)
close(videofile);
FUNCTIONCODE :- ODE_FUNC
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
ERRORS:-
RESULTS:-
The program executed and animation generated successfully.
ANIMATION:-
PLOT:-
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...
Underbody Coating
UNDER BODY COATING: We all are aware of the fact that the underbody of the previous models was made from durable metals such as steel, which is easily damaged and oxidized, forming rust While you are sitting on the driving seat enjoying the smooth ride, the underbody of your car is always exposed to muddy water, stones,…
11 Jul 2022 01:11 PM IST
Benchmarking
BENCHMARKING Benchmarking is a process of measuring the performance of a company's products, services, or processes against those of another business considered to be the best in the industry, "best in class." The point of benchmarking is to identify internal opportunities for improvement. By studying companies with…
11 Jul 2022 12:16 PM IST
Advanced Sheet Metal Design Using NX Cad Challenge_7_ Metal bracket-II
Advanced Sheet Metal Design Using NX Cad Challenge_7_ Meal bracket-11 Objective: The objective of this challenge is to design a metal bracket with mentioned tools and measurements in Sheet metal Application of Siemens NX. Introduction: A Bracket is a component used to support load or any attachments to structural…
06 Jul 2022 06:52 AM IST
Advanced Sheet Metal Design Using NX Cad Challenge_6_Bracket
Title of the project:- Advanced Sheet Metal Design Using NX Cad Challenge_6_Bracket Objective: To design a Bracket using Siemens NX Sheet metal application. Introduction:- 1. SIEMENS NX:- NX formerly known as "unigraphics", is an advanced high-end CAD/CAM/CAE, which has been owned since 2007 by Siemens PLM Software.…
06 Jul 2022 06:16 AM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.