Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function called pendulum that is called like this: T = pendulum(L,a0), where all arguments are scalars and a0 is a positive number less

Write a function called pendulum that is called like this: T = pendulum(L,a0), where all arguments are scalars and a0 is a positive number less than . The function calculates the period T of a simple pendulum, which is the time required for a weight attached to a rod of length L and negligible weight to start from rest, swing with no friction under the influence of gravity from an initial angle a0, to a0 and back to a0 again, as shown in the figure. The motion is determined by physics using the following definitions, where units [square brackets] are provided but are not needed:

image text in transcribedThe function starts its calculation with the pendulum angle equal to a0 and then calculates a sequence of decreasing pendulum angles, each at a time separated from the one before it by t = 1 10-6 s. It continues until the pendulum has passed its lowest point, at which = 0. The elapsed time equals T/4.

The calculation at each time step proceeds as follows: The angular acceleration is set equal to sin/L. Then the angular velocity is increased by the product of the angular acceleration and t. That new angular velocity is then used to obtain a new by adding the product of the angular velocity and t to the old .

Here are two sample runs, also use the inputs below as test inputs:

>> format long

>> T = pendulum(2, pi/2)

T =3.350344000012992

>> T = pendulum(0.22952, pi/4)

T =1.000000000000917

0 = angle (radians) w = angular velocity (radians/s] a = angular acceleration (radians/s2) g= acceleration due to gravity = 9.8 [m/s?) t = time [s] -a0 ao 0 = angle (radians) w = angular velocity (radians/s] a = angular acceleration (radians/s2) g= acceleration due to gravity = 9.8 [m/s?) t = time [s] -a0 ao

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions

Question

What is order of reaction? Explain with example?

Answered: 1 week ago

Question

Derive expressions for the rates of forward and reverse reactions?

Answered: 1 week ago

Question

Write an expression for half-life and explain it with a diagram.

Answered: 1 week ago

Question

LO5 Highlight five external recruiting sources.

Answered: 1 week ago