Question: this is my code but it only does one swing - the requirement is that the pendulum have to do a full rotation of 2

 this is my code but it only does one swing -

the requirement is that the pendulum have to do a full rotation

this is my code but it only does one swing - the requirement is that the pendulum have to do a full rotation of 2 swings in -

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/30

theta =60+ 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-L1 cos(6) 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 arethe the length of the rod L, the acceleration due to gravity g and the inital angle e O, L) r,y) Figure 4.3: Diagram ofthe motion of a simple pendulum. The pivot is the small red circle. The bob is the large blue circle and the rod connects the pivotand the bob Ablack dotted line represents the path ofthe swing 8. You are going to write a script to create a video simulation of a pendulum using the following parameters Length L:2m Gravity g:9.81 ms nitial Angle 860 degrees The simulation will be tor a duration of one penod of the pendulum's swing, given by T=2nDg seconds Using the above formula calculate the period of this pendulum T in seconds

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!