The drawing I draw with the code below is just the peak around ZERO, no matter how I modify the data. My data is just one column in which all the time points of a signal are recorded. Is the time_step value a value that I have to determine according to the interval of two neighboring points in my data?
data=np.loadtxt("timesequence",delimiter=",",usecols=(0,),unpack=True) ps = np.abs(np.fft.fft(data))**2 time_step = 1 freqs = np.fft.fftfreq(data.size, time_step) idx = np.argsort(freqs) pl.plot(freqs[idx], ps[idx]) pl.show()
python numpy fft signal-processing
questionhang
source share