Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. The equation for the motion of a pendulum with small angles is where ?-angle of pendulum in radians ??-initial angle of pendulum in radians
2. The equation for the motion of a pendulum with small angles is where ?-angle of pendulum in radians ??-initial angle of pendulum in radians g acceleration due to gravity, 9.81 m/s2 L = length of pendulum, meters t- time, seconds Note that "t" is not under the square root sign. The exercise has 2 parts, a function to calculate a set of angles and a script to call the function and plot the results. Here's the "recipe": Write a function called pendulum angle. It has 2 inputs. One is the length of the pendulum, called length. The other is a vector of time values, called time. In the function set the value of g to 9.81 and the value of theta0, the initial angle, to 0.1. These are "hard-wired" values, not inputs. Calculate the vector of angles theta using the equation. The output of the function is theta. In a separate file write a script as follows: 1. 2. 3. 4. Prompt the user for the input value of the length of the pendulum, call the resulting variable mvlenath a. b. Create the time vector called mytime, setting it to the values 0 to 5 in increments c. d. e. f. g. of 0.05. Calculate the vector of angles by calling the function, calling the result angles. Plot angles vs. mytime. Label the x axis "Time (s)" Label the y axis "Angle (degrees)" Put a grid on the plot Run the program with an input length of 1.0. Your resulting plot should look like this
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started