Project

program to simulate the transient behaviour of a simple pendulum

*********** Comments by Grader ************


Code is correct but the graph you plotted is wrong as here it is expected to show how displacement and velocity are changing w.r.t time and you have shown how displacement is changing w.r.t time and you have not shown how velocity is changing w.r.t time rather you showed how velocity is changing w.r.t displacement.

Marks here are deducted for the above mentioned reasons.

SUGGESTION :

The other thing that you can do is to attach the code and images in

projects.skill-lync.com and paste the link over here.

If you have any doubts please ask us on WATS APP or raise a ticket on FRESHDESK or even you can call us clarify all your doubts.

Please don\'t submit incomplete work as these challenges are made with an intuition of improving your understandig regarding the topic.

So attempt all challenges sincerely.

Thank you.

Graded by : Mehul Shah

The way the pendulum moves depends on the Newtons second law. When this law is written down, we get a second order Ordinary Differential Equation that describes the position of the \"ball\" w.r.t time.

Similarly, there are hundreds of ODEs that describe key phenomena and if you have the ability to solve these equations then you will be able to simulate any of theses systems.

here is the program for pendulum

clear all
close all
clc
l=1;
b=0.5;
m=1;
g=9.81;
%time
t_span= linspace(0,20,100);
%initial condition and velocity of pendulum
theta_0 = [0;3];
%ode function
[t , results] = ode45(@(t, theta) ode_func(t,theta ,b,g,l,m),t_span,theta_0);
figure(1)
plot(t_span, results(:,1), \'color\' , \'b\');
hold on
grid on
plot(results(:,1),results(:,2));
xlabel(\'position-radian\');
ylabel(\'angular-velocity\');

ct=1
for i = 1:length(results(:,1))
x0=0
y0=0
x1=l*sin(results(i,1));
y1=-l*cos(results(i,1));
figure (2);
plot([1 -1] ,[0 0], \'linewidth\', 3 ,\'color\', \'r\' )
hold on
plot(x1,y1 ,\'-o\', \'markeredgecolor\',\'b\',\'markerfacecolor\',\'r\',\'markersize\',10)
hold on
plot([x0 x1],[y0 y1],\'linewidth\',2,\'color\',\'b\')
hold off
pause=0.001;
axis([-2 2 -1.5 0])
v(ct)=getframe(gcf);
ct=ct+1;

end
movie(v)
videofile=VideoWriter(\'d:\\samplependulum.avi\',\'uncompressed AVI\')
open(videofile)
writeVideo(videofile,v)
close(videofile)

the graph for pendulum with solution for 2nd order ODE

\"

video link for pendulum motion

video will be live at: https://youtu.be/WMUoEq7ML64

plz visit to above link to view video

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.