I have tried different Fourier transform codes out there on single sine waves, and all of them produce a distributed spectrum with a resonance at the signal frequency when they should theoretically display a single bar.
The sampling frequency has little effect (10kHz here), however the number of cycles does:
One cycle:
100 cycles:
100000 cycles:
It looks like the fourier transform converges only for an infinite number of cycles, why is that? Shouldn't a time window of exactly one cycle bring the same results as that of N cycles?
Application: This is both out of curiosity and also because I want to get how much the step response of a first order system will be exciting the resonance of a mechanical assembly. Therefore I need an accurate Fourier transform of the response... Which I don't trust anymore. What could I do to improve the accuracy then, based on the "sine wave" case?
P.S: These particular screenshots are based on the code here.