1 2 3 4 5 6 7 8 9 10 11 12 13 14
import numpy as np import matplotlib.pyplot as plt from scipy.fft import fft, ifft from scipy import signal t=np.arange(0,100,0.1) x= np.cos(2*np.pi*t) y= fft(x) p= np.linspace(0,1000,1,endpoint=True) u = signal.square( np.pi*5*p) e = np.fft.fft(u) plt.plot(p,e)