2
$\begingroup$

I'm writing a C++ application to extract four modulated carrier signals at four separate frequencies, from a single input signal. I've designed four FIR filters at t-filter.appspot.com but they run very slowly, even when I reduce # of taps to 80.

Is there a better option? People seem to point to biquad filters – are these different from FIR filters, and do they run more quickly in software?

$\endgroup$
  • 1
    $\begingroup$ Have you considered doing this in the frequency domain ? $\endgroup$ – Paul R May 7 '13 at 8:06
  • 2
    $\begingroup$ One biquad runs a lot faster than a FIR filter with 80 taps. A biquad filter has 5 coefficients, so it requires only 5 multiplications per sample. Your FIR filter requires 80 multiplications per sample (because it is linear phase it only requires 40 multiplications). $\endgroup$ – niaren May 7 '13 at 8:39
  • 1
    $\begingroup$ Paul R is right; this application could be a good candidate for frequency-domain filtering, for instance using the overlap-save technique. $\endgroup$ – Jason R May 7 '13 at 12:12
  • 2
    $\begingroup$ @niaren is right. A biquad is very fast and much less complicated than taking FFTs and worrying about edge effects. See www-users.cs.york.ac.uk/~fisher/mkfilter for an online design tool (very simple text interface, no graphing like t-filter.) You might try the "Chebyshev" or "resonator" options. $\endgroup$ – Wandering Logic May 7 '13 at 12:35
  • $\begingroup$ Discrete wavelet transforms could maybe help you. They are definitely fast enough anyway, but it will depend on how easy you can get the frequency and band-width to fit. $\endgroup$ – mathreadler Nov 24 '16 at 5:52
3
$\begingroup$

Frequency domain filtering (FFT), as suggested by some comments, is definitely wrong -- it's even slower, or same speed at best! A recursive filter (IIR) is the fastes possible solution. If you choose a typical second order filter (called biquad in engineering slang) of Butterworth type and do your math right (factoring out coefficients) you only have 3 multiplications and five addition.


Edit: link to classics page: filter cookbook

$\endgroup$
  • $\begingroup$ Whether an FFT filter is slower or faster depends on the number of filter taps. $\endgroup$ – Jim Clay May 7 '13 at 20:00
  • $\begingroup$ Yes sure, but your fft must have a window width of about as many samples as your filter has taps in order to get a simliar frequency resolution. But your fft is O(N log N) at best and you have to do two of them vs one O(N) fir filter. $\endgroup$ – André Bergner May 7 '13 at 20:09
  • 1
    $\begingroup$ Convolutions are O(NM), where M is the length of the filter. $\endgroup$ – Jim Clay May 7 '13 at 20:35
  • $\begingroup$ For a butterworth type filter you can even do it with two multiplications per sample if you're not constrained to a direct-form. Anyway, I also agree that the FFT seems a little overkill unless additional analysis or processing takes place... $\endgroup$ – niaren May 7 '13 at 20:36
  • $\begingroup$ Interesting answer! I was just getting a handle on how FIR filters worked, but I guess I'll have to dig even deeper and try to figure out IIR. Thanks! $\endgroup$ – Keith May 7 '13 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.