eyes17/code/FourierTransform.py
raw| 1 | #import eyes17.eyes # uncomment these two lines while running stand-alone |
| 2 | #p = eyes17.eyes.open() |
| 3 | |
| 4 | from pylab import * |
| 5 | import eyes17.eyemath17 as em |
| 6 | |
| 7 | p.set_sine(1000) |
| 8 | p.set_sqr1(500) |
| 9 | |
| 10 | t,v, tt,vv = p.capture2(5000, 20) # captures A1 and A2 |
| 11 | |
| 12 | xlabel('Freq') |
| 13 | ylabel('Amplitude') |
| 14 | xlim([0,10000]) |
| 15 | |
| 16 | xa,ya = em.fft(v,20*0.001) |
| 17 | plot(xa,ya, linewidth = 2, color = 'blue') |
| 18 | |
| 19 | xa,ya = em.fft(vv, 20*0.001) |
| 20 | plot(xa, ya, linewidth = 2, color = 'red') |
| 21 | |
| 22 | show() |