Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # <nbformat>3.0</nbformat>
- # <codecell>
- %matplotlib inline
- # <codecell>
- import pylab as pl
- import numpy as np
- # <codecell>
- freq = 100
- # <codecell>
- a = np.arange(1000)
- a = a/1000.0*(np.pi*2*freq)
- i = np.cos(a)
- q = np.sin(a)
- c = i + 1j * q
- # <codecell>
- pl.plot(i)
- # <codecell>
- f = np.fft.fft(c)
- f = np.abs(f)
- f = np.fft.fftshift(f)
- # <codecell>
- pl.plot(f)
- # <codecell>
- for i in range(len(f)):
- print str(i) + " " + str(int(f[i]))
- # <codecell>
- # <codecell>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement