Python Forum
FFT - sum of amplitudes - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: FFT - sum of amplitudes (/thread-37294.html)



FFT - sum of amplitudes - frohr - May-24-2022

Hi,
I have 30k samples and I make FFT.
Size of amplitudes in FFT is ok.
But I want make sum of all amplitudes and here I can see wrong number. For example here:

SAMPLES = 30000
T = 1 / 30000

x = np.linspace(0.0, SAMPLES*T, SAMPLES, endpoint=False)
y = v_data  # v_data are from csv file, attached
yf = fft(y)
xf = fftfreq(SAMPLES, T)[:SAMPLES//2]
self.canvas.axes.cla()
self.canvas.axes.set_ylabel("Amplitude in g RMS")
self.canvas.axes.set_xlabel("Frequency in Hz")
self.canvas.axes.plot(xf, 2.0/SAMPLES * np.abs(yf[0:SAMPLES//2]))
print(sum(2.0/SAMPLES * np.abs(yf[0:SAMPLES//2])))
FFT picture:
https://ibb.co/Z1tgjBs

FFT seems OK.
If I use
print(sum(2.0/SAMPLES * np.abs(yf[0:SAMPLES//2])))
I can see number 14.39 and it is nonsense. I need to see something about 1.
What I do wrong? How to correctly sum all amplitudes from FFT?


Data file excel:
https://file.io/YBMdA8plul3N

Any idea?
Thanks.