Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions