Esteban Martinez, Andres Heredia
The purpose of this lab is to find out the effects of mass on the oscillation of a spring scale. We will put several weights on the scale and record the oscillation time five times, after which we will take the average.
mass (g) | avg. time (s) |
---|---|
50 | .29 |
100 | .44 |
150 | .47 |
200 | .53 |
250 | .61 |
300 | .71 |
In [1]:
%matplotlib inline
In [8]:
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
mass = [ 50, 100, 150, 200, 250, 300]
time = [ .29, .44, .47, .53, .61, .71]
xx = np.linspace(0,400,10)
def lin_model( x, a, b):
return a*x + b
a,b = curve_fit(lin_model, mass, time)[0]
print(a,b)
plt.title('Oscillation Time on a Spring Scale')
plt.ylabel ('Time (s)')
plt.xlabel ('Mass (g)')
plt.plot(xx, lin_model(xx, a, b))
plt.plot(mass,time,'ro')
Out[8]:
In [ ]: