Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. You\'ve learned about pendulum physics, so these questions will put your unde

ID: 3557387 • Letter: 1

Question

1. You've learned about pendulum physics, so these questions will put your understanding to the test. Create a function that returns the position of a pendulum with the following properties after 400 seconds.

Rod length: 20 units

Initial offset: 32 degrees

Bob mass: 2 units

Gravity: 5.23 units/s^2

Your function should return the angle of the pendulum in radians. Your function should also accept 5 inputs in the following order: length of rod, initial offset, bob mass, gravity, and time. You may name these variables whatever you wish.

2. Use the same function from question 1. This time, your function should return the pendulum angle, period, and frequency (in this order). You should return period in seconds and frequency in GHz.

Use the following parameters:

Explanation / Answer

Following are the steps:

1. Save the code written below in desktop in a matlab file called pendulum.m

2. In Matlab terminal navigate to the desktop

3. write pendulum(19,0,1,9,2); to run the program

function [angle, timeperiod] = pendulum(length,offset,mass,gravity,time)

%We make use of the fact that the angle at any given time is related to
%initial amplitude through the relation: angle = amplitude
%*sin(omega*t+offset)
offset = offset * pi/180;
timeperiod = 2*pi*sqrt(length/gravity);
angle = sin(1/timeperiod*time);

dispval = ['Time period in seconds is:: ',num2str(timeperiod)];
dispval2 = ['Time period in Hz is:: ',num2str(1/timeperiod)];
dispval1 = ['Angle is:: ',num2str(angle)];

disp(dispval)
disp(dispval2)
disp(dispval1)