In [5]:
import numpy as np
import numpy.fft as fft
import matplotlib.pyplot as plt
from numpy.fft import fftshift
%matplotlib


Using matplotlib backend: MacOSX

In [6]:
y_in = np.array([0,0,0,0,1,0,0,0])
y_in_2 = np.array([0, 0, 1, 1, 1, 1, 0, 0])

In [7]:
y_out = fftshift(fft.fft(fftshift(y_in)))
y_out_2 = fftshift(fft.fft(fftshift(y_in_2)))

In [4]:
f0, [ax0, ax1] = plt.subplots(1,2)

ax0.plot(y_out)
ax1.plot(y_out_2)


/Users/Yigong/anaconda/lib/python2.7/site-packages/numpy/core/numeric.py:320: ComplexWarning: Casting complex values to real discards the imaginary part
  return array(a, dtype, copy=False, order=order)
Out[4]:
[<matplotlib.lines.Line2D at 0x104daf910>]

In [26]:
fft.fftshift?

In [ ]: