Question: Need help with creating a pendulum in Matlab. DO NOT COPY PASTE FROM SOMEWHERE ELSE!! pendulum example: https://www.dropbox.com/s/g228uu2bskn9i8o/pendulum_example.avi?dl=0 This is what I've done so far,

Need help with creating a pendulum in Matlab. DO NOT COPY PASTE FROM SOMEWHERE ELSE!!

Need help with creating a pendulum in Matlab. DO NOT COPY PASTE

FROM SOMEWHERE ELSE!! pendulum example: https://www.dropbox.com/s/g228uu2bskn9i8o/pendulum_example.avi?dl=0 This is what I've done so

far, but the video I get from this results causes the pendulum

to go around a full circle instead of 60 degrees likes its

pendulum example: https://www.dropbox.com/s/g228uu2bskn9i8o/pendulum_example.avi?dl=0

This is what I've done so far, but the video I get from this results causes the pendulum to go around a full circle instead of 60 degrees likes its supposed to .

L = 2

g = 9.81

T = 2*pi*sqrt(L/g)

myVideo2 = VideoWriter('pendulum')

open(myVideo2)

set(figure, 'Visible', 'on')

for t = 0:0.001:T;

theta = 60*cos(sqrt(g/L*t));

x = L*sin(theta);

y = L*(1 - cos(theta));

x2 = [0 x];

y2 = [L y];

plot(x, y, 'b.', 'MarkerSize', 40)

hold on

plot(x2, y2,'k' ,'linewidth', 3)

hold off

axis equal

axis([-2,2,-2,2])

drawnow

frame = getframe;

writeVideo(myVideo2, frame)

end

close(myVideo2)

The motion of a pendulum (more specifically, the "bob" at the end of the pendulum) can be described mathematically by the equations y: L(1-cos()) Here x and y are the coordinates of the bob at time t , and ("theta") is the angle the rod makes with the vertical (see Figure 4.3). The parameters in this model are the the length of the rod L, the acceleration due to gravity g and the initial angle

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!