MOTION STUDY OF PENDULUM
- AIM: Program to simulate the transient behaviour of a simple pendulum and to create an animation of it\'s motion.
- Governing Equation :
- OBJECTIVE OF PROJECT: To To study how the time period of a simple pendulum .
changes when its amplitude (θ ) is changed.
- Body :
YOUTUBE LINK FOR SIMULATIONclear all close all clc b=0.05; g=9.81; l=1; m=1; ct = 1; %initial condition %initial displacement of pendulum is zero %we give intial angular velocity #rad/sec. theta_0 = [0;3]; %time points t_span = linspace(0,20,500); %Solve ODE [t,result] = ode45(@(t,theta) ode_func(t,theta,b,g,l,m),t_span,theta_0); %here we sub plot subplot(5,4,[13,14,17,18]); plot(t,result(:,1),\'color\',\'b\'); hold on; plot(t,result(:,2),\'color\',\'g\'); hold off; subplot(5,4,[15,16,19,20]); plot(result(:,1),result(:,2)); ylabel(\'plot\') xlabel(\'time\') legend(\'Displacement\',\'velocity\') %Animation For Pendulum ct = 1; for i=1:length(result(:,1)) x0 = 0; y0 = 0; x1 = l*sin(result(i,1)); y1 = -(l*cos(result(i,1))); subplot(5,4,[1,2,3,4,5,6,7,8,9,10,11,12]); plot([-1 1],[0 0],\'linewidth\',4 ,\'color\',\'k\'); hold on line([x0 x1],[y0 y1],\'linewidth\',3,\'color\',\'b\'); hold on; plot(x1,y1,\'-o\',\'markers\',20,\'markerfacecolor\',\'g\'); grid on axis ([-1.5 1.5 -1.5 0.5]) pause(0.03); hold off text = sprintf(\'pendulum%d.png\',ct); saveas(1,text) ct=ct+1; end
https://youtu.be/8lth_BgifXc
Function that is used avove Programme with name 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
- CONCLUSION
- From getting a simulation result clear the concept of Simple Pendulum.
- ALso gave how avobe equation is important to getting a result
- its show hoe time and amplitude depand