Skip to content

Instantly share code, notes, and snippets.

@goatandsheep
Created December 10, 2016 19:39
Show Gist options
  • Save goatandsheep/1daaf5e9d7febb9805b7ca64eb1ee8d7 to your computer and use it in GitHub Desktop.
Save goatandsheep/1daaf5e9d7febb9805b7ca64eb1ee8d7 to your computer and use it in GitHub Desktop.
import scipy as sp
pi = sp.pi
def div(x,y):
try:
return x/y
except:
return (x+1e-15)/(y+1e-15)
L = 4
w = sp.linspace(-pi, pi, 501)
#w = sp.arange(-pi,pi, pi/250)
print len(w)
adiv = sp.vectorize(div)
#print adiv(w, w+.001)
#H = (1./L)*adiv((1-sp.exp(-1j*w*L)), 1-sp.exp(-1j*w))
H=(1./L)*(1-sp.exp(-1j*w*L))/(1-sp.exp(-1j*w))
import matplotlib.pyplot as plt
plt.plot(w, abs(H))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment