All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
in the above equation g= gravity in m/s^2 L= length of the pendulum in meter. m= mass of the ball in kg. b= damping coeffecient. let Θ=Θ1 dΘ1/dt=Θ2 dΘ^2/dt^2=dΘ/dt Input: L=1 metre m= 1kg b=0.05 g= 9.81m/s^2 time span=0-20 sec angular displacement=0 angular velocity=0 angular…
Yogessvaran T
updated on 10 Aug 2022
in the above equation
g= gravity in m/s^2
L= length of the pendulum in meter.
m= mass of the ball in kg.
b= damping coeffecient.
let Θ=Θ1
dΘ1/dt=Θ2
dΘ^2/dt^2=dΘ/dt
Input:
L=1 metre
m= 1kg
b=0.05
g= 9.81m/s^2
time span=0-20 sec
angular displacement=0
angular velocity=0
angular velocity=3 rad/sec2 at time t=0
Code:
% program to simulate the transient behaviour of a simple pendulam
clear all
close all
clc
%inputs
b=0.05;
g=9.81;
l=1;
m=1;
% initial condition
theta_0= [0;3];
% time points
t_span= linspace(0,20,500);
%solve ODE
[t, results]= ode45(@(t, theta) ode_func(t, theta,b,g,l,m),t_span, theta_0);
%ploting
plot(t, results(:,1))
hold on
plot(t, results(:,2))
ylabel( 'Plot' )
xlabel( 'Time in sec' )
%Iletration using for loop to create animation of simple pendulam of simple pendulam
ct=1;
theta_1= results(:,1);
for i= 1:length(results(:,1))
%initial co-ordinates
x_start=0;
y_start=0;
theta_2= theta_1(i);
%final co-ordinates
x_end= 1*sin(theta_2);
y_end= -1*cos(theta_2);
% ploting for animation
figure(2)
%base of pendulum
plot([-1,1],[0,0], 'linewidth',4, 'color', 'black')
hold on
%string of pendulum
line([x_start x_end],[y_start y_end], 'linewidth',6, 'color', 'b')
hold on
% bob of pendulum
plot(x_end,y_end, 'marker', 'o', 'markersize', 28, 'markerfacecolor','r')
axis([-2 2 -2 2])
pause(0.03)
hold off
M(ct)=getframe(gcf);
ct=ct+1;
end
Code for function program:
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
Explanation for each step for the problem:
1. in the step input and initial condition of a simple pendulum are fed.
2. then the program is written to solve the ODE in which Matlab inbuilt function (ode45) is used with constant theta t, and another function is used, which is defined seperately in function program.
3. In the next step fo result of solved ODE is plotted w.r.t time using plot command.
4. Now iteration of co-ordinate is fed using for loop to create animation.
5.Then plot command is used to plot pendulum string and bob.
Output:
1. The output obtained is graphical representation velocity curve and displacement curve w.r.t time.
Angular displacement and angular velocity plots wer generated for a time range of 20 seconds.
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...
Week 14 challenge
ASSEMBLY OF BUTTERFLY VALVE:- 1.All the parts that are saved in the required folder is opened in the Add components tool box. 2.Now using the Move option and Assembly Constraints option the different parts are joined together with the help of Align,touch,infer/Axis operations. 3. Finally,the assembly of butterfly valve…
18 Feb 2023 09:34 AM IST
Project - Position control of mass spring damper system
To design a closed loop control scheme for a DC motor the following changes need to be done in the model in the previously created model. Speed is the controllable parameter, so we will set the reference speed in step block as 10,20, 40 whichever you want. Subtract the actual speed from the reference speed to generate…
21 Jan 2023 10:29 AM IST
Project - Analysis of a practical automotive wiring circuit
Identify each of the major elements in the above automotive wiring diagram. Ans: Major Elements in the above automotive wiring diagram are - Genarator, Battery, …
14 Dec 2022 03:37 AM IST
Week 6 - Data analysis
-
04 Dec 2022 11:06 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.