Processing math: 100%

Monday, 21 July 2014

Doing the Bilinear Transform for a 2nd order filter

Googling you can find this explained in lots of different places to varying degrees of completeness. I wanted to step this though in small detail mainly as a practice in using the MathJax notation for myself before getting onto some of the other more interesting bits.

This post will not go into any of the explanation, I'll leave that for another (possibly more useful) one.

Firstly, let's define the Laplacian s-plane (analog) transfer function that we're looking to design (a resonant low-pass filter):

H(s)=1s2+sQ+1


We then need to use the bilinear transformation with frequency warping:

s1tanω21z11+z1

Substituting this into the transfer function:

H(z)=11tan2ω2(1z1)2(1+z1)2+1Qtanω21z11+z1+1


This can be simplified by brining tan2ω2(1+z1)2 to the top by multiplying top and bottom by the same amount giving:

H(z)=tan2ω2(1+z1)2(1+z1)2+1Qtanω2(1z1)(1+z1)+tan2ω2(1+z1)2


We can now make the following simplifications:
  • expand (1z1)2=(12z1+z2) on the top and bottom
  • use the trig identity tan2ω2=(1cosω)(1+cosω)
  • simplify (1z1)(1+z1)=(1z2)

H(z)=(1cosω)(12z1+z2)(1+cosω)(12z1+z2)+(1+cosω)Qtanω2(1z2)+(1+cosω)tan2ω2(12z1+z2)


Collecting together the terms for z2,z1,1 terms to coefficients a2,a1,a0 on the bottom and b2,b1,b0 on the top:

  • b2=(1cosω)
  • b1=2(1cosω)
  • b0=(1cosω)
  • a2=(1+cosω)(1+cosω)Qtanω2+(1+cosω)tan2ω2 
  • a1=2(1+cosω)+2(1+cosω)tan2ω2
  • a0=(1+cosω)+(1+cosω)Qtanω2+(1+cosω)tan2ω2 

a0 can then be simplified by the following two steps:

  • using the trig identity tanω2=sinω1+cosω
  • using the trig identity tan2ω2=(1cosω)(1+cosω) again

a0=(1+cosω)+(1+cosω)Qsinω1+cosω+(1+cosω)1cosω1+cosω


tidying up:

a0=(1+cosω)+sinωQ+(1+cosω)=2+sinωQ=2(1+α)

where α=sinω2Q

and similarly using the same simplifications for a2 gives a2=2(1α)

Lastly for a1 using the trig identity for tan2ω2 one last time:

a1=2(1+cosω)+2(1+cosω)(1cosω)(1+cosω)=2(1+cosω)+2(1cosω)=2(2cosω)


Lining up all of the coefficients and collecting the common factors:

H(z)=(1cosω)2b2z2+b1z1+b0a2z2+a1z1+a0


  • b2=1
  • b1=2
  • b0=1
  • a2=1+α
  • a1=2cosω
  • a0=1α

With the bn values multiplied by (1cosω)2. Which can then be normalised to set a0=1 if required.

Which gives us the same coefficients in the RBJ functions for a low-pass filter.




No comments:

Post a Comment