# DFT and then IDFT does not provide the same signal

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

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).

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).

EDIT:

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:

In cyan/purple : Re/Im parts

In red: final result.

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

Thanks everyone.

• 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. – Dilip Sarwate Aug 23 '13 at 1:24