4

There's something I don't understand: I computes the spectral density of a signal (by computing its FFT) and that seems to work correctly but it keeps having some kind of background noise, although I'm doing it on a perfect sine wave with 2 frequencies (10 and 30Hz) that I generate myself.

Of course, the noise isn't really too annoying, because it is only visible with a logarithmic scale, but even, where does it come from ? Is that normal ? Do I have a bug in my signal, or anywhere ?

Energy spectral density of 10 + 30Hz sin wave

user978548
  • 711
  • 2
  • 7
  • 12
  • 1
    a complex transform is using `cos+i*sin` as basis functions, so it is **exactly** the same as using sin/cos separately (I mean, it is not an approximation). – Itamar Katz Mar 28 '12 at 09:36
  • Thanks for correcting me ! In addition, thanks to your comment, I went to check and so understood many things about those fft algos for real inputs ! – user978548 Mar 28 '12 at 16:52

1 Answers1

5

It is mainly quantisation noise, but there may also be a small amount of noise from floating point rounding errors etc in the FFT itself.

Your "perfect sine wave" can not be perfectly represented in digital form, since you will always have finite precision. The difference between the theoretical value of a waveform at the time that it is sampled and the actual sample value is called "quantisation error". For N bit integer data the error will typically be approximately evenly distributed over the range +/- 0.5 LSB and will be notionally "white", i.e. have a roughly flat spectrum. Obviously the greater the sample resolution (greater N), the smaller the quantisation errors, but since N can not be infinite, there will always be a finite amount of quantisation noise. For N=16 bits, as used in e.g. "CD quality" digital audio, the quantisation noise is typically around 96 dB below full scale.

Paul R
  • 208,748
  • 37
  • 389
  • 560
  • Thanks for this perfectly understandable answer ! I was not very aware of those problems, but that will become essential for me to know that because I intend to work with signals containing relevant infos in high amplitudes as well as in very low. I'll look further into `Dither` (which, if I understood correctly, can help me avoid detecting false informations at such low amplitudes) Thanks again ! – user978548 Mar 26 '12 at 14:20
  • 1
    Dithering will whiten (i.e. flatten) the noise floor, but it won't reduce it overall. This may still help you to avoid false positives, however. Also look into spectral averaging, ensemble averaging, etc. – Paul R Mar 26 '12 at 15:56