Advertisement
Guest User

Untitled

a guest
Jul 31st, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. # <nbformat>3.0</nbformat>
  3.  
  4. # <codecell>
  5.  
  6. %matplotlib inline
  7.  
  8. # <codecell>
  9.  
  10. import pylab as pl
  11. import numpy as np
  12.  
  13. # <codecell>
  14.  
  15. freq = 100
  16.  
  17. # <codecell>
  18.  
  19. a = np.arange(1000)
  20. a = a/1000.0*(np.pi*2*freq)
  21. i = np.cos(a)
  22. q = np.sin(a)
  23. c = i + 1j * q
  24.  
  25. # <codecell>
  26.  
  27. pl.plot(i)
  28.  
  29. # <codecell>
  30.  
  31. f = np.fft.fft(c)
  32. f = np.abs(f)
  33. f = np.fft.fftshift(f)
  34.  
  35. # <codecell>
  36.  
  37. pl.plot(f)
  38.  
  39. # <codecell>
  40.  
  41. for i in range(len(f)):
  42. print str(i) + " " + str(int(f[i]))
  43.  
  44. # <codecell>
  45.  
  46.  
  47. # <codecell>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement