Modulación AM.

#AM modulation
# Funcion SINC
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=9
nN=N*npp
t = np.linspace(-N*dt, N*dt, nN)

y=np.sinc(150*t)*np.cos(2*np.pi*400*t)
#y=np.abs(np.sinc(t))
plt.figure(1)
plt.plot(t,y, linewidth=2)
plt.grid(True), plt.xlabel('Tiempo')
plt.title(u'x(t)=sinc(150t)*cos(2 $\pi$ (400)t)')
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, linewidth=2)
plt.grid()
plt.xlim([-700,700])
plt.title(u'Espectro de magnitud |X(j$\omega$)|')
plt.xlabel('Frecuencia [Hz]')
plt.ylabel('Magnitud |X(j$\omega$)|')

No hay comentarios.:

Publicar un comentario