numpy - Plotting FFT in Python digitized data -
i measuring voltage , sampling this. measured data want fft more information harmonics in voltage. however, results baffle me ... sampling frequency have choose here same sample frequency sampling voltage (and same samplepoints)? attached sample data set. should sine wave frequency of 1 khz. link data : https://www.dropbox.com/s/bdv6uiy3lkeoomk/data.mat?dl=0
the code looks follows:
%matplotlib inline import numpy np import matplotlib.pyplot fourier_plot import scipy.fftpack fft # number of samplepoints n = 16384 # sample spacing fs = 125e6/8 t = 1.0 /fs x = np.linspace(0.0, n*t, n) y = data yf = scipy.fftpack.fft(y) xf = np.linspace(0.0, 1.0/(2.0*t), n/2) fourier_plot.plot(xf, 2.0/n * np.abs(yf[:n//2])) fourier_plot.show()
Comments
Post a Comment