Monday, 30 March 2015

discrete signals - my Butterworth lowpass formulas do not agree with Fisher webpage


I want to implement Butterworth low-pass filter. Thanks to this question, I have found out that the filter coefficients can be generated using Tony Fisher web-site or using his code. But the problem arose when I had tried to verify his formulas myself.



Wikipedia says that the derivation of low-pass formulas is simple: we start with the Butterworth polynomial of order n. I took n=1 B1(sωcutoff)=1+sωcutoff


(note that ωcutoff is angular frequency, not usual one) then do bilinear transform s=2fsamplingz1z+1


(fsampling is usual frequency, not angular) and rewrite the resulting fraction in the form with non-positive powers of z.


To make the story short, my final formula for transfer function is H(z)=Y(z)X(z) where Y(z)=a1+a+a1+az1 X(z)=11a1+az1 and a=ωcutoff2fsampling and the resulting formula is y[n]=a1+ax[n]+a1+ax[n1]+1a1+ay[n1] For testing I use fcutoff=1 (which is ωcutoff=2π) and fsampling=30.


We should not worry about coefficients in front of x[] since Fisher multiplies them by gain factor anyway, but the coefficient in front of y[n1] equals


1a1+a=0.8104139027


while Fisher's web-page for fcutoff=1 and fsampling=30 gives 0.8097840332.


If you had a patience to finish this reading, may be you can explain, where I (or Fisher?) am wrong.



Answer



The problem is in the way you apply the bilinear transform. You have to use the appropriate (pre-)warping of the frequencies. Since the bilinear transform warps the frequency axis, you have to make sure that the corner frequency of the discrete-time filter is correct. One way to do that is as follows. The bilinear transform is defined as



s=kz1z+1


with some constant k yet to be defined. If we denote the analog frequency by Ω, and the normalized discrete-time frequency by ω, Eq. (1) becomes for s=jΩ and z=ejω


jΩ=kejω1ejω+1=kejω/2ejω/2ejω/2+ejω/2=jktan(ω/2)


Eq. (2) describes the frequency warping caused by the bilinear transform. If we use an analog lowpass filter with a normalized corner frequency Ω0=1, we must choose the constant k such that for the desired discrete-time corner frequency ω0 the term on the right-hand side of Eq. (2) becomes 1:


k=1tan(ω0/2)


where ω0 is the desired corner frequency of the digital filter. Eq. (3) and Eq. (1) define the appropriately normalized bilinear transform that you must use.


So for your example, the normalized first-order analog Butterworth lowpass transfer function is given by


H(s)=11+s


Applying the bilinear transform gives


H(z)=11+kz1z+1=z+1z(1+k)+1k=11+k1+z11+1k1+kz1



Ignoring the gain term 1/(1+k), the corresponding difference equation is


y[n]=x[n]+x[n1]1k1+ky[n1]


With a desired corner frequency ω0=2π/30 you get from (3) k=9.5144 and (1k)/(1+k)=0.80978, just like on Fisher's website.


No comments:

Post a Comment

readings - Appending 内 to a company name is read ない or うち?

For example, if I say マイクロソフト内のパートナーシップは強いです, is the 内 here read as うち or ない? Answer 「内」 in the form: 「Proper Noun + 内」 is always read 「ない...