Table Of ContentPractical FIR Filter Design in MATLAB(cid:13)R
Revision1.0
RicardoA.Losada
TheMathWorks,Inc.
3AppleHillDr.
Natick,MA01760,USA
March31,2003
Abstract
4 Optimal equiripple designs with fixed transi-
tionwidthandpeakpassband/stopbandripple 7
Thistutorialwhite-paperillustratespracticalaspectsofFIR 4.1 Minimum-phase designs with fixed tran-
filterdesignandfixed-pointimplementationalongwiththe sition width and peak passband/stopband
algorithms available in the Filter Design Toolbox and the
ripple . . . . . . . . . . . . . . . . . . . 8
SignalProcessingToolboxforthispurpose.
Theemphasisismostlyonlowpassfilters,butmanyofthe
5 Optimalequirippledesignswithfixedpeakrip-
resultsapplytootherfiltertypesaswell.
pleandfilterorder 8
The tutorial focuses on practical aspects of filter design
5.1 Minimum-phase designs with fixed peak
and implementation, and on the advantages and disadvan-
rippleandfilterorder . . . . . . . . . . . 8
tagesofthedifferentdesignalgorithms. Thetheorybehind
thedesignalgorithmsisavoidedexceptwhenneededtomo- 6 Otherequirippledesigns 9
tivatethem. 6.1 Constrained-bandequirippledesigns . . . 9
6.2 Slopedequiripplefilters . . . . . . . . . . 9
Contents
7 Advanceddesignalgorithms-interpolatedFIR
filters 10
1 Ideallowpassfilter 2
7.1 FurtherIFIRoptimizations . . . . . . . . 11
7.2 MultirateimplementationofIFIRdesign . 13
2 FIRlowpassfilters 2
2.1 FIRfilterdesignspecifications . . . . . . 2 8 Interpolationfilterdesign 13
8.1 Ideal band-limited interpolation in the
3 Optimal FIR designs with fixed transition
frequencydomain . . . . . . . . . . . . . 14
widthandfilterorder 3
8.2 Ideal band-limited interpolation in the
3.1 Linear-phasedesigns . . . . . . . . . . . 4
timedomain . . . . . . . . . . . . . . . . 15
3.1.1 Equiripplefilters . . . . . . . . . 4
8.3 DesignofFIRinterpolationfilters . . . . 16
3.1.2 Least-squaresfilters . . . . . . . 4
8.3.1 NyquistFIRfilters . . . . . . . . 17
3.2 Nonlinear-phasedesigns . . . . . . . . . 5 8.3.2 Halfbandfilters . . . . . . . . . . 17
3.2.1 Minimum-phasedesigns . . . . . 5 8.3.3 OtherNyquistfilters . . . . . . . 18
3.2.2 Moregeneralnonlinear-phasede-
signs . . . . . . . . . . . . . . . 6 9 Design of perfect-reconstruction two-channel
3.2.3 Awordonpracticalimplementation 7 FIRfilterbanks 19
1
PracticalFIRFilterDesigninMATLAB
RicardoA.Losada Page2
10 Implementing an FIR filter using fixed-point
arithmetic 20
10.1 Somenotation . . . . . . . . . . . . . . . 20
10.2 Quantizingthecoefficients . . . . . . . . 21
10.3 Fixed-pointfiltering . . . . . . . . . . . . 22
10.3.1 Using an accumulator with ex-
tendedprecision . . . . . . . . . 25
11 Adesignexample 26
11.1 Usingthe4016forGSM . . . . . . . . . 27
11.1.1 DesigningtheCFIRfilter . . . . . 27
11.1.2 DesigningthePFIRfilter . . . . . 28
1 Ideal lowpass filter
Theideallowpassfilterisonethatallowsthroughallfre- Figure 1: Illustration of the typical deviations from the ideal
quencycomponentsofasignalbelowadesignatedcutoff lowpassfilterwhenapproximatingwithanFIRfilter,w c=0.4p .
frequency w , and rejects all frequency components of a
c
signalabovew .
c
Itsfrequencyresponsesatisfies
response of an ideal lowpass filter when approximating
( withafiniteimpulseresponse. PracticalFIRdesignstyp-
1, 0≤w ≤w
H (ejw )= c (1) ically consist of filters that meet certain design specifi-
LP 0, w c<w ≤p cations, i.e., that have a transition width and maximum
passband/stopband ripples that do not exceed allowable
Theimpulseresponseoftheideallowpassfilter(1)can values.
easilybefoundtobe[1] Inaddition, onemustselectthefilterorder, orequiva-
lently,thelengthofthetruncatedimpulseresponse.
sin(w n)
h [n]= c , −¥ <n<¥ . (2) AusefulmetaphorforthedesignspecificationsinFIR
LP p n designistothinkofeachspecificationasoneoftheangles
inatriangleasinFigure2.
2 FIR lowpass filters The metaphor is used to understand the degrees of
freedomavailablewhendesignatingdesignspecifications.
Because the impulse response required to implement the Because the sum of the angles is fixed, one can at most
ideal lowpass filter is infinitely long, it is impossible to select the values of two of the specifications. The third
designanidealFIRlowpassfilter. specification will be determined by the design algorithm
Finite length approximations to the ideal impulse re- utilized. Moreover,aswiththeanglesinatriangle,ifwe
sponseleadtothepresenceofripplesinboththepassband make one of the specifications larger/smaller, it will im-
(w <w c)andthestopband(w >w c)ofthefilter,aswell pactoneorbothoftheotherspecifications.
astoanonzerotransitionwidthbetweenthepassbandand Asanexample,considerthedesignofanFIRfilterthat
stopbandofthefilter(seeFigure1). meetsthefollowingspecifications:
SpecificationsSet1
2.1 FIRfilterdesignspecifications
1. Cutofffrequency: 0.4p rad/sample
Both the passband/stopband ripples and the transition
widthareundesirablebutunavoidabledeviationsfromthe 2. Transitionwidth: 0.06p rad/sample
PracticalFIRFilterDesigninMATLAB
RicardoA.Losada Page3
Figure2:FIRdesignspecificationsrepresentedasatriangle. Figure3: Kaiserwindowdesignmeetingpredescribedspecifi-
cations.
3. Maximumpassband/stopbandripple: 0.05
allyinferiortothoseproducedbyalgorithmsthatemploy
some optimization criteria in that it will have greater or-
The filter can easily be designed with the truncated-and-
der,greatertransitionwidthorgreaterpassband/stopband
windowed impulse response algorithm implemented in
ripples. Anyoftheseistypicallyundesirableinpractice,
fir1 (or using fdatool) if we use a Kaiser window.
thereforemoresophisticatedalgorithmscomeinhandy.
The zero-phase response of the filter is shown in Figure
Optimal designs are computed by minimizing some
3. Notethatsincewehavefixedtheallowabletransition
measureofthedeviationbetweenthefiltertobedesigned
widthandpeakripples,theorderisdeterminedforus.
andtheidealfilter.ThemostcommonoptimalFIRdesign
Close examination at the passband-edge frequency,
w =0.37p 1 and at the stopband-edge frequency w = algorithmsarebasedonfixingthetransitionwidthandthe
p s
0.43p showsthatthepeakpassband/stopbandripplesare orderofthefilter. Thedeviationfromtheidealresponse
ismeasuredonlybythepassband/stopbandripples. This
indeed within the allowable specifications. Usually the
deviationorerrorcanbeexpressedmathematicallyas[2]
specifications are exceeded because the order is rounded
tothenextintegergreaterthantheactualvaluerequired. E(w )=H (w )−H (ejw ), w ∈W
a LP
where H (w ) is the zero-phase response of the designed
3 Optimal FIR designs with fixed a
filterandW =[0,w ]∪[w ,p ]. Itisstillnecessarytode-
p s
transition width and filter order fineameasuretodetermine“thesize”ofE(w )-thequan-
tity we want to minimize as a result of the optimization.
Whilethetruncated-and-windowedimpulseresponsede- ThemostoftenusedmeasuresaretheL¥ -norm(kE(w )k¥
sign algorithm is very simple and reliable, it is not op- - minimax designs) and the L2-norm (kE(w )k2 - least-
timal in any sense. The designs it produces are gener- squaresdesigns).
Inordertoallowfordifferentpeakripplesinthepass-
1Thepassband-edgefrequencyistheboundarybetweenthepassband bandandstopband,aweightingfunction,W(w )isusually
andthetransitionband. IfthetransitionwidthisTW, thepassband-
introduced,
edgefrequencyw pisgivenintermsofthecutofffrequencyw cbyw p=
ww cc+−TTWW//22.Similarly, thestopband-edgefrequencyisgivenbyw s= EW(w )=W(w )[Ha(w )−HLP(ejw )], w ∈W
PracticalFIRFilterDesigninMATLAB
RicardoA.Losada Page4
3.1 Linear-phasedesigns
A filter with linear-phase response is desirable in many
applications,notablyimageprocessinganddatatransmis-
sion. OneofthedesirablecharacteristicsofFIRfiltersis
thattheycanbedesignedveryeasilytohavelinearphase.
Itiswellknown[3]thatlinear-phaseFIRfilterswillhave
impulse responses that are either symmetric or antisym-
metric. Forthesetypesoffilters,thezero-phaseresponse
can be determined analytically [3], and the filter design
problem becomes a well behaved mathematical approx-
imation problem [4]: Determine the best approximation
to a given function - the ideal lowpass filter’s frequency
response-bymeansofapolynomial-theFIRfilter-of
givenorder-thefilterorder-.By“best”itismeanttheone
whichminimizesthedifferencebetweenthem-E (w )-
W
accordingtoagivenmeasure. Figure 4: Passband ripple for of both the Kaiser-window-
The remez function implements an algorithm devel- designedFIRfilterandtheremez-designedFIRfilter.
opedin[5]thatcomputesasolutiontothedesignproblem
forlinear-phaseFIRfiltersintheL¥ -normcase. Thede-
sign problem is essentially to find a filter that minimizes
Figure 4 shows the superposition of the passband de-
the maximum error between the ideal and actual filters.
tails for the filters designed with the Kaiser window and
This type of design leads to so-called equiripple filters,
withtheremezfunction. Clearlythemaximumdeviation
i.e. filtersinwhichthepeakdeviationsfromtheidealre-
issmallerfortheremezdesign. Infact,sincethefilteris
sponseareallequal.
designedtominimizethemaximumripple(minimaxde-
The firls function implements an algorithm to com-
sign), we are guaranteed that no other linear-phase FIR
pute solution for linear-phase FIR filters in the L -norm
2 filterof42ndorderwillhaveasmallerpeakrippleforthe
case. Thedesignproblemistofindafilterthatminimizes
sametransitionwidth.
theenergyoftheerrorbetweenidealandactualfilters.
3.1.2 Least-squaresfilters
3.1.1 Equiripplefilters
Equiripple designs may not be desirable if we want to
Linear-phaseequiripplefiltersaredesirablebecausethey minimize the energy of the error (between ideal and ac-
have the smallest maximum deviation from the ideal fil- tualfilter)inthepassband/stopband. Consequently,ifwe
terwhencomparedtoallotherlinear-phaseFIRfiltersof want to reduce the energy of a signal as much as possi-
thesameorder.Equiripplefiltersareideallysuitedforap- bleinacertainfrequencyband,least-squaresdesignsare
plicationsinwhichaspecifictolerancemustbemet. For preferable.
example, if it is necessary to design a filter with a given For example, for the same transition width and filter
minimumstopbandattenuationoragivenmaximumpass- order as the equiripple filter designed in Section 3.1.1, a
bandripple. least-squaresFIRdesigncanbecomputedfrom
For example the Kaiser-window design of Section 2.1
bls = firls(42,[0 0.37 0.43 1],[1 1 0 0]);
was of 42nd order. With this same order, an equiripple
filter(withfixedtransitionwidth)canbedesignedthatis
Thestopbandenergyforthiscaseisgivenby
superiortotheKaiser-windowdesign:
1 Z p
br = remez(42,[0 0.37 0.43 1],[1 1 0 0]); Esb= 2p 0.43|Ha(ejw )|2dw
PracticalFIRFilterDesigninMATLAB
RicardoA.Losada Page5
Figure 6: Depiction of the solution space for linear-phase and
nonlinear-phaseFIRfiltersforagivensetofspecifications. Re-
gionArepresentsthesetofalllinear-phaseFIRfiltersthatmeet
thespecifications. RegionBrepresentsthesetofalllinearand
nonlinear-phaseFIRfiltersthatmeetthespecifications.
Figure5: ComparisonofanoptimalequirippleFIRdesignand
anoptimalleast-squaresFIRdesign. Theequiripplefilterhasa
smallerpeakerror,butlargeroverallerror.
optimalsolution.TheideaisdepictedinFigure6[7].Re-
gion A in the graph represents the set of all linear-phase
whereH (ejw )isthefrequencyresponseofthefilter. FIR filters that meet a given set of specifications. This
a
set contains both the optimal equiripple and the optimal
Inthiscase,thestopbandenergyfortheequiripplefilter
least-squaresfilterswehavementionedsofar. RegionB
isapproximately1.7608e-004whilethestopbandenergy
representsthesetofallFIRfiltersthatmeetasetofspec-
fortheleast-squaresfilteris3.3106e-005.(Asareference,
ifications,regardlessoftheirphasecharacteristic. Clearly
thestopbandenergyfortheKaiser-windowdesignforthis
RegionBcontainsRegionA.
orderandtransitionwidthis6.1646e-005).
So while the equiripple design has less peak error, it
has more “total” error, measured in terms of its energy.
3.2.1 Minimum-phasedesigns
The stopband details for both equiripple design and the
least-squaresdesignisshowninFigure5. Ifoneisabletorelaxthelinear-phaseconstraint(i.e.ifthe
applicationathanddoesnotrequirealinear-phasecharac-
teristic), itispossibletodesignminimum-phaseequirip-
3.2 Nonlinear-phasedesigns
ple filters that are superior to optimal equiripple linear-
One of the advantages of FIR filters, when compared to phasedesignsbasedonatechniquedescribedin[8].
IIR filters, is the ability to attain exact linear phase in a Forexample,thefollowingminimum-phasedesignhas
straightforward manner. As we have already mentioned, bothsmallerpeakpassbandrippleandsmallerpeakstop-
thelinear-phasecharacteristicimpliesasymmetryoran- bandripplethanthelinear-phaseequirippledesignofSec-
tisymmetrypropertyforthefiltercoefficients. Neverthe- tion3.1.1:
less,thissymmetryofthecoefficientsconstraintsthepos-
sible designs that are attainable. This should be obvious bm = gremez(42,[0 0.37 0.43 1],...
since for a filter with N+1 coefficients, only N/2+1 [1 1 0 0],[1 10],’minphase’);
ofthesecoefficientsarefreelyassignable(assumingN is
even). The remaining N/2 coefficients are immediately It is important to note that this is not a totally un-
determinedbythelinear-phaseconstraint. constraineddesign. Theminimum-phaserequirementre-
Onecanthinkofthisasreducingthesearchspaceforan strictstheresultingfiltertohaveallitszerosonorinside
PracticalFIRFilterDesigninMATLAB
RicardoA.Losada Page6
theunitcircle.2
3.2.2 Moregeneralnonlinear-phasedesigns
We have just stated that minimum-phase designs are not
completely unconstrained due to the requirement on the
lociofthezeros. Ageneralnonlinear-phasedesignalgo-
rithmisprovidedinthefirlpnormfunction.
Considerthefollowingspecifications:
SpecificationsSet2
1. Cutofffrequency: 0.375p rad/sample
2. Transitionwidth: 0.15p rad/sample
3. Maximumpassbandripple: 0.008
4. Maximumstopbandripple: 0.0009
Figure7: Magnituderesponsesofaminimum-phaseequiripple
30thorderfilterandageneralnonlinear-phaseequiripplefilter
A30thorderFIRequiripplefilter(withnonlinearphase)
of the same order. Both filters are designed to meet the same
canbedesignedtomeetthatsetofspecswithfirlpnorm,
specs.
blp = firlpnorm(30,[0 .3 .45 1],[0 .3 ...
.45 1],[1 1 0 0],[1 1 10 10]);
Thiscontrastswitha37thorderfilterifwerequirelin-
ear phase. By comparison, a minimum-phase equiripple
filter designed using gremez as described above also re-
quiresa30thorderfiltertomeetthespecificationswhich
isquiteremarkableconsideringtheminimum-phasecon-
straint.
Thefactthattwodifferentnonlinear-phasefiltersofthe
sameordermeetthesamespecificationsillustratesthedif-
ficultyassociatedwithnonlinear-phasedesignsingeneral.
There is no longer a unique optimal solution to a given
design problem. Figure 7 shows the virtually identical
magnituderesponses. Incontrast,Figure8showsthere-
markablydifferentimpulseresponses.
firlpnormalsoprovidestheabilitytoselectadifferent
normfortheoptimization. Whilethedefaultoptimization
isfortheL¥ norm,anynormbetween(andincluding)L2 Figure 8: Impulse response comparison for an equiripple
andL¥ ispossible. minimum-phase filter and a nonlinear-phase equiripple filter
By the arguments given above, it is possible to attain withvirtuallythesamemagnituderesponse.
a superior design using firlpnorm instead of firls for
the same filter order, provided linear phase is not a re-
quirement. Forexample,
b = firlpnorm(40,[0 .4 .45 1],[0 .4 .45 1],...
2Givenanylinear-phaseFIRfilterwithnonnegativezero-phasechar-
[1 1 0 0],[1 1 10 10],[2 2]);
acteristic,itispossibletoextracttheminimum-phasespectralfactorus-
ingthefirminphasefunction. b2 = firls(40,[0 .4 .45 1],[1 1 0 0],[1 20]);
PracticalFIRFilterDesigninMATLAB
RicardoA.Losada Page7
Figure9:Stopbanddetailsofanonlinear-phaseleast-squaresfil- Figure10: OptimalLp normdesignsfordifferentvaluesof p.
terandalinear-phaseleast-squaresfilterofthesameorder. The Allfiltershavethesameorderandtransitionwidth.
nonlinear-phasefilterprovidesasmallertransitionwidthanda
largerstopbandattenuation.
4 Optimal equiripple designs with
fixed transition width and peak
yieldsasmallertransitionwidthandalargerstopband passband/stopband ripple
attenuation for the nonlinear-phase case (with approxi-
matelythesamepeakpassbandripple). Thestopbandde- We have seen that the optimal equiripple designs out-
tailsareshowninFigure9. perform Kaiser-window designs for the same order and
transitionwidth. Thedifferencesareevenmoredramatic
Because it is possible to choose the L norm with
p
when the passband ripple and stopband ripple specifica-
whichtooptimize,firlpnormisveryflexibleandallows
tions are different. The reason is that the truncated-and-
forthedesignertoreachacompromisebetweenequirip-
windowedimpulseresponsemethodsalwaysgivearesult
pleandleast-squaresdesigns. ThisisillustratedinFigure
withapproximatelythesamepassbandandstopbandpeak
10.
ripple. Therefore, always the more stringent peak rip-
pleconstraintissatisfied,resultinginexceeding(possibly
significantly)allotherrippleconstraintsattheexpenseof
unnecessarilylargefilterorder.
To illustrate this, we turn to a different equiripple de-
3.2.3 Awordonpracticalimplementation
sign in which both the peak ripples and the transition
width are fixed. Referring back to the triangle in Figure
Becauseofthesymmetryinthecoefficients,somepracti- 2,thismeanstheresultingfilterorderwillcomefromthe
calimplementationswillallowforalinear-phaseresponse designalgorithm.
usingroughlyhalfthenumberofmultipliers. Thisispar- Consider once again the Specifications Set 2. The
ticularlytruewithFPGAsandspecializedhardware. The gremezfunctioncanbeusedtodesignthisfilter
end result is that it may very well be possible to stick to
alinear-phasedesignandachieveamoreefficientimple- b = gremez(’minorder’,[0 .3 .45 1],...
mentationthancomparablenonlinear-phasedesigns. [1 1 0 0],[.008 .0009]);
PracticalFIRFilterDesigninMATLAB
RicardoA.Losada Page8
2. Transitionwidth: 0.02p rad/sample
3. Maximumpassbandripple: 0.01
4. Maximumstopbandripple: 0.001
Theminimumorderneededtomeetsuchspecifications
with a linear-phase FIR filter is 262. This filter must be
theresultofanoptimalequirippledesign. Ifwerelaxthe
linear-phaseconstrainthowever,thegremezfunctioncan
designaminimum-phaseFIRfilterthatmeetsthespecifi-
cationssetwith216thorder:
bgm = gremez(’minorder’,[0 .12 .14 1],...
[1 1 0 0],[0.01 0.001],’minphase’);
5 Optimal equiripple designs with
Figure11: PassbandrippledetailsforboththeKaiser-window-
designed FIR filter and the remez-designed FIR filter. The fixed peak ripple and filter order
Kaiser-windowdesignover-satisfiestherequirementattheex-
penseofincreasenumberoftaps.
So far we have illustrated equiripple designs with fixed
transition width and fixed order and designs with fixed
transition width and fixed peak ripple values. The Filter
resulting in a filter of 37th order (38 taps). By compari- DesignToolboxalsoprovidesalgorithmsfordesignswith
son, a Kaiser-window design requires a 50th order filter fixed peak ripple values and fixed filter order [6]. This
(51 taps) to meet the same specifications. The passband givesmaximumflexibilityinutilizingthedegreesoffree-
details can be seen in Figure 11. It is evident that the domavailabletodesignanFIRfilter.
Kaiser-windowdesignover-satisfiestherequirementssig- We have seen that, when compared to Kaiser-window
nificantly. designs,fixingthetransitionwidthandfilterorderresults
in an optimal equiripple design with smaller peak ripple
values, while fixing the transition width and peak ripple
4.1 Minimum-phase designs with fixed
values results in a filter with less number of taps. Nat-
transition width and peak pass-
urally, fixing the filter order and the peak ripple values
band/stopbandripple shouldresultinasmallertransitionwidth.
Toverifythis,weusethefirceqripfunction,
Thesameproceduretodesignminimum-phasefilterswith
fixedfilterorderandfixedtransitionwidthcanbeusedto bc = firceqrip(50,0.375,[0.008 0.0009]);
designminimum-phasefilterswithfixedtransitionwidth
The comparison of this new design with the Kaiser-
and peak passband/stopband ripple. In this case, rather
window design is shown in Figure 12. The transition
than obtaining smaller ripples, the benefit is meeting the
width has been reduced from 0.15p to approximately
sametransitionwidthandpeakpassband/stopbandripples
0.11p .
withareducedfilterorder.
As an example, consider the following specifications
set: 5.1 Minimum-phase designs with fixed
peakrippleandfilterorder
SpecificationsSet3
Once again, if linear-phase is not a requirement, a
1. Cutofffrequency: 0.13p rad/sample minimum-phase filter can be designed that is a superior
PracticalFIRFilterDesigninMATLAB
RicardoA.Losada Page9
terbeginsataspecificfrequencyvalueandthatthefilter
provideagivenminimumstopbandattenuation.
Ifthefilterorderisfixed-forinstancewhenusingspe-
cializedhardware-therearetwoalternativesavailablein
theFilterDesignToolboxforoptimalequirippledesigns.
Oneposibilityistofixthetransitionwidth,theotheristo
fixthepassbandripple.
For example, the design Specifications Set 2 call for
a stopband that extends from 0.45p to p and provide a
minimum stopband attenuation of approximately 60 dB.
Forillustrationpurposes,supposethefilterorderavailable
is40(41taps). Thefirceqripfunctioncandesignthis
filterifwealsofixthepassbandrippleto0.008.Theresult
willbeafilterwiththesmallestpossibletransitionwidth
foranylinear-phaseFIRfilterofthatorderthatmeetsthe
givenspecifications.
Figure 12: Comparison of a Kaiser-window-designed FIR fil-
ter and an optimal equiripple FIR filter of the same order and bc = firceqrip(40,0.45,[0.008 0.0009],...
peak ripple values. The equiripple design results in a reduced ’stopedge’);
transition-width.
Ifincontrastwewanttofixthetransitionwidth, wecan
use the gremez function. The result in this case will be
afilterwiththesmallestpossiblepassbandrippleforany
in some sense to a comparable linear-phase filter. In
linear-phase FIR filter of that order that meets the given
this case, for the same filter order and peak ripple value,
specifications.
a minimum-phase design results in a smaller transition
widththanalinear-phasedesign.
bg = gremez(40,[0 .3 .45 1],[1 1 0 0],...
For example, compared to the 50th order linear-phase
[1 0.0009],{’w’,’c’});
design bc, the following design has a noticeably smaller
transitionwidth: ThepassbanddetailsofthetwofiltersareshowninFig-
ure13. NotethatbothfiltersmeettheSpecificationsSet
bcm=firceqrip(50,0.375,[0.008 0.0009],’min’);
2becausetheorderused(40)islargerthantheminimum
orderrequired(37)byanequiripplelinear-phasefilterto
6 Other equiripple designs meet such specifications. The filters differ in how they
“use” the extra number of taps to better approximate the
For specific design problems, further equiripple design ideallowpassfilter.
options are available in the Filter Design Toolbox. No-
tably, the constrained-band design - where one can fix 6.2 Slopedequiripplefilters
thefilterorderalongwiththepeakrippleandthebeggin-
ing/end of a given band (passband or stopband)- and the Analternativetousingleast-squaresdesignsistodesign
slopedstopbanddesign, wherethestopbandisnolonger optimal equiripple filters but allowing for a slope in the
equiripple,butratherhasapredeterminedslope. stopbandofthefilter. Thishastheadvantage(overleast-
squaresdesigns)thatthepassbandcanremainequiripple,
thus minimizing the input signal fluctuations in that re-
6.1 Constrained-bandequirippledesigns
gion.
Sometimeswhendesigninglowpassfiltersfordecimation While one can achieve sloped stopbands using the
it is necessary to guarantee that the stopband of the fil- remez or gremez methods by utilizing the weights,
PracticalFIRFilterDesigninMATLAB
RicardoA.Losada Page10
Figure13: ComparisonoftwooptimalequirippleFIRfiltersof Figure14: PassbanddetailsofaslopedoptimalequirippleFIR
40thorder. Bothfiltershavethesamestopband-edgefrequency designandanoptimalleast-squaresFIRdesign. Theequiripple
andminimumstopbandattenuation. Oneisoptimizedtomini- filterhasasmallerpeakerrororsmallertransitionwidthdepend-
mizethetransitionwidthwhiletheotherisoptimizedtomini- ingontheinterpretation.
mizethepassbandripple.
firceqrip provides the best control and easiest way to
dothis(attheexpenseofnothavingfullcontroloverthe
transition width). Using firceqrip one can specify the
desiredslope(indBperfrequencyunit)forthestopband.
Forexample,thefollowingdesign,
bf = firceqrip(42,0.4346,[0.035],[0.03],...
’slope’,40,’stopedge’);
results in a stopband energy of approximately 3.9771e-
005,notmuchlargerthattheleast-squaresdesignofSec-
tion3.1.2,whilehavingasmallertransitionwidth(orpeak
passband ripple - depending on the interpretation). The
passbanddetailsofboththeleast-squaresdesignandthe
slopedequirippledesignareshowninFigure14(indB).
ThestopbanddetailsareshowninFigure15(alsoindB).
Figure15: StopbanddetailsofaslopedoptimalequirippleFIR
design and an optimal least-squares FIR design. The overall
erroroftheequiripplefilterapproachesthatoftheleast-squares
7 Advanced design algorithms - in- design.
terpolated FIR filters
For any given FIR design algorithm, if the peak ripple meetagivenspecificationssetisinverselyproportionalto
specificationsremainthesame,thefilterorderrequiredto thetransitionwidthallowed.