- import numpy as np
- import pylab as plt
- from scipy.fftpack import fft
- N = 500 # number of sample points
- dt = 1. / 1000 # sample spacing
- npp=3
- nN=N*npp
- t = np.linspace(-N*dt, N*dt, nN)
- y=np.sinc(200*t)
- #y=np.abs(np.sinc(t))
- plt.figure(1)
- plt.plot(t,y)
- plt.grid(True), plt.xlabel('Tiempo')
- plt.title(u'Sinc(200t)')
- plt.xlim([-6./200,6./200])
- # FFT
- yf = fft(y)
- tf = npp*np.linspace(-1./(4.*dt), 1./(4.*dt), nN)
- spectrum = 1./nN * np.concatenate([np.abs(yf[nN/2:nN]), np.abs(yf[0:nN/2])])
- #figure1 = plt.figure(4, (10, 5))
- plt.figure(2)
- plt.plot(tf, spectrum, '-')
- plt.grid()
- plt.xlim([-300,300])
- plt.title(u'Espectro de magnitud |X(j$\omega$)|')
- plt.xlabel('Frecuencia [Hz]')
- plt.ylabel('Magnitud |X(j$\omega$)|')
Transformada de Fourier de la función Sinc.
Suscribirse a:
Comentarios de la entrada (Atom)
No hay comentarios.:
Publicar un comentario