I need a small clarification on this wonderful answer. I have generated an harmonic sample with 5 frequencies (3 9 15 21 27), using the Fourier series formula for square wave. Then I sampled it at 32Hz, expecting to identify first 3 frequencies which are below the Nyquist limit. After I passed the 32 samples(16bit) through the FFT function, I calculated the magnitude using sqrt(real^2 + imag^2).
Generated Frequencies: 3 9 15 21 27
The magnitudes [sqrt(real^2 + imag^2)] after FFT:
6.87475e-15
2.71352e-15
2.14864e-16
20.3718-----------3
1.75333e-15
2.26354-----------5
3.97083e-15
1.16198e-14
2.33558e-14
6.79061-----------9
9.38245e-15
2.91026-----------11
6.42032e-15
9.03851e-15
1.48744e-14
4.07437-----------15
So... I found 5 frequency bins having high magnitudes. I know only 3, 9, 15 are the valid values expected. But I see 5 and 11 having respectable magnitudes. How do I determine the cut-off magnitude to discard these invalid frequency bins?