0
votes

I have a sequence of real numbers and I want to compute the FFT on it. The FFT function requires complex numbers.

So can I set the imaginary value to 0 and compute the FFT?

Next question is when I get the result values (frequency domain values), they are in complex format.

If I do the inverse of the FFT on these complex values, can I discard the imaginary component and use just real part of the result?

2
A slight alternative is cosine transformsAlexandre C.

2 Answers

2
votes

You set the real parts of your complex input to the signal sample values and the imaginary parts to zero. Alternatively you can use a real-to-complex FFT, which may also be a little faster than a normal complex-to-complex FFT.

As for the inverse FFT - so long as your frequency domain complex values have complex conjugate symmetry (which they will have if your input is purely real), then the IFFT will give you a purely real time domain signal again. If you modify your frequency domain values prior to the IFFT then make sure you maintain the complex conjugate symmetry. Again you can also consider using a complex-to-real IFFT, which may be more efficient and will relieve you of the job of maintaining the symmetry.

1
votes

For this type of math, a real number IS just a complex number with an (assumed or explicit) imaginary part equal to zero.

If the frequency data you feed an IFFT computation is conjugate symmetric, then the imaginary values in the result will be tiny compared to the real values, mostly numerical noise from using finite precision arithmetic. If you understand significant digits of precision, you will note that these values all round to zero for any reasonable or useful precision.