I'm new at Fourier Transforms. I'm using AForge.Math FFT/DFT algorithm (C#). Said that I have this situation:

enter image description here

My signal:

$$ 1.4 + sin(2\pi t) + 0.4sin(5·2\pi t) $$

Sampling: 100 samples each second.

Here is the spectrum. The DFT finds the frequencies of my signal: 1Hz and 5Hz (and the constant component: 0Hz).

enter image description here

enter image description here

enter image description here Here is the inverse transform. As you can see the result is similar in shape to the original but obviously something is happening there.

My questions:

  • What parameters can I change to get better results.
  • Should I expect to completely be able to regenerate the signal in time domain from the spectrum?
  • Can the IDFT be used as a signal generator? It's very easy to create the peaks at the desired frequencies.
  • Maybe I need to go to the books, but, why there is always a mirrored frequencies in the DFT and how should I interpret them? I don't have any frequencies at 95Hz nor 99Hz. Is it a flaw of the DFT?
  • Why the initial point is not mirrored?
  • The amplitudes of the peaks in the spectrum are not correct: the first one should be 1 and the second 0.4. I've heard that the amplitudes in a spectrum are not important, is that truth, if so why? Anyway, I think it's very useful to know what is the amplitude of the sinusoids, is there a way to do that?
  • Can I throw away the symmetric part?
  • If so, can I throw away the almost null values till the first frequency from the middle to start? (in my case from 50Hz to almost 5 Hz).


As pointed here I needed to, first keep the real/imaginary data from the direct transform and, second, adapt that data because I'm using an complex inverse DFT.

Here are the results:

enter image description here

In cyan/purple : Re/Im parts

enter image description here In red: final result.

The X spacing is wrong but that's a story for another day.

Thanks everyone.

  • 1
    $\begingroup$ What is the length $N$ of your DFT? If you use $N=2^m$ in order to get an efficient FFT, there will be problems with things not fitting in single bins. $\endgroup$ Aug 23, 2013 at 1:24

1 Answer 1


If you want your IFFT result to match the input to the FFT, don't throw away either the "imaginary" (or sine correlation) components, or the "upper half" of the spectrum, before the IFFT. Also make sure the input to the IFFT is exactly conjugate symmetric, so that all the imaginary components in the IFFT results get cancelled out (except for rounding errors or quantization noise). The length of the IFFT has to be the same as that of the FFT.

Your 99 and 95 Hz components are also the -1 and -5 Hz components needed (in complex conjugate symmetry) to cancel out any rotation of the time domain data into the imaginary plane. Since the FFT is a complex to complex transform, you can't just ignore these components even when dealing with strictly real data.

The 0 Hz or DC component of an FFT result appears double height because it includes it's own mirrored value.

Unless your sinewave's are exactly periodic within the FFT length, you will need to interpolate the true amplitudes, since their peaks will be between the FFT result bin centers.

The IDFT and IFFT can be used as signal generators, although great care must be taken with phase for any frequencies that are not exactly periodic in the FFTs length. See Phase Vocoder analysis/synthesis for details.

  • 1
    $\begingroup$ Thank you, the key to be able to regenerate the original signal is treating properly the Re/Im parts. $\endgroup$
    – Sturm
    Aug 23, 2013 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.