In [5]:
from pylab import *
%matplotlib inline
In [6]:
x = linspace(0.0,10.0,300)
plot(x,x**4*exp(-2*x),label="(a)")
plot(x,(x**2*exp(-x)*sin(x**2))**2,label="(b)")
legend()
title("Problem 0-0")
xlabel("x")
ylabel("y")
xlim([0,8.0])
Out[6]:
In [20]:
frequency, mic1, mic2 = loadtxt('../files/microphones.txt', unpack=True)
In [21]:
loadtxt?
In [22]:
plot(frequency, mic2/mic1)
title("Mic ratio")
ylabel("mic2/mic1")
xlabel("Frequency (Hz)")
Out[22]:
In [ ]:
counts,time = loadtxt('../files/Ba137.txt', unpack=True)
In [ ]:
plot(time,counts)
In [ ]:
semilogy(time,counts)
title("Log scale")
ylabel("Counts")
xlabel("Time (s)")
In [ ]:
plot(time,log(counts))
title("Log of raw data")
ylabel("log(counts)")
xlabel("Time (s)")
In [ ]:
N=30000
l=1/240
semilogy(time,counts,"r.")
semilogy(time,N*exp(-l*time),"b")
title("Log of raw data")
ylabel("log(counts)")
xlabel("Time (s)")
In [ ]:
t_half = log(2)/l
t_half
In [ ]:
M = matrix([ [2,-1,0,0], [-1,2,-1,0], [0,-1,2,-1], [0,0,-1,2] ])
In [ ]:
linalg.eig(M)
In [ ]:
t = linspace(0.0,3.0,100)
x = 0 + 15*t + 0.5*(-9.8)*t**2
v = 15 - 9.8*t
a = -9.8*ones(len(t))
f, (ax1, ax2, ax3) = plt.subplots(3, sharex=True, sharey=False)
ax1.plot(t,x,'b')
ax1.set_ylabel("Position (m)")
ax2.plot(t,v,'g')
ax2.set_ylabel("Velocity (m/s)")
ax3.plot(t,a,'r')
ax3.set_ylabel("Acceleration (m/s$^2$)")
xlabel("Time (s)")
In [ ]: