Sunteți pe pagina 1din 18

Comp30291 : 17 Nov09 20/05/2014 BMGC

University of Man!ester
"!oo# of Comp$ter "iene
Comp30291: %i&ita# Me'ia (roessin& 2009)10
"etion 5: *+)transforms , --.)type 'i&ita# fi#ters
5/1/ -ntro'$tion:
A general causal digital filter has the difference equation:
N M
y[n] = a
i
x[n-i] - b
k
y[n-k]
i=0 k=1
hich is of order !ax" N#M $# and is recursi%e if any of the b
&
coefficients are non-'ero( A second
order recursi%e digital filter therefore has the difference equation:
y[n] = a
0
x[n] ) a
1
x[n-1] ) a
*
x[n-*] - b
1
y[n-1] - b
*
y[n-*]
A digital filter ith a recursi%e linear difference equation can ha%e an infinite i!+ulse-res+onse(
,e!e!ber that the frequency-res+onse of a digital filter ith i!+ulse-res+onse "h[n]$ is:

-.e
&
/ = h[n]e
- & n
n=-
5/2/ 0!e +)transform:
0onsider the res+onse of a causal stable 123 digital filter to the s+ecial sequence "'
n
$ here ' is a
co!+lex( 3f "h[n]$ is the i!+ulse-res+onse# by discrete ti!e con%olution# the out+ut is a sequence
"y[n]$ here

y[n] = h[k] '
n - k
= '
n
h[k] '
- k
k=- k=-

= '
n
-.'/ ith -.'/ = h[k] '
- k
k=-
2he ex+ression obtained for -.'/ is the 4'-transfor!5 of the i!+ulse-res+onse( -.'/ is a co!+lex
nu!ber hen e%aluated for a gi%en co!+lex %alue of '(
3t !ay be shon that for a causal stable syste!# -.'/ !ust be finite hen e%aluated for a co!+lex
nu!ber ' ith !odulus greater than or equal to one(


=

= =
n
n j i
n
n
z n h e H z n h z H ] [ / . : res+onse - frequency the and ] [ / . 6ince
it is clear that re+lacing ' by e
&
in -.'/ gi%es -.e
&
/ (
5/3/ 0!e *+)p#ane:
0o!+70*81: 9igital Media :rocessing ;( * *< =ct 50> ?M@0
3t is useful to re+resent co!+lex nu!bers on an 4Argand diagra!5 as illustrated belo( 2he !ain
reason for doing this is that the !odulus of the difference beteen to co!+lex nu!bers a)&b and
c)&d say i(e( 1 .a)&b/ - .c)&d/ 1is re+resented gra+hically as the length of the line beteen the to
co!+lex nu!bers as +lotted on the Argand diagra!(
3f one of these co!+lex nu!bers# c )&d say is 'ero i(e( 0)&0# then the !odulus of the other nu!ber A
a)&bA is the distance of a)&b fro! the origin 0)&0 on the Argand diagra!(
=f course# any co!+lex nu!ber# a)&b say# can be con%erted to +olar for! ,e
&
here ,= Aa)&bA and
= tan
-1
.bBa/( :lotting a co!+lex nu!ber ex+ressed as ,e
&
on an Argand diagra! is also illustrated
abo%e( Ce dra an arro of length , starting fro! the origin and set at an angle fro! the 4real
+art5 axis .!easured anti-clockise/( ,e
&
is then at the ti+ of the arro( 3n the illustration abo%e#
is about BD or D; degrees( 3f ,=1# ,e
&
= e
&
and on the Argand diagra! ould be a +oint at a
distance 1 fro! the origin( :lotting e
&
for %alues in the range 0 to * .7<0
=/
+roduces +oints all of
hich lie on a 4unit circle5 # i(e( a circle of radius 1# ith centre at the origin(
Chere the co!+lex nu!bers +lotted on an Argand diagra! are %alues of ' for hich e are
interested in -.'/# the diagra! is referred to as 4the '-+lane5( :oints ith ' = e
&
lie on a unit circle#
as shon in Eig ;(1( ,e!e!ber that Ae
&
A = Acos./ )&sin./A = [cos
*
./ ) sin
*
./] = 1(
2herefore e%aluating the frequency-res+onse -.e
i
/ for in the range 0 to is equi%alent to
e%aluating -.'/ for ' =e
&
hich goes round the u++er +art of the unit circle as goes fro! 0 to (

Real part of z
Imaginary part of z
Fig 5.1
+ 2 e3p45 6
1

5/4/ .e#atin& 74+68 si&na#)f#o9 &rap!s an' 'ifferene e:$ations


2his is sur+risingly straightforard( 0onsider non-recursi%e and recursi%e difference equations
se+arately(
;3amp#e 5/1: Eind -.'/ for the difference equation: y[n] = x[n] ) x[n-1]
,eal +art
3!aginary +art
-7)7&
1-*&
,e
&
,

0o!+70*81: 9igital Media :rocessing ;( 7 *< =ct 50> ?M@0


"o#$tion: 2he i!+ulse res+onse is: "h[n]$ = " ((( # 0# 1# 1# 0# ((( $

1
1
0
1 ] [ ] [ / .

=

+ = = =

z z n h z n h z H
n
n
n
n
;3amp#e 5/2:
Eind -.'/ for the recursi%e difference equation: y[n] = a
0
x[n] ) a
1
x[n-1] - b
1
y[n-1]
"o#$tion:
2he !ethod used in Fxa!+le ;(1 is not so easy because the i!+ulse-res+onse can no be infinite(
Eortunately there is another ay( ,e!e!ber that if x[n] = '
n
then y[n] = -.'/ '
n
# y[n-1] = -.'/
'
n - 1
etc( 6ubstitute into the difference equation to obtain:
-.'/ '
n
= a
0
'
n
) a
1
'
n - 1
- b
1
-.'/ '
n - 1

a
0
) a
1
'
- 1
2herefore# -.'/ =
1 ) b
1
'
- 1
exce+t hen ' = - b
1
( Chen ' = -b
1
# -.'/ = (
?y the sa!e !ethod# -.'/ for a general digital filter hose difference-equation as gi%en earlier
is:
a
0
) a
1
'
- 1
) a
*
'
- *
) ((( ) a
N
'
- N
-.'/ = .ith b
0
= 1/
b
0
) b
1
'
- 1
) b
*
'
- *
) ((( ) b
M
'
- M

@i%en -.'/ in this for!# e can easily go back to its difference-equation and hence its signal-
flo gra+h# as illustrated by the folloing exa!+le(
;3amp#e 5/3: @i%e a signal flo gra+h for the second order digital filter ith:
a
0
) a
1
'
-1
) a
*
'
- *
-.'/ =
1 ) b
1
'
- 1
) b
*
'
- *
"o#$tion: 2he difference-equation is:
y[n] = a
0
x[n] ) a
1
x[n-1] ) a
*
x[n-*] - b
1
y[n-1] - b
*
y[n-*]
2he signal-flo gra+h in Eig ;(* is readily deduced fro! this difference-equation( 3t is referred to as
a second order or 4bi-quadratic5 33, section in 4direct for! 15(
0o!+70*81: 9igital Media :rocessing ;( D *< =ct 50> ?M@0
x[n]
a0
'-1
'-1
'-1
'-1
a1
a*
y[n]
-b1
-b*
Eig ;(*: G 9irect Eor! 3 H ?iquadratic section
Alternati%e signal flo gra+hs can generally be found for a gi%en difference-equation( 0onsidering
again the 49irect Eor! 35 bi-quadratic section in Eig ;(*# re-ordering the to hal%es in this signal
flo gra+h gi%es Eig ;(7 hich# by :roble! ;(8# ill ha%e the sa!e i!+ulse-res+onse as the signal-
flo gra+h in fig ;(*( No obser%e that Eig ;(7 !ay be si!+lified to the signal-flo gra+h in Eig
;(D hich is knon as a 49irect Eor! 335 i!+le!entation of a bi-quadratic section( 3t has the
!ini!u! +ossible nu!ber of delay boxes and is said to be 4canonical5( 3ts syste! function is
identical to that of the 49irect Eor! 35 signal-flo gra+h# and therefore it can i!+le!ent any second
order bi-quadratic syste! function(
x[n] a0
'-1
'-1
a1
a*
y[n]
'-1
'-1
-b1
-b*
Eig( ;(7: G 9irect Eor! 3 H rearranged
x[n] y[n]
-b1
-b*
a0
'-1
'-1
a1
a*
C
C1
C*
Eig ;(D: G 9irect Eor! 33 H ?iquadratic 6ection
;3amp#e 5/4:
0o!+70*81: 9igital Media :rocessing ;( ; *< =ct 50> ?M@0
@i%en %alues for a
1
# a
*
#a
0
# b
1
and b
*
# rite a +rogra! to i!+le!ent 9irect Eor! 33(
"o#$tion:
C1 = 0I C* = 0I "Assign %ars C1#C* to delay out+uts$
hile 1 "3nfinite JhileJ loo+$
K=in+ut.JK = J/I "Assign K to recei%e a single in+ut sa!+le$
C = K-b1LC1-b*LC*I ",ecursi%e +art of filter$
M =CLa0)C1La1)C*La*I "Non-recursi%e +art$
C* =C1I C1 =CI "6et u+ delay out+uts for next ti!e$
dis+.[J M=J nu!*str.M/]/I "Assign %ar M to out+ut$I
endI "@o back for next sa!+le$
5/5/ "ystem f$ntion: 2he ex+ression obtained for -.'/ is a ratio of +olyno!ials in '
1
( -.'/ is
the 4syste! function5( Chen ' N 1# -.'/ need not be finite(
5/</ (o#es an' +eros of 74+6:
2he ex+ression abo%e for -.'/ for a general digital filter !ay be re-ex+ressed as:
.a
0
'
N
) a
1
'
N -1
) ((( ) a
N
/
-.'/ = '
M-N

.'
M
) b
1
'
N-1
) ((( ) b
M
/
2he deno!inator and nu!erator +olyno!ials !ay no be ex+ressed in factorised for! to obtain:
.' - '
1
/.' - '
*
/.' - '
7
/(((. ' - '
N
/
-.'/ = a
0
'
M-N

.' - +
1
/. ' - +
*
/.' - +
7
/(((.' - +
M
/
2he roots of the nu!erator: '
1
# '
*
#(((# '
N
# are called the 4'eros5 of -.'/(
2he roots of the deno!inator: +
1
#+
*
#(((# +
M
# are called the 4+oles5 of -.'/
-.'/ ill be infinite hen e%aluated ith ' equal to a +ole# and ill beco!e 'ero ith ' equal to a
'ero exce+t in the s+ecial case here the 'ero coincides exactly ith one of the +oles(
Eor a causal stable syste!# -.'/ !ust be finite for ' 1( 2herefore there cannot be a +ole
hose !odulus is greater than or equal to 1( All +oles !ust satisfy ' N 1# and hen +lotted on
the Argand diagra!# this !eans that they !ust lie inside the unit circle( 2here is no restriction on
the +ositions of 'eros(
5/7/ %istane r$#e: =!itted in *008-10
5/=/ ;stimation of &ain response for ;3amp#e 5/5 from po#es an' +eros: =!itted in *008-10
;3amp#e 5/<: =!itted in *001-10
5/9/ %esi&n of a not! fi#ter >y M?0@?B: Modified in *008-10
Assu!e e ish to design a Dth order JnotchJ digital filter to eli!inate an unanted sinusoid at
O00 -' ithout se%erely affecting rest of signal( 2he sa!+ling rate is E6 = 10 k-'(
=ne si!+le ay is to use the MA21A? function 4butter5 as follos:
A"210000B
A@ 2 =00 C 25 B AU 2 =00D25B
Ea >F 2 >$tter428 EA@ AUF/4A"/268stop6B
0o!+70*81: 9igital Media :rocessing ;( < *< =ct 50> ?M@0
a = [0(8O -7(D7 D(8< -7(D7 0(8O]
b= [ 1 -7(D> D(8< -7(78 0(8<]
fre:+4a8 >6B
fre:+4a8 >8 5128 A"6B G Better &rap!
a3is4E0 A"/2 )50 5F6B G "a#es a3es
2he frequency-res+onses .gain and +hase/ +roduced by the final to MA21A? state!ents are as
follos:
0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000
-400
-300
-200
-100
0
Frequency (Hz)
P
h
a
s
e

(
d
e
g
r
e
e
s
)
0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000
-40
-20
0
Frequency (Hz)
M
a
g
n
i
t
u
d
e

(
d
B
)
6ince the ?utterorth band-sto+ filter ill ha%e -7d? gain at the to cut-off frequencies
E1 = O00-*; and EP=O00)*;# the notch has 4-7 d? frequency bandidth5: *; ) *; = ;0 -'(
No consider ho to i!+le!ent the D
th
order digital filter( 2he MA21A? function ga%e us:
a = [0(8O -7(D7 D(8< -7(D7 0(8O]
b= [ 1 -7(D> D(8< -7(78 0(8<]
2he transfer .6yste!/ Eunction is# therefore:
A 49irect Eor! 335 i!+le!entation of the D
th
order notch filter ould ha%e the signal-flo gra+h
belo:
( )

+ +
+ +
=


D 7 * 1
D 7 * 1
8< ( 0 78 ( 7 8< ( D D> ( 7 1
8O ( 0 D7 ( 7 8< ( D D7 ( 7 8O ( 0
z z z z
z z z z
z H
0o!+70*81: 9igital Media :rocessing ;( > *< =ct 50> ?M@0
2his i!+le!entation orks fine in MA21A?( ?ut 4direct for!5 33, i!+le!entations of order
greater than to are rarely used( 6ensiti%ity to round-off error in coefficient %alues ill be high(
Also the range of 4inter!ediate5 signals in the '
-1
boxes ill be high(
-igh ord-length floating +oint arith!etic hides this +roble!# but in fixed +oint arith!etic# great
difficulty occurs( 3nstead e use 4cascaded bi-quad sections5

@i%en a D
th
order transfer function -.'/( 3nstead of the direct for! reali'ation belo:
e +refer to arrange to bi-quad sections# ith a single leading !ulti+lier @# as follos:
2o con%ert the D
th
order transfer function -.'/ to this ne for! is definitely a &ob for MA21A?(
9o it as follos after getting a Q b for the D
th
order transfer function# -.'/# as before:
Ea >F 2 >$tter428 EA@ AUF/4A"/268stop6B
E"H" GF 2 tf2sos4a8>6
+
)1
+
)1
+
)1
+
)1
D
D
D
D
D
D
D
D
0/9=
7(D>
-D(8<
7(78
-0(8<
0/0/9=
x[n]
y[n]
)3/43
4/9<
)3/43
-.'/
x[n] y[n]
-
1
.'/ -
*
.'/
x[n] y[n]
@
0o!+70*81: 9igital Media :rocessing ;( O *< =ct 50> ?M@0
R MA21A? res+onds ith:
"H" 2 1 )1/753 1 1 )1/722 0/977<
1 )1/753 1 1 )1/744 0/97=5
G 2 0/97=
3n MA21A?# 46=65 stands for 4second order section5 .i(e( bi-quad/ and the function 4tf*6=65
con%erts the coefficients in arrays 4a5 and 4b5 to the ne set of coefficients stored in array 46=65 and
the constant @( 2he array 6=6 has to ros: one ro for the first bi-quad section and one ro for
the second bi-quad section( 3n each ro# the first three ter!s s+ecify the non-recursi%e +art and the
second three ter!s s+ecify the recursi%e +art( 2herefore -.'/ !ay no be reali'ed as follos:
2his is no a +ractical and reali'able 33, digital 4notch5 filter# though e so!eti!es i!+le!ent the
single !ulti+lier @ =0(81O by to !ulti+liers# one for each bi-quad section( More about this later(
5/10 Ca#$#ation of &ain)response of not! fi#ter:
-o good is a notch filterS Ce can start to anser this question by s+ecifying the filterJs 7d?
bandidth i(e( the difference beteen the frequencies here the gain crosses 0(>0> .-7d? /( Ce
should also ask hat is the gain at the notch frequency .O00 -' in +re%ious exa!+le/I i(e( hat is the
4de+th5 of the notch( 3f it is not dee+ enough either .i/ increase the -7 d? bandidth or .ii/ increase
the order( 9o both if necessary( 2o 4shar+en5 the notch# decrease the -7d? bandidth# but this ill
!ake the notch less dee+I so it !ay be necessary to increase the order to !aintain a dee+ enough
notch( 2his is an 4ad-hoc5 a++roach T e can surely de%elo+ so!e theory later( 3t !odifies the
!ore for!al a++roach# based on +oles and 'eroes# ado+ted last year(
3EnF
0/97=
)1/753

1/722
)0/97=
yEnF
)1/753
1/744
)0/979
Ao$rt! or'er --. not! fi#ter rea#ise' as t9o >i:$a' 4"H"6 setions
0o!+70*81: 9igital Media :rocessing ;( 8 *< =ct 50> ?M@0
(
;3amp#e: A digital filter ith a sa!+ling rate of *00 -' is required to eli!inate an unanted
;0 -' sinusoidal co!+onent of an in+ut signal ithout affecting the !agnitudes of other
co!+onents too se%erely( 9esign a Dth order UnotchU filter for this +ur+ose hose 7d? bandidth
is not greater than 7(* -'( .MA21A? calls this *
nd
order(/ -o dee+ is the notchS
"o#$tion:
A"2200B A@250)1/<B AU250D1/<B
Ea >F2>$tter428EA@8AUF/4A"/268 *stop6B
E"H" GF 2 tf2sos4a8>6
5/11/ --. 'i&ita# fi#ter 'esi&n >y >i#inear transformation
Many design techniques for 33, discrete ti!e filters ha%e ado+ted ideas and ter!inology de%elo+ed
for analogue filters# and are i!+le!ented by transfor!ing the syste! function# -
a
.s/# of an analogue
4+rototy+e5 filter into the syste! function -.'/ of a digital filter ith si!ilar# but not identical#
characteristics(
Eor analogue filters# there is a ide %ariety of techniques for deri%ing -
a
.s/ to ha%e a s+ecified ty+e
of gain-res+onse( Eor exa!+le# it is +ossible to deri%ing -
a
.s/ for an n
th
order analogue ?utterorth
lo-+ass filter# ith gain res+onse:

3t is then +ossible to transfor! -
a
.s/ into -.'/ for an equi%alent digital filter( 2here are !any ays
of doing this# the !ost fa!ous being the 4bilinear transfor!ation5( 3t is not the only +ossible
transfor!ation# but a %ery useful and reliable one(
2he bilinear transfor!ation in%ol%es re+lacing s by .*B2/ .'-1/B.')1/]# but fortunately# MA21A?
takes care of all the detail and e can design a ?utterorth lo +ass filter si!+ly by executing the
MA21A? state!ent:
[a b] = butter.N# fc/
N is the required order and fc is the required 47 d?5 cut-off frequency nor!alised .as usual ith
n
C
a
G
*
/ B . 1
1
/ .

+
=
1
5I7+
f
Gain
0/7
0
=00
=00 D =00)
0 'B
)3 'B
0o!+70*81: 9igital Media :rocessing ;( 10 *< =ct 50> ?M@0
MA21A?/ to f
S
B*( Analogue ?utterorth filters ha%e a gain hich is 'ero in the +ass-band and falls
to -7 d? at the cut-off frequency( 2hese to +ro+erties are +reser%ed by the bilinear transfor!ation#
though the traditional ?utterorth sha+e is changed( 2he sha+e change is caused by a +rocess
referred to as 4frequency ar+ing5( Although the gain-res+onse of the digital filter is consequently
rather different fro! that of the analogue ?utterorth gain res+onse it is deri%ed fro!# the ter!
4?utterorth filter5 is still a++lied to the digital filter( 2he order of -.'/ is equal to the order of
-
a
.s/
Are:$eny 9arpin&:
3t !ay be shon that the ne gain-res+onse @./ = @
a
./ here = * tan.B*// 2he gra+h of
against belo# shos ho in the range - to is !a++ed to in the range - to ( 2he
!a++ing is reasonably linear for in the range -* to * .gi%ing in the range -B* to B*/# but as
increases beyond this range# a gi%en increase in +roduces s!aller and s!aller increases in ( 2he
effect of frequency ar+ing is ell illustrated by considering the analogue gain-res+onse shon in
fig ;(1>.a/( 3f this ere transfor!ed to the digital filter gain res+onse shon in fig ;(1>.b/# the
latter ould beco!e !ore and !ore co!+ressed as (
Fig 6.1: Frequency warping
-3.14
-2.355
-1.57
-0.785
0
0.785
1.57
2.355
3.14
-12 -10 -8 -6 -4 -2 0 2 4 6 8 10 12
Radians/second
R
a
d
i
a
n
s
/
s
a
m
p
l
e

17a45 61 174e3p45 61

/2
Ai& </24a6: ?na#o&$e &ain response Ai& </24>6: ;ffet of >i#inear transformation
*(rototype ana#o&$e transfer f$ntion: Although the sha+e changes# e ould like @./ at its
cut off
0
to the sa!e as @
a
./ at its cut-off frequency( 3f @
a
./ is ?utterorth# it is -7d? at its
cut-off frequency( 6o e ould like @./ to be -7 d? at its cut-off
0
(
Achie%ed if the analogue +rototy+e is designed to ha%e its cut-off frequency at
0
= * tan.
0
B*/(

0
is then called the 4+re-ar+ed5 cut-off frequency(
Ai& 5/1< Are:$eny Jarpin&
Ai&/ 5/174a6: ?na#o&$e Gain .esponse Ai&/ 5/174>6: ;ffet of Bi#inear 0ransformation
0o!+70*81: 9igital Media :rocessing ;( 11 *< =ct 50> ?M@0
9esigning the analogue +rototy+e ith cut-off frequency * tan.
0
B*/ guarantees that the digital
filter ill ha%e its cut-off at
0
(
%esi&n of a 2n' or'er --. #o9)pass 'i&ita# fi#ter >y t!e >i#inear transform met!o' 4*>y !an'6
1et the required cut-off frequency
0
= BD radiansBsa!+le( Ce need a +rototy+e transfer function
-
a
.s/ for a *nd order analogue ?utterorth lo-+ass filter ith 7 d? cut-off at
0
= *tan.
0
B*/ =
* tan.BO/ radiansBsecond( 2herefore#
0
= * tan.BO/ = 0(O*O( 3t is ell knon by analogue filter
designers that the transfer function for a *nd order ?utterorth lo-+ass filter ith cut-off
frequency =1 radianBsecond is:
Chen the cut-off frequency is =
0
rather than = 1# the second order ex+ression for -.s/
beco!es:
,e+lacing s by & and taking the !odulus of this ex+ression gi%es @./ = 1B[1).B
0
/
*n
] ith
n=*( 2his is the *
nd
order ?utterorth lo-+ass gain-res+onse a++roxi!ation( 9eri%ing the abo%e
ex+ression for -
a
.s/# and corres+onding ex+ressions for higher orders# is not +art of our syllabus( 3t
ill not be necessary since MA21A? ill take care of it(
6etting
0
= 0(O*O in this for!ula# then re+lacing s by *.'-1/B.')1/ gi%es us -.'/ for the required
33, digital filter( Mou can check this 4by hand5# but fortunately MA21A? does all this for us(
;3amp#e 5/7
Psing MA21A?# design a second order ?utterorth-ty+e 33, lo-+ass filter ith
c
= B D(
"o#$tion:
[a b] = butter.*# 0(*;/
a = [0(08O 0(18< 0(08O]
b = [1 -0(8D 0(77]
2he required ex+ression for -.'/ is

0(08O ) 0(18< '
-1
) 0(08O '
-*

-.'/ =
1 - 0(8D '
-1
) 0(77'
-*

( )

+
+ +
=


* 1
* 1
77 ( 0 8D ( 0 1
* 1
08O ( 0
z z
z z
z H
hich !ay be realised by the signal flo gra+h in fig ;(1O( Note the sa%ing of to !ulti+liers by
using a !ulti+ler to scale the in+ut by 0(08O(
*
/ * . 1
1
/ .
s s
s H
a
+ +
=
*
/ B . / B . * 1
1
/ .
C C
a
s s
s H
+ +
=
0o!+70*81: 9igital Media :rocessing ;( 1* *< =ct 50> ?M@0

3EnF yEnF
Ai&/ </3
0/097
2
0/94
)0/33
5/12: 7i&!er or'er --. 'i&ita# fi#ters:
,ecursi%e filters of order greater than to are highly sensiti%e to quantisation error and o%erflo( 3t
is nor!al# therefore# to design higher order 33, filters as cascades of bi-quadratic sections(
MA21A? does not do this directly as de!onstrated by Fxa!+le ;(O(
;3amp#e 5/=: 9esign a D
th
order ?utterorth-ty+e 33, lo-+ass digital filter is needed ith 7d?
cut-off at one sixteenth of the sa!+ling frequency f
S.
"o#$tion: ,elati%e cut-off frequency is BO( 2he MA21A? co!!and belo +roduces the arrays a
and b ith the nu!erator and deno!inator coefficients for the D
th
order syste! function -.'/(
Ea >F 2 >$tter448 0/1256
=ut+ut +roduced by MA21A? is:
a 2 0/00093 0/0037 0/005< 0/0037 0/00093
> 2 1 )2/97<= 3/4223 )1/7=<1 0/355<
2he syste! function is therefore as follos:
2his corres+onds to the 4D
th
order 4direct for!5 signal flo gra+h shon belo(
Eigure ;(18: A D
th
order 4direct for! 335 realisation .not co!!only used/
-igher order 33, digital filters are generally not i!+le!ented like this( 3nstead# they are
i!+le!ented as cascaded biquad or second order sections .6=6/( Eortunately MA21A? can
transfor! the 4direct for!5 coefficients to second order section .6=6/ coefficients using a 46ignal
:rocessing 2oolbox5 function 4tf*sos5 as follos:
Ea >F 2 >$tter448 0/1256
Esos GF 2 tf2sos4a8>6
Fxecuting these state!ents gi%es the folloing res+onse:
Ai&/ 5/1=
( )

+ +
+ + + +
=


D 7 * 1
D 7 * 1
7;;< ( 0 >O< ( 1 D** ( 7 8>> ( * 1
00087 ( 0 007> ( 00;< ( 007> ( 0 00087 ( 0
z z z z
z z z z
z H
)
)
)
)
)
0(0008
78
*(8>>
-7(D**
1(>8
-0(7;<
0(0008
'
-1
'
-1
'
-1
'
-1
0o!+70*81: 9igital Media :rocessing ;( 17 *< =ct 50> ?M@0
Ea >F 2 >$tter448 0/1256
a 2 E0/0009 0/0037 0/005< 0/0037 0/0009F
> 2 E1 )2/97<= 3/4223 )1/7=<1 0/355< F
Esos GF 2 tf2sos4a8>6
sos 2 E1 2 1 1 )1/3<5 0/47=
1 2 1 1 )1/<12 0/745 F
G 2 0/00093
2his +roduces a *-di!ensional array 4sos5 containing to sets of biquad coefficients and a 4gain5
constant @( A !athe!atically correct syste! function based on this data is as follos:
( )

+ +

+
+ +
=




* 1
* 1
* 1
* 1
>D; ( 0 <1* ( 1 1
* 1
D>O ( 0 7<; ( 1 1
* 1
00087 ( 0
z z
z z
z z
z z
z H
3n +ractice# es+ecially in fixed +oint arith!etic# the effect of @ is often distributed a!ong the to
sections( Noting that 0(077 x 0(0*O 0(00087# and noting also that the to sections can be in
either order# an alternati%e ex+ression for -.'/ is as follos:

( )

+
+ +

+ +
=




* 1
* 1
* 1
* 1
D>O ( 0 7<; ( 1 1
* 1
0*O ( 0
>D; ( 0 <1* ( 1 1
* 1
077 ( 0
z z
z z
z z
z z
z H
2his alternati%e ex+ression for -.'/ !ay be realised in the for! of cascaded bi-quadratic sections as
shon in fig ;(*0(
3EnF
0/033
2
1/<
)0/74
0/02=
yEnF
2
1/3<
)0/4=
Ai&/ </4: Ao$rt! or'er --. B$tter9ort! fi#ter 9it! $t)off fs/1<

-0.1
0.1
0.3
0.5
0.7
0.9
1.1
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Radians/second
G
a
i
n
Eig( ;(*0 Eourth order 33, ?utterorth 1: filter ith cut-off fsB1<
Ai&/ 5/214a6 ?na#o&$e 4t! or'er B$tter9ort! @( &ain response
0(>0>=1B* at 47d? +oint5
0o!+70*81: 9igital Media :rocessing ;( 1D *< =ct 50> ?M@0

Fig. 5.21(b): Gain response o !"# order $$R il"er
-0.1
0.1
0.3
0.5
0.7
0.9
1.1
0 0.785 1.57 2.355 3.14
Radians/sample
G
a
i
n
Eig( ;(*1.a/ shos the Dth order ?utterorth lo-+ass gain res+onse:
/ 1 .
1
/ .
O

+
= G
.ith cut-off frequency nor!alised to 1/ as used by MA21A? as a +rototy+e( Eig ;(*1.b/ shos
the gain-res+onse of the deri%ed digital filter hich# like the analogue filter# is 1 at 'ero frequency
and 0(>0> .-7d?/ at the cut-off frequency .BO 0(78 radiansBsa!+le/( Note hoe%er that the
analogue gain a++roaches 0 as hereas the gain of the digital filter beco!es exactly 'ero at
= ( 2he sha+e of the ?utterorth gain res+onse is 4ar+ed5 by the bilinear transfor!ation(
-oe%er# the 7d? +oint occurs exactly at
c
for the digital filter# and the cut-off rate beco!es
shar+er and shar+er as because of the co!+ression as (
5/13: --. 'i&ita# !i&!)pass >an')pass an' >an')stop fi#ter 'esi&n:
2he bilinear transfor!ation !ay be a++lied to analogue syste! functions hich are high-+ass# band-
+ass or band-sto+ to obtain digital filter equi%alents( Eor exa!+le a 4high-+ass5 digital filter !ay be
designed as illustrated belo:
;3amp#e 5/9 9esign a D
th
order high-+ass 33, filter ith cut-off frequency fsB1<(
"o#$tion: Fxecute the folloing MA21A? co!!ands and +roceed as for lo-+ass
[a b] = butter.D#0(1*;#5high5/I
freq'.a#b/I
[sos @] = tf*sos.a#b/
Cide-band band-+ass and band-sto+ filters .f
P
VV *f
1
/ !ay be designed by cascading lo-+ass and
high-+ass sections# but Jnarro bandJ band-+assBsto+ filters .f
P
not VV *f
1
/ ill not be %ery accurate
if this cascading a++roach is used( 2he MA21A? band-+ass a++roach alays orks# i(e( for
narroband and ideband( A +ossible source of confusion is that s+ecifying an order 4*5 +roduces
hat !any +eo+le .including !e# ?arry/ ould call a Dth order 33, digital filter( 2he design +rocess
carried out by 4butter5 in%ol%es the design of a lo-+ass +rototy+e and then a++lying a lo-+ass to
band-+ass transfor!ation hich doubles the co!+lexity( 2he order s+ecified is the order of the
+rototy+e( 6o if e s+ecify *nd order for band-+ass e get a Dth order syste! function hich can be
re-ex+ressed .using tf*sos/ as 2C= biquad sections(
;3amp#e 5/10: 9esign a *nd .Dth/order band+ass filter ith
1
= BD #
u
= B*(
"o#$tion: Fxecute the folloing MA21A? state!ents:
[a b] = butter.*#[0(*; 0(;]/
freq'.a#b/I
0(D
1B*
0o!+70*81: 9igital Media :rocessing ;( 1; *< =ct 50> ?M@0
[sos @] = tf*sos.a#b/
MA21A? out+ut:is:
a = 0(08O 0 -0(18; 0 0(08O
b = 1 -1(*18 1(777 -0(<<> 0(77
sos = 1 * 1 1 -0(1<<; 0(;7DO
1 -* 1 1 -1(0;*D 0(<*7*
@ = 0(08O
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-200
-100
0
100
200
Normalized Frequency (

rad/sample)
P
h
a
s
e

(
d
e
g
r
e
e
s
)
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
-40
-30
-20
-10
Normalized Frequency (

rad/sample)
M
a
g
n
i
t
u
d
e

(
d
B
)
;3amp#e 5/11: 9esign a Dth .Oth/order band+ass filter ith
1
= BD #
u
= B*(
"o#$tion: Fxecute the folloing MA21A? state!ents
[a b] = butter.D#[0(*; 0(;]/
freq'.a#b/I axis.[0 1 -D0 0]/I
[sos @] = tf*sos.a#b/
to obtain the MA21A? out+ut:
a = 0(01 0 -0(0D1 0 0(0<1 0 -0(0D1 0 0(01
b = 1 -*(D>* D(708 -D(OO< D(D>> -*(81D 1(;18 -0(; 0(1*
sos =1 * 1 1 -0(7;1 0(D*O
1 -*( 1 1 -0(O7* 0(D8
1 *( 1 1 -0(0D< 0(>*D
1 -* 1 1 -1(*DD 0(>87
@ = 0(01
0o!+70*81: 9igital Media :rocessing ;( 1< *< =ct 50> ?M@0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-800
-600
-400
-200
0
Normalized Frequency (

rad/sample)
P
h
a
s
e

(
d
e
g
r
e
e
s
)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-40
-30
-20
-10
0
Normalized Frequency (

rad/sample)
M
a
g
n
i
t
u
d
e

(
d
B
)
4th (8th) order IIR Band-pass (Fs/8 - Fs/4)
;3amp#e 5/12: 9esign a Dth .Oth/order band-sto+ filter ith
1
= BD #
u
= B*(
"o#$tion: Fxecute the folloing MA21A? state!ents
[a b] = butter.D#[0(*; 0(;]# 4sto+5/
freq'.a#b/I axis.[0 1 -D0 0]/I
[sos @] = tf*sos.a#b/
to obtain the MA21A? out+ut:
a = 0(7D> -1(1D8 *(O1; -D(*7> ;(1 -D(*7> *(O1; -1(1D8 0(7D>
b = 1 -*(D>* D(708 -D(OO< D(D>> -*(81D 1(;18 -0(; 0(1*
sos = 1 -0(O*O 1 1 -0(7;1 0(D*O
1 -0(O*O 1 1 -0(O7* 0(D8
1 -0(O*O 1 1 -0(0D< 0(>*D
1 -0(O*O 1 1 -1(*DD 0(>87
@ = 0(7D>
0o!+70*81: 9igital Media :rocessing ;( 1> *< =ct 50> ?M@0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-800
-600
-400
-200
0
Normalized Frequency (

rad/sample)
P
h
a
s
e

(
d
e
g
r
e
e
s
)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-40
-30
-20
-10
0
Normalized Frequency (

rad/sample)
M
a
g
n
i
t
u
d
e

(
d
B
)
4th (8th) order IIR Band-stop (Fs/8 - Fs/4)
5/14: Comparison of --. an' A-. 'i&ita# fi#ters:
33, ty+e digital filters ha%e the ad%antage of being econo!ical in their use of delays# !ulti+liers and
adders( 2hey ha%e the disad%antage of being sensiti%e to coefficient round-off inaccuracies and the
effects of o%erflo in fixed +oint arith!etic( 2hese effects can lead to instability or serious
distortion( Also# an 33, filter cannot be exactly linear +hase(
E3, filters !ay be realised by non-recursi%e structures hich are si!+ler and !ore con%enient for
+rogra!!ing es+ecially on de%ices s+ecifically designed for digital signal +rocessing( 2hese
structures are alays stable# and because there is no recursion# round-off and o%erflo errors are
easily controlled( A E3, filter can be exactly linear +hase( 2he !ain disad%antage of E3, filters is
that large orders can be required to +erfor! fairly si!+le filtering tasks(
(ro>#ems:
;(1 Eind -.'/ for the folloing difference equations
.a/ y[n] = *x[n] - 7x[n-1] ) <x[n-D]
.b/ y[n] = x[n-1] - y[n-1] - 0(;y[n-*]
;(* 6ho that +assing any sequence "x[n]$ through a syste! ith -.'/ = '
- 1
+roduces
"x[n-1]$ i(e( all sa!+les are delayed by 1 sa!+ling inter%al(
;(7( 0alculate the i!+ulse-res+onse of the digital filter ith
1
-.'/ =
1 - * '
- 1
;(D 9ra the signal-flo gra+h for exa!+le ;(7# and +lot its +oles and 'eros(
;(; 3f discrete ti!e 123 syste!s 1
1
and 1
*
# ith i!+ulse res+onses "h
1
[n] $ and "h
*
[n] $
res+ecti%ely# are serially cascaded as shon belo# calculate the o%erall i!+ulse
0o!+70*81: 9igital Media :rocessing ;( 1O *< =ct 50> ?M@0
res+onse( 6ho that this ill not be affected by interchanging 1
1
Q 1
*
(

@1 @2
3EnF
yEnF
K!1EnFL K!2EnFL
;(<( 9esign a Dth order band-+ass 33, digital filter ith loer Q u++er cut-off
frequencies at 700 -' Q 7D00 -' hen f
6
= O k-'(
;(>( 9esign a Dth order band-+ass 33, digital filter ith loer Q u++er cut-off
frequencies at *000 -' Q 7000 -' hen f
6
= O k-'(
;(O( Chat li!its ho good a notch filter e can i!+le!ent on a fixed +oint 96: +rocessorS
3n theory e can !ake notch shar+er Q shar+er by reducing the -7d? bandidth andBor
increasing the order( Chat li!its us in +ractice(
-o shar+ a notch can e get in 1<-bit fixed +t arith!eticS
;(8( Chat order of E3, filter ould be required to i!+le!ent a BD notch a++roxi!ately as good
as a *nd order 33, BD notch ith 7 d? bandidth 0(* radiansBsa!+leS
;(10( Chat order of E3, lo-+ass filter ould be required to be a++rox as good as the *nd order
33, lo-+ass filter .BD cut-off/ designed in these notesS

S-ar putea să vă placă și