filter design
PDF · 11 pages · 90.4 KB
Open PDF file
Lecture notes (Lecture 6, pages numbered 71-81) on designing digital filters, apparently a downloaded course handout filed among Phil's spectral theory book materials. Topics are moving-average and Hanning filters, FIR design from a brick-wall response with truncation, Gibbs overshoot and Hamming/Hanning windows, and IIR design via the bilinear transform with frequency pre-warping. It ends with a worked second-order Butterworth low-pass example (2 kHz cut-off, 10 kHz sampling). Equations are garbled in the extracted text.
AI-written summary; may contain errors. This description is approximate.
Extracted text (machine-read; may contain errors)
Lecture6-DesignofDigitalFilters
6.1Simplefilters
Therearetwomethodsforsmoothing asequence ofnumbersinordertoapprox-
imatealow-passfilter:thepolynomial fit,asjustdescribed, andthemovingav-
erage.Inthefirstcase,theapproximation toaLPFcanbeimprovedbyusing
ahigher-degreepolynomial: forexample,insteadofusingaquadratic asinthe
examplegiveninthepreviouslecture,wecouldhavefittedaleast-squares quartic
totheoriginal“noisy”data.Theeffectofusingahigher-degreepolynomial is
togivebothahigherdegreeoftangencyat
andasharpercut-offinthe
amplitude response.
Anexampleofasimplemoving-averagefilteristheHanningfilter,forwhich:
Thisfilterproduces anoutputwhichisascaledaverageofthreesuccessiveinputs,
withthecentrepointofthethreeweighted twiceasheavilyasitstwoadjacent
neighbours.
6.1.1Designbyz-domain arguments
Takingthez-transfom weobtainatransferfunctionoftheform "!
#!$&%
!$'
whichhastwozeroesat!'
(!
"!
'
i.e.!
)
.Remember
thatthiscorresponds toadoubledampingattheNyquistfrequency.Thiswillgive
attenuation ofHFsignalsi.e.aLPFeffect.Alternativelywecouldarguetoputa
71
poleatDC,somefraction
*,+*
ofthewayalongtherealaxis.Thisgives -!
!
.+
!$&%
.+!$&%
andthus/-!
.+!$&%
!$&%102"!
andindifferencetermsinthedigitaltimedomain
3
+456
whichgivesaLPFasarecurrentfilter(whichisthusanIIRfilter).Ingeneral,we
mayuseoutknowledgeoftheLaplacedesignoftransferfunctions toarguethe
designinthez-domain aswell.Thisissimpleforlow-orderfilters(asabove),but
wouldbetediousathigherorders–thereareotherways.
6.2FIRdesignsbasedonwindowfunctions
FIRfilterscanalsobedesigned fromafrequencyresponse specification. The
equivalentsampledimpulseresponse, whichdetermines thecoefficientsofthe
FIRfilter,canthenbefoundbyinverse(discrete) Fouriertransformation (Discrete
FourierTransforms arenotcovereduntillaterinthecoursebuttheexamplefilter
designbelowshouldstillbeeasytofollow).
Consider anideallow-passcharacteristic (brick-wallfilter) 798
:withacut-
offfrequency
<;=(>4?
A@where
@sampling period:
Weknowthatthecontinuous impulseresponse
CB
isgivenby(andshownin
Fig.6.1):DB
E
>
F,G$
G
7H8
:JILK1MNCOA
<;>QPSRUT9V
=;B <;BXW(6.1)
Thesampledimpulseresponse
D
(whichwouldbeobtainedbytakingthein-
verseDFTofthediscreteequivalent“brick-wall”frequencycharacteristics) isthe
sampledversionofthecontinuousY9Z\[]]function. Itisnotpossibletoimplement
thecorresponding low-passfilterdesignbecause:
72
−10 −5 0 5 10−0.1−0.0500.050.10.150.20.25
tg(t)
−10 −5 0 5 10−0.1−0.0500.050.10.150.20.25
kT (T=1)g[k]
Figure6.1:Impulseresponseofbrickwallfilterin(left)continuous and(right)
discretetimedomains.^aninfinitenumberofcoefficientswouldberequired^theimpulseresponse isthatofanon-causal system
D
existsbetween_a`and
bc.
Afirstsolution
hencewecould,
1.Truncatetheexpression for
D
atsomereasonable valueof
,say10.
2.Shiftallthecoefficientsbythesamenumber.
ThisisshowninFig6.2.
Nowthatwehavethedifferenceequation
3
'ed
f gihdkj
g
lm"
forthefilter,wecanalsoobtainitstransferfunction7"!
k
'ed
f gnhd
j
g!$
g
Asbefore,wecanobtaintheactualfrequencyresponse ofthefilterbyevalu-
ating 7-!
ontheunitcircle(i.e. 7
IK1Mpo
).ThisisshowninFig6.3usingboth
linearandlogarithmic plotsfortheamplitude response.
73
0 5 10 15 20−0.1−0.0500.050.10.150.20.25
kshift g[k]
Figure6.2:Impulseresponseofbrickwallfiltershifted.
0 20 40 60 80 100 120 14000.20.40.60.811.21.4
π/4 0 20 40 60 80 100 120 14010−310−210−1100101
π/4
Figure6.3:Linear(left)andlog(right)responses for21and11coefficientsinthe
brickwallfilter.
Bettersolution
Thetruncation oftheimpulseresponseisequivalenttomultiplying itbyarectan-
gular“window”function. Thisleadstoanovershootandripplebeforeandafter
thediscontinuity inthefrequencyresponse –aphenomenom knownasGibb’s
phenomenom (theovershootisabout9%–seepreviousFig).Theamplitude of
theovershootdoesnotdecreaseifmoreandmorecoefficientsareincludedinthe
digitalfilter.
Amoresuccessful wayofdesigning anFIRfilteristouseafiniteweighting
sequence q
.Thereareanumberofsuchsequences, forexampletheHamming,
74
HanningorKaiserwindows.q
sr
+t
.+SvuxwRSyUz
{
.|E}(~}|
0elsewhere
If
+(v
thisistheHamming window,if
+(vthisistheHanning,orraised
cosine,window.Fig6.4showsthe11pointHamming window.TheFourier
02468101200.20.40.60.81
kw[k]
Figure6.4:11pointHamming window.
transform ofthesewindowsconsistsofacentrallobewhichcontainsmostofthe
energyandsidelobeswhichgenerally decayveryrapidly.
TheuseofsuchawindowtoreducetheFouriercoefficientsforthehigherfre-
quencytermsleadstoareduction inrippleamplitude, attheexpenseofaslightly
worseinitialcut-offslope.Thefrequencyresponseofthe21-coefficientFIRfilter
Fig.6.3isshowninFig.6.5togetherwiththatoftheequivalent“windowed”
filter(thefilterweightsonthiscasebeingcomputed from
D5
3D5
"q
)using
aHamming window.
6.2.1FIRfilterdesign–conclusion
FIRfiltersareusuallyfoundinapplications wherewaveformdistortion dueto
non-linear phaseisharmful. Asthe2examplesoffiltersstudiedillustrate, FIR
filterswithexactlylinearphasecanbedesigned (theymusthaveanimpulsere-
sponsewhichiseithersymmetrical –i.e.palindromic coefficients–orpurely
75
0 20 40 60 80 100 120 14000.20.40.60.811.21.4
π/4
Figure6.5:Hamming windowremovingovershoot.
anti-symmetrical). FIRfiltersaremostlyrealisedasnon-recursi vestructures; such
filtersarealwaysstable.However,ifasharpcut-offintheamplitude response is
required, alargenumberofcoefficientsareneeded(usually 100).
76
6.3DesignofIIRfilters
Mostrecursivefiltershaveaninfiniteimpulseresponse, becauseofthefeedback
ofpreviousoutputs.Practical Infinite-Impulse-Response (IIR)filtersareusually
baseduponanalogue equivalents(Butterworth,Chebyshe v,etc.),usingatransfor-
mationknownasthebilineartransformation whichmapsthe
-planepolesand
zerosoftheanalogue filterintothe!-plane.However,itisquitepossibletodesign
anIIRfilterwithoutanyreference toanalogue designs,forexamplebychoos-
ingappropriate locations forthepolesandzeroesontheunitcircle(Remember:7
IKeMo
kwhereverthereisazeroontheunitcircle,i.e.complete attenuation
ofthatfrequency;ontheotherhand, 7
IK1Mpo
`whenthereisapolenearthe
unitcircle,i.e.highgainatthatfrequency).
6.4Bilineartransformation
Thetechnique ofdigitizing ananalogue designisthemostpopularIIRfilterdesign
technique, sincethereisalargeamountoftheoryonstandard analogue filters
available(someofwhichwasexploredinthefirsthalfofthislecturecourse).
Thebilinear!-transform isamathematical transformation fromthe
-domain
tothe!-domainwhichpreservesthefrequencycharacteristics andisdefinedby:
@
!$&%
!$&%where
@sampling period
Underthismapping, theentire8
axisinthe
-planeismappedontotheunit
circleinthe!-plane;theleft-half
-planeismappedinsidetheunitcircleandthe
right-half
-planeismappedoutsidetheunitcircle.
Thebilineartransformation givesanon-linear relationship betweenanalogue
frequency
<anddigitalfrequency
<.Sincethefrequencyresponse ofadigital
filterisevaluatedbysetting!
bIK1Mpo:
8
=
@
.I$
K1Meo
2I$
K1M
o
@
I
K1M
o'
.I$
K1M
o'I
K1M
o'
2I$
K1M
o'
@V
8
<
@
ie.
<
@V
<
@
77
Theformofthisnon-linearity isshowninFig.6.6forthecase
@.For
smallvaluesof
<,themappingisalmostlinear;formostofthefrequencyscale,
however,themappingishighlynon-linear .
0 0.5 1 1.500.511.522.533.5
ωdωa
Figure6.6:Thebilinearmappingfunction.
Thecut-offfrequencies ofadigitalfilterwilltherefore betangentially warped
compared withthoseoftheanalogue filterfromwhichitwasdesigned. Inorder
tocompensate forthisundesirable effect,itisnecessary topre-warptherequired
cut-offfrequencies beforedesigning theanalogue filter.Thus^thedesiredsetofdigitalfiltercut-offfrequencies isdetermined first.For
example,iftherearefourcritcialcut-offfrequencies,
=%
<'
<1and
=e).
Usingthefrequencywarpingrelationship derivedabove,thefiltercut-off
frequencies areconvertedtoanewsetofanalogue cut-offfrequencies, <%
<'
<Jand
=1.^Finally,ananalogue filterisdesigned withtheappropriate warpedcut-off
frequencies. Applying thebilineartransformation tothisanalogue filter
givesadigitalfilterwiththedesiredcut-offfrequencies.
78
6.4.1Example: designofIIRfilterusingbilinearz-transform
Designadigitallow-passButterworthfilterwitha3dBcut-offfrequencyof2kHz
andminimum attenuation of30dBat4.25kHzforasampling rateof10kHz.
Answer
Hz;hence
@
$
sec. <%
>
rads/sec;
='
>
¡¢
rads/sec.
Applypre-warping transformation: <%
@#LV
=%
@
b
LV
vp>£v¤AA¥c
@
¡A¦
rads/sec <'
@
LV
<'
@
b
LV
v
¢>§(¨¢¦v ¦
rads/sec
(ie.
%
¦kHzand
'
¦v ¦kHz–thisshowsthewarpingeffectnear ©"ª')
Theorderoffilterrequiredcannowbeworkedoutasbefore:«¬ ®C¯
D°®-¯
DM±M²
³®C¯
D%-d
´
®C¯
D%-dcµ
U¶ %%
¶ ·e
¡¸A¨¹»º½¼meetsthespecification
Forasecond-order ButterworthLPF,7
k
'
;
'
´p <; '
;
Substitute
<%
b <;k¾¤¢¿¥c
'oinaboveequationandusethebilineartransfor-
mation
'o
%e$ÀÁ¿Â%"ÃÀÁ¿Â:7"!
k
'o
'
¤¢¿¥c
''o
'
%e$ÀÁ¿Â%"ÃÀÁ¿Â
'
´'o
'
v¡¤¢A¥c
%e$ÀÁAÂ%"ÃÀÁAÂ
Ä'o
'
v¡¤¢A¥¢
'
79
(NB:'o
factorcancelsout)7-!
v¡¢¢¤A¨A¥%e$ÀÁAÂ%"ÃÀÁAÂ
'
c¢¤
¸%e$ÀÁAÂ%"ÃÀÁ¿Â
Äv¡¢¢¤¿¨¢¥7-!
kv¡¢¢¤A¨A¥
#!$&%
!$'¡¢¢A¦cÅv ¸
¢¢¤!$&%
v¡A¢¢¦A¨!$'7-!
bv¡A¢¥c¢¤
#!$&%
!$'
.v ¦¢¥¢¸cA¦!$&%
v
¸cA¨¢!$'
fromwhichwecanfinallywritethefollowingdifferenceequation:
<Æv¿¢¥c¢¤
vÇv
¦
,v¡A¢¥cA¤
Ç
vÇv ¦¢¥¢¸c¿¦A5l
3v
¸c¿¨c¿ È2p
Inordertocheckthemagnitude characteristics ofthefrequencyresponse, re-
write 7"!
as:7-!
bv¡A¢¥cA¤
!'
#!
!'
v ¦¢¥¢¸c¿¦!
v
¸cA¨¢^dcgain:
<
@È!
whichgives É\7
É
^3dBcut-offfrequency
<%
@(v
>
Thus7
Id
¶ z
Kkv¿¢¥c¢¤
uxwR
v ¨¿>Ê8RUT9V
¡¨¿>Ê
uxwR
v
>Ê8RUTËV
>ÌÄ
uxwR
¡¨¿>Ê8RUT9V
v ¨¿>Ív ¦¢¥¢¸cA¦
uÎwR
v
>Ê8RJTËV
v
>4Ä2v
¸cA¨c
ie. 7
Id
¶ z
Kk(v¡A¢¥c¢¤
v ¨¢¢¸¢#
¨¢¸¢¸8av¡¤¢¢¤¿¦¢¸A¦A¥¢¦
8whichgives É\7~É
v¡¤Ac¤
80
Youcanalsocheckthe30dBminimum attenuation requirement byworkingout7
Id
¶µ
·z
K
.
6.4.2Conclusion
WithrecursiveIIRfilters,wecangenerally achieveadesiredfrequencyresponse
characteristic withafilteroflowerorderthanforanon-recursi vefilter(especially
ifellipticdesignsareused).Arecursivefilterhasbothpolesandzeroeswhich
canbeselectedbythedesigner,hencetherearemorefreeparameters thanfora
non-recursi vefilterofthesameorder(onlyzeroescanbevaried).However,when
thepolesofanIIRfilterareclosetotheunitcircle,theyneedtobespecified very
accurately (typically 3to6decimalplaces)ifinstability istobeavoided.
81