Help me understand the stages involved in filtering a signal using Discrete Fourier Transform 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, where k is the bin number (starting at zero), FPS is the frames per second the signal is being captured and N 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?
A purely real time domain signal has a frequency transform such that positive and negative frequencies are complex conjugated of one another.  If you are scaling the positive bin, but not the negative, you are implementing a complex filter kernel, resulting in a complex output.

Side note, you can’t just change the magnitude of a frequency bin in a frame and do an inverse transform in real time processing.  The phases of adjacent bins won’t line up.  This is a more advanced topic beyond the scope of your question.