Say I'd like to bandpass filter a signal with corner frequencies 1 kHz and 2 kHz (i.e., passes signals between 1 kHz and 2 kHz and suppresses other frequencies) using software like MATLAB. Intuition tells me there's two ways to do this:
- Use filter design tools to create, say, a 10th order Butterworth filter. Use the filter command with the filter coefficients and input signal. This works, but the filter is nonideal (specifically, there will be some passband ripple, and the frequency cutoffs won't be immediate -- a signal at say, 2.1 kHz, will still be partially passed).
- Perform an FFT on the input signal. Set any FFT element corresponding to a frequency outside the 1 kHz-2 kHz range to zero. Inverse FFT the input signal. This will essentially be an ideal filter -- anything between 1kHz-2 kHz is passed with unity gain (no passband ripple), and anything outside 1 kHz-2 KHz is exactly zero (immediate cutoff).
Intuition tells me that #2 is better, because it's an ideal filter. I've learned that an ideal filter can't be built using analog components, but if a certain application is purely digital, why not use the ideal filter?
That being said, I've seen lots of code that uses tools like a nonideal 10th order Butterworth filter -- so what am I overlooking? What's the advantage of using a nonideal filter?