I have a series of discrete values measured from a sensor. I want to filter the frequencies coming from this sequence of values. Then, if I understood the process correctly this is what I do:
- I create a discrete fourier transform of the values
- I identify the bins that correspond to the frequencies I want to remove from the original signal using the formula
freq = (k * FPS)/N
, wherek
is the bin number (starting at zero),FPS
is the frames per second the signal is being captured andN
is the number of samples. - supposing I want to remove from the signal every frequency below 10 Hz and the 9th bin is equal to 10 Hz, then I zero, all the real and imaginary bins from 0 to 9 of the DFT result.
- then I reconstruct the signal using this inverse DFT results with certain bins zeroed (filtered).
If this process is correct, I do not understand one thing:
In my original signal I get only real values. I input these real values into the DFT algorithm using zeros for all imaginary parts. I get real and imaginary from the DFT. I filter the whole thing and do an inverse DFT. The final results is real and imaginary.
How do I get a real only signal after the inverse DFT? How do I get rid of the imaginary part and get a real only result?