Mathcad - Butter Worth PLC

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4
At a glance
Powered by AI
The key takeaways are that a two pole Butterworth filter has a sharper corner frequency and does not affect frequencies below the corner as much as other filter types. It also has less phase lag than a two pole low pass filter below the corner frequency.

A two pole Butterworth filter has a sharper corner frequency and attenuates frequencies above the corner at a faster rate (-40db/decade) compared to a single pole filter (-20db/decade). It also does not affect frequencies below the corner as much as a two pole low pass filter.

A two pole Butterworth filter is implemented digitally by calculating filter coefficients A1, A2, B0 using the damping factor, sample period and corner frequency. The output is calculated recursively using the coefficients and previous filter values and input.

Implementing Digital Two Pole Butterworth Filters

Why Bother with Butterworth Filters?


The first question should be why bother with 2 pole filters instead of the simple low pass filter? The main reason is that each pole will attenuate frequencies above the corner frequency at a rate of -20 db per decade. That is a factor of 10. Therefore a two pole filter will attenuate frequencies 10 times higher than the corner frequency 100 time more. The reason why one should use a Butterworth filter over a 2 pole low pass ( real ) filter is that the Butterworth filter has a sharper corner and therefore doesn't affect those frequencies blow the corner frequency as much. Notice that the phase lag isn't as great as the simple two pole low pass filter below the corner frequency.

Two Pole Butterworth Bode Plots


:= 2 1 Cut off or corner frequency in radians per second. The corner frequency should be at least 10 times less than the sample frequency. This means that sampling at 0.01 seconds, or 100 Hz, limits the corner frequency to about 10 Hz.

Compare different filters Tbw2( s) := 1

s + 2 s + 1
Tp1( s) := 1 s Tp2( s) := +1 1

Two Pole Butterworth filter

Single pole low pass filter

s + 2 s + 1
n 2

Two pole low pass filter

n := 0 .. 256

hz := 10
n

64

M bw2 := 20 log Tbw2 2 j hz


n

))

bw2 :=
n

arg Tbw2 2 j hz deg arg Tp1 2 j hz deg arg Tp2 2 j hz deg

( (

))

M p1 := 20 log Tp1 2 j hz
n

( ( ( (

)) ))

p1 :=
n

( ( ( (

)) ))

M p2 := 20 log Tp2 2 j hz
n

p2 :=
n

(c) 2008 Peter Nachtwey Delta Computer Systems, Inc.

1/4

11/24/200811:53 AM

Implementing Digital Two Pole Butterworth Filters

Magnitude
0

20

Magnitude

40

60

80

100 0.01

0.1

1 Frequency

10

100

2 Pole Butterworth 1 Pole Low Pass 2 Pole Low Pass

Phase
0 9 18 27 36 45 54 63 72 81 90 99 108 117 126 135 144 153 162 171 180 0.01

Phase

0.1

1 Frequency

10

100

2 Pole Butterworth 1 Pole Low Pass 2 Pole Low Pass

(c) 2008 Peter Nachtwey Delta Computer Systems, Inc.

2/4

11/24/200811:53 AM

Implementing Digital Two Pole Butterworth Filters

Two Pole Butterworth Filter Implementation


:= 2 := 2 2 The damping factor is always Sample period. Corner or cut off frequency in radians per second 2 2

:= 0.01

The coefficients below were computes using matched z transforms, MZT, Euler's identity,and a lot of substitution and simplification. The MZT technique does not introduce zeros in the z domain or require frequency warping. A2 := e
2

A2 = 0.914975803093201 A1 = 1.9111995199846044
2

A1 := 2 e

cos( ) cos( ) + e

B 0 := 1 2 e

B 0 = 0.00377628310859668 Verify, must add up to one

A1 + A2 + B 0 = 1

Verify Filter Design


freq := 2 10 Input frequency in radians per second. Frequencies greater than will be attenuated Duration of the simulation

Time := 2 Initialize filter, the first two filter values are assumed to be 0. n := 0 .. 1 n := 2 .. Time y := 0
n

x := sin( freq n )
n

Simulate for Time seconds. Input signal with 1 volt amplitude.


n 2

x := sin( freq n )
n n

y := A1 y

n 1

+ A2 y

+ B0 x

(c) 2008 Peter Nachtwey Delta Computer Systems, Inc.

3/4

11/24/200811:53 AM

Implementing Digital Two Pole Butterworth Filters

Butterworth
1

0.5 Input and Output

0.5

0.5

1 Time

1.5

Input Output

(c) 2008 Peter Nachtwey Delta Computer Systems, Inc.

4/4

11/24/200811:53 AM

You might also like