# basic bandpass filter

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

2(1-R)=pi/2
1-R=pi/32
R=(pi/32)-1
R=-0.9018252296

K*(z-1)*(z+1)
---------------
z-R*cos(pi/4)+R

K*(z^2 -1)
-------------------
z^2-R^2*cos(pi/4)+R

all leading to a difference equation of

Y[n]=R^2*cos(pi/4)*Y[n-1]-R*Y[n-2]+K*(X[n]-X[n-2])

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

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