I am attempting to implement a basic bandpass filter but the center frequency of my filter seems to be irrelevant as I can change it all I want but it has no effect on the filter. where am I going wrong?

I have given my calculations here in the hope that someone will be able to point out where I'm making a mistake.

Filter specs:
supression of DC and Fs/2 (zeroes at +1 and -1)
center frequency at pi/4
bandwith of pi/16



     K*(z^2 -1)

all leading to a difference equation of

  • $\begingroup$ The denominator looks wrong - you need a complex conjugate pole pair. $\endgroup$
    – Paul R
    Jun 19, 2012 at 8:30
  • $\begingroup$ the intention is to implement this in c, maybe I should have said that $\endgroup$
    – Gurba
    Jun 19, 2012 at 8:42
  • $\begingroup$ I'll be sure to place a similar question in a more appropriate place next time $\endgroup$
    – Gurba
    Jun 19, 2012 at 9:24

1 Answer 1


Your denominator is wrong. It should be on this form

$$ (1-z_0z^{-1})(1-z_0^*z^{-1}) = 1-2R\cos(\phi)z^{-1}+R^2z^{-2} $$ where $z_0 = Re^{j\phi}$.

If your goal is to block DC and create an anti-aliasing filter in a simple way, I would recommend not to use complex poles. Instead use the procedure described in detail here: http://www.dsprelated.com/showmessage/172787/1.php.

It even provides a C implementation.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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