signal processing - FFT coefficients using python -
i newbie in signal processing. in here, want ask how fft coeffients fft in python. example of code:
from scipy.fftpack import fft # number of samplepoints n = 600 # sample spacing t = 1.0 / 800.0 x = np.linspace(0.0, n*t, n) y = np.sin(50.0 * 2.0*np.pi*x) + 0.5*np.sin(80.0 * 2.0*np.pi*x) yf = fft(y) xf = np.linspace(0.0, 1.0/(2.0*t), n/2) import matplotlib.pyplot plt plt.plot(xf, 2.0/n * np.abs(yf[0:n/2])) plt.grid() plt.show()
hmm don't know signal processing either maybe works:
from scipy.signal import argrelmax f = xf[scipy.signal.argrelmax(yf[0:n/2])] af = np.abs(yf[argrelmax(yf[0:n/2])])
Comments
Post a Comment