professor part a: signal processinge....
TRANSCRIPT
Part A: Signal Processing
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Chapter 5: Digital Filter Design
5.1 Choosing between FIR and IIR filters5.2 Design Techniques5.3 IIR filter Design
5.3.1 Impulse Invariant Method5.3.2 Bilinear Transformation5.3.3 Digital to Digital Transformation
5.4 Window functions5.5 Design Methods for FIR filters
5.5.1 Design of FIR Filters Using Windows5.5.2 Design Procedure
5.6 Frequency Sampling Filter5.7 Problem sheet A5
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
5.0 Digital Filter Design
The design of a digital filter is the task of determining atransfer function which is a rational function of z-1
(e.g. ) in the case of a recursive
filter (IIR) or a polynomial in z-1, (a0+a1z-1+a2z-2
+a3z-3) in the case of a non-recursive filter.
22
11
22
110
1
zbzbzazaa
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Performance specifications: A typical amplitudecharacteristic of a low-pass filter is shown below.
|A ()|
1+1
uL
Pass bandStop band
Transition band
Digital Freq()
Note: 1 is the 0dB point
fL fufs/2
1-1
2
Analogue Freq(f)
1
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
The goal of the design is to determine atransfer function H(z) so that its amplitudecharacteristic |H()| satisfies the conditions.
L11 0for1)(1 H
U2 for)(H
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
5.1 Choosing between FIR and IIRfilters. [4]
Because of quantization of the filtercoefficients, a pole can in principlemove from a position inside the unitcircle to a position outside the unit circleand hence cause instability.
The effects of using a limitednumber of bits to implementfilters such as round off noise andquantization errors are much lesssevere in FIR than in IIR.
The phase responses of IIR filters arenonlinear, especially at the band edges.
FIR Filters can have an exactlylinear phase response. Theimplication of this is that nophase distortion is introduced intothe signal by the filter.
Only recursive structure is possible; themost widely used form is the cascadeconnection of first-order and secondorder sections.
Non-recursive or recursivestructures are both possible; thebest known is the non-recursive(transversal) structure.
Contain poles and zeros (normally)System function contain onlyzeros
IIR FiltersFIR Filters
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Analogue filters can be readilytransformed into equivalent IIRdigital filters meeting similarspecifications. IIR filters can bedesigned using design formulae.
FIR filters have no analoguecounterpart. FIR designprocedures are normallyiterative procedures. Designequations do not exist
No direct relation between thecomplexity and the length of theimpulse response (which is infinite bydefinition)Filters with high selectivity can berealized with relatively lowcomplexity.
Complexity is proportional to thelength of the impulse response.
IIR requires fewer coefficients forsharp cut off filters than FIR.
FIR requires more coefficientsfor sharp cut-off filters than IIR.Thus for a given amplituderesponse specification, moreprocessing time and storage willbe required for FIRimplementation.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Example:
An FIR filter is to be designed to meet the followingfrequency response specifications.
Pass-band 0.18-0.33 (normalized) Transition band 0.04 (normalized) Stop-band deviation 0.001 Pass-band deviation 0.05
(i) Sketch the tolerance scheme for the filter.
(ii) Express the filter band edge frequencies in thestandard unit of kHz , assuming a sampling frequency of10kHz and the stop band and pass band deviation in dBs.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
The tolerance diagram for the filter, is shown below:
f(normalized)
|H(f)|
1+1
1-1
2
1
0.14 0.18 0.33
0.37
0.5
f
fs=10kHz , thereforePass band: 1.8-3.3 kHzStop band: 0-1.4 kHz and 3.7-5kHzStop band attenuation: -20log10(0.001) = -60dBPass band ripple: 20log10(1+0.05) = 0.42 dB
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Example: The following transfer functions represent two
different filters meeting identical amplitude–frequency response specifications.
22
11
22
110
1 1)(
zbzbzazaazH Filter 1
Where a0 = 0.4981819; a1 = 0.9274777;a2 = 0.4981819; b1 = -0.6744878; b2 = -0.3633482;
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
11
0
)(k
kzkhzH Filter 2
Where 61057892400.05
71063428410.04
81055384370.03
91069169420.02
101045068750.01
111054603280.00
0
1
1
1
1
2
hh
hh
hh
hh
hh
hh
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Determine and comment on the computational andstorage requirements.
y[n]w[n]x[n]
-b1
a0
T
T a1
a2-b2
)2()1()()()2()1()()(
21
21
nwanwanwany
nwbnwbnxnw
o
+ +
Filter 1
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
y[n]
x[n-1] x[n-11]x[n]
h(11)
+
T T T
h(0) h(1) h(2)
Filter 2
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
IIR (Filter 1)FIR (Filter 2)
824Storage locations(coefficients and data)
411Number of additions
512Number of Multiplications
It is evident that the IIR filter is more economical in bothcomputations and storage requirements than the FIR filter.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
5.2 Design Techniques [4]
The method used to calculate the filter coefficients
(hk for FIR, ak and bk for IIR) depends on whetherthe filter is IIR or FIR type. There are severalmethods of calculating filter coefficients of which thefollowing are the most widely used.
)(NN zh.....zhzhh
X(z)Y(z) 1
12
21
10
LL
Nn
zbzbzazaa
zXzY
..........1......
)()(
11
)1(110
Pole-zero placement methodOptimisation method (e.g RemezAlgorithm)
Bilinear transformationFrequency sampling
Impulse invariant transformationwindow
IIR digital filtersFIR digital filters
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
We choose the methods that best suitsour particular applications.
In most cases, if the FIR properties arevital then a good candidate is theoptimization method, where as, if IIRproperties are desirable, then thebilinear method will in most casessuffice.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
5.3 IIR Filter Design In transforming an analogue filter to digital filter, we
must obtain either H(z) or h[n] from the analoguefilter design. In such transformations, we generallyrequire that the essential properties of the analoguefrequency response be preserved in the frequencyresponse of the resulting digital filter. This impliesthat we want the imaginary axis of the s-plane tomap into the unit circle of z-plane.
A second condition is that a stable analogue filtershould be transformed to a stable digital filter. Thatis if the analogue system has two poles only in theleft half s-plane, then the digital filter must havepoles inside the unit circle.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
5.3.1 Impulse invariant method [1]
In this method we start from an analogue filter ofimpulse response ha(t) and the system functionHa(s).
The objective of our design is to realize an IIR filterwith an impulse response h[n] which satisfies :
h[n] = ha(nT) where T-sampling frequency
The characteristic property preserved by thistransformation is that the impulse response of theresulting digital filter is a sampled version of theimpulse response of the analogue filter.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
AliasingH()
1/T
Ha()
1FrequencyResponse
/T-/T-2/T 2/T
-2 - 0 2
ha(t)
Impulseresponse
th[n]
nT
We see that with this method there are problems to agreater or lesser extent depending on the choice of T.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
The sampling frequency affects thefrequency response of the impulseinvariant discrete filter. A sufficient highsampling frequency is necessary for thefrequency response to be close to thatof the equivalent analogue filter.
Thus due to aliasing, the frequencyresponse of the digital filter will not beidentical to that of the analogue filter.
So how do we find the filter coefficients ofthe IIR filter in this design method?
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
To obtain the mapping let,
0,1
bbs
sHa
bta eth )(
bnTa enTh )(
000
nne
nhbnT
111
)(
zezH bT
Inverse Laplace transform
Usually written as
z-transform
Sampled sequence
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
It is seen that H(z) is obtained from Ha(s) by usingthe mapping relationship
0,1
111
bzebs bT T-sampling period
Each strip maps ontothe interior of the unit circle
= -
= =0
z-plane
|z|=1
j
3/T
/T
/T
-3/T
s-plane
In this kind of mapping, the perimeter is the imaginary axis.Note: Mapping does not exist for the zeros.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Example:
Using partial fractions this can be written as
)3)(1(2
)(
ss
sH
31
11
)(
ss
sH
1111
zebs bT
2413
13
131
)(1
11
11
)(
zezeezee
zezesH
TTT
TT
TT
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Example: Use the impulse invariant method to design digital
filter from an analogue prototype that has a systemfunction.
To design a filter using the impulse invariant method,
expand H(s) in a partial fraction form:
22)()(
basas
sH
)(1
21
)(1
21
)()(
)()()(
21
21
jbasjbas
jbasjbas
jbasB
jbasA
jbasjbasas
sH
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
1111
zecs cT
221
1
1)(1)(
1)(1)(
1)(1)(
)cos(21)cos(1
)1)(1(
121
121
11
21
11
21
)(
zezbTezbTe
zeze
zeze
zezezH
aTaT
aT
TjbaTjba
TjbaTjba
TjbaTjba
Substituting (Impulse invariant transform)
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Hence,
22
11
11
11)(
zbzbzazH
aTaTaT ebbTebbTea 2211 andcos2,cos
221
1
22 )cos(21)cos(1
)(
zezbTe
zbTebas
asaTaT
aT
where
Note that the zero at s=-a is mapped to a zero atz=e-aTcos(bT). Thus, the location of the zero in thediscrete time filter depends on the position of the poles aswell as the zero in the analogue filter.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Example:
Using impulse invariant method design a digital filterto approximate the following normalized analoguetransfer function:
Assume that the 3dB cut-off frequency of the digitalfilter is 150Hz and the sampling frequency is 1.28 kHz
[1]12
1)(
2
sssH
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Solution: Before applying the impulse invariant method, we
need to de-normalize the transfer function.
121
)()( 21
ssc
ssss
sHsH
22
2
2)(
cc
c
sssH
4778.9421502 c
212
2
1 2)(
psB
psA
sssH
cc
c
where
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
2
122
222
422,
22
21
j
j
pp
c
cc
ccc
jp
jp
c
c
122
122
2
1
jB
jA
jpjp
c
c
2
2
)1(4324.666)1(4324.666
2
1
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
)1)(1()1()1(
11)( 11
11
111 21
12
21
zeze
zeBzeAze
Bze
AzH TpTp
TpTp
TpTp
21
1
121
12
)(1)()(
)(
zezeezBeAeBA
zH TpTpTp
TpTp
21
1
3530.00308.119264.393
)(
zzz
zH
23530.00308.119264.393
)( jj
j
eee
H
12233530.00308.11
9264.393)( 0
H
This is approximately equalto the sampling frequencyProf
esso
r E. A
mbikair
ajah
UNSW, A
ustra
lia
Such a large gain is characteristic ofimpulse invariant filters .
To keep the gain down (and to avoidoverflows when the filter is implemented).It is common practice to divide the gain byfs. Thus the new transfer function becomes
21
1
3530.00308.113078.0
)(
zzz
zH
12233530.00308.11
9264.393)( 0
H
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
x[n]
z-1
z-1
y[n]
1.0308
-0.3530
If x[n]=[n] then y[n]=h[n].
0.3078+
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
h(t)
Impulse responseof the analoguefilter h[n]
n0 1 2 3 4 5
Impulse responseof the digital filteris identical to thatof analogue filterh(t) = h(n)
t
Note: The sampling frequency affects the frequencyresponse of the digital filter obtained using impulse invarianttransformation.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
A sufficient high samples frequency is necessary forthe frequency response to be closer to that of theequivalent analogue filter (see below)
aliasing
|H()|
2 4
fs/2 fs 2fs
f
|H(j)|
0
Low degree of aliasing canbe achieved by making thesampling frequency high.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
5.3.2 Bilinear Transformation [1]
The bilinear transformation yields stabledigital filters from stable analogue filters (theimpulse invariant technique may not).Also the bilinear transformation avoids theproblem of aliasing encountered with the useof the impulse invariant transformation,because it maps the entire imaginary axis inthe s-plane on to the unit circle in the z-plane.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
j
z-plane
Image of the left hand s-plane.
s-plane
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
21
21
...21
221
...21
221
2
2
2
2
sT
sT
z
sTsT
sTsT
e
eez sT
sT
sT
(drop out higher order terms)
1
1
112
zz
Ts
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
The price paid for the avoidance of aliasing isan introduction of distortion in the frequencyaxis.
Consequently, the design of digital filtersusing the bilinear transformation is onlyuseful when the distortion can becompensated.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Example:
We have a system function Ha(s) such that
Applying bilinear transformation,
bsb
sHa )(
1
1
1
1 )2(2)1(
112
)(
zbTbT
zbT
bzz
T
bzH
10001
&1000 TbLet
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
The modulus of the frequency response H() and
H() are shown below:
-1000 -500 500 1000
-
1 |H()|
/2-/2
2sf 2
sf
-3000-1500 1500 3000
1
bjb
jH
)(
|H(j)|
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
There is a very important property ofthe bilinear transformation that can beseen in the above example. The entire
frequency range (-∞a ∞) of the
continuous system maps into the
fundamental interval (-) of the
discrete system, where = 0corresponds to = 0, = ∞to = and = - ∞to = -.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
To demonstrate that this mapping has the propertythat the imaginary axis in the s-plane maps onto the
unit circle, let z = ejand s = j.
1
1
112
zz
Ts
2tan
2112
jT
j
ee
Tj j
j
2tan2
T
2tan2 1 T
Then since,
Hence,
or
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
We see that a nonlinear relation exists between and .This effect is called ‘Warping’ and is shown below.
T
-
22tan 1 TT
TT 2
2
At low frequencies
.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
The great advantage of warping is that noaliasing of the frequency characteristic canoccur in the transformation of an analoguefilter to a discrete filter, which weencountered in the impulse-invariant method.
We must however check carefully just howthe various characteristic frequencies of thecontinuous characteristic frequencies of thediscrete filter.
We can illustrate this with the aid of adiagram (next slide) for a band-pass filter.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
3
21
-
1 2 3
Analoguefilterresponse
Digital filterresponse
The effect of “warping” in the conversion of |H()| →|H()|is seen from the above diagram.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
In designing a digital filter by this method we mustfirst pre-wrap the given filter specifications to findthe continuous filter to which we are going to applythe bilinear transformation.
The specification of a desired digital low pass filter isshown below.
Sampling frequency: fs = 8kHz (T =1/fs = 125s)
A pass band up to fL = 2.6 kHz ( )
and a stop band, fu, above 3kHz ( ).
65.02 s
LLL f
fT
75.02 s
uLu f
fT
Example:
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
|H()|
0
1+11
1-1
2
L u
2.6kHz 3kHz fs/2
Digital filter Response
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
kHz155.4)4155(22
tan22 LL
lL fT
f
kHz148.6)6148(2)2
tan(22 uu
hu fT
f
H()
0
Analogue filterResponse
4Hz 6.148 8kHz
4.155kHz
We must start from an analogue filter with
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Example: Determine, using bilinear transformation
method, the transfer function and differenceequation for the digital equivalent of the RCfilter. The normalized transfer function for theRC filter is
Assume a sampling frequency of 150Hz and acut-off frequency of 30Hz.
11
)(
s
sH
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Solution:
sccc f
fT 12
4.0150
1)30(2 c
before pre-warping
'cf
Pre-warped frequency
is always > (un-warped freq= 30 Hz)
and after warping, = 34.68Hz.
cf
'cf
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
The de-normalized analogue filter transfer function
(this is achieved by replacing s with ) is obtained
from H(s) as c
s
7265.02
7265.02
)()( '
'
1'
Ts
Ts
sHsHs
cs
sc
1
1
1121 1584.01
)1(4208.017265.0)72651(
)1(7265.0)()(
zz
zz
sHzHzz
Ts
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Example:
It is required to design a digital filter toapproximate the following analogue transferfunction [1]
Using the Bi-linear transformation method
obtain the transfer function, H(s) of thedigital filter assuming a 3dB cut-off frequencyof 150Hz and a sampling frequency of1.28kHz.
121
)(2
ss
sH
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Solution :
sfT
1
6415
)1280150
(22
s
cc f
f
sec/3859.02
5009.9872
6415
tan12802
2tan
2' radTTT
cc
Hzfc 1656.15725009.987'
fc = 150Hz fs = 1280Hz
The analogue frequency after pre-warping
is always greater than .cf'
cf
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
22
2
22
1
)3857.0(2
2)3857.0(2
3857.02
)(
Ts
Ts
TsH
222
22
1121
3857.02
112
23857.02
112
3857.02
)()(
Tzz
TTzz
T
TsHzHzz
Ts
21
21
3561.00048.11210878.0
)(
zz
zzzH
Prewarped analogue filter is given by,
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
2'
'2
2'
2 cc
c
ss
21
21
3561.00048.11)21(0878.0
zzzz
gain(dB)
digital frequencyresponse
fc
150Hz
|H()|
Analogue frequencyresponse
|H(j)|
640Hz
fs/2
f (rad/s)
0
Bilinear transformation
All pole Poles & zeros
Note:Same cut-off frequencyincreased roll off and attenuation in stop band.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Example :(a) An analogue transfer function can be convertedto a digital transformation using the bilineartransformation. Derive this transform relationshipusing the following equation.
12
1 nxnxTnyny
ssH 1)(
Digital Integrator
Analogue Integrator
T-sampling period, x[n] - input , y[n] - output
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Solution:
)2(1
)(
)1(11
2)(
)()(2
1
1
11
ssH
zzT
zH
zzXzXT
zzYzY
Setting (1) = (2),
1
1
1
1
112
11
21
zz
Ts
zzT
s
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
(b) Convert the analogue filter H(s)
into a digital IIR filter by means of the bilineartransformation. The digital filter is to have a resonantfrequency .
16)1.0(1.0
)( 2
s
ssH
20
01.162.01.0)( 2
ss
ssH
20
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
The analogue filter has a resonant frequency
The frequency is to be mapped into by selecting
the value of the parameter T.
.sec40 rad/
20
2tan2 0
0
T
TTT24
4tan2
22tan24
21
T sec/20 rad
in order to have
Thus the desired mapping is
1
1
11
4zz
s
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
resonant frequency
2
21
21
21
1
12
1
1
1
1
11
4
975.01122.0006.0128.0
975.00006.01122.0006.0128.0
01.161142.0
114
1.0114
)()(1
1
zzz
zzzz
zz
zz
zz
sHzHzz
s
22
21
987.0
987.0
j
j
ep
ep
This filter has poles at
and zeros at z1 = -1 and z2 = 0.95.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Example :
Convert the simple low pass filter intoan equivalent high pass discrete filter.
Assume fs = 50Hz, analogue cut-off fc = 30Hz.
11
)(
s
sH
4.0150302
c
7265.02)24.0tan(2'
TTc
LPF to HPF transformation
'''
1
1)()( '
ccss s
s
s
sHsHc
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
)1(7265.011
7265.02
112
112
)()(112
'
zzz
Tzz
T
zz
TsHzH
zz
Tz
1
1
1584.011
5792.0)(
z
zzH
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Example 1:
Let us now apply this approach to the design of adigital low-pass filter. The amplitude responsespecification is
Sampling Frequency : fs = 8 kHz Passband: fc = 0 to 1.3 kHz Stopband: fh 2.6 kHz Maximum ripple in passband: 1 = 0.1 dB Minimum attenuation in stopband: 2 = -33.5 dB
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Step 1 :
From the sampling frequency fs and the cut-off
frequency fc we can determine c and h:
0210.12 s
cc f
f 0420.22 s
hh f
fand
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Step 2 :
Determine the stop-band edge frequency fh or h
using
In filter design tables c is normalised to 1 rad/sec.
2tan2 c
c T
2tan2 h
h T and
7856.1
2tan
2
c
c
T
9139.22
0420.2tan7856.1 h
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Step 3 :
Determine an appropriate transfer function. Thus weneed an analogue filter with a maximum ripple of
0.1dB in the pass-band (0 ≤≤1) and a minimum
attenuation of -33.5 in the stop-band (2.914 ≤≤∞).
From the tables we choose a 3rd order elliptic filterwith a transfer function
)6674.18700.0)(0398.1(8881.5
2089.102
2
sss
ssH a
which meets these specifications.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Step 4 :
Apply the bilinear transformation to obtain a digitalfilter transfer function:
1
1
112
zz
Ts 1
1
11
7856.1
zz
sand
Substituting for s, we get
)5153.04748.01)(2640.01()1)(0478.11(1256.0)( 211
121
zzzzzzzH
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
% Exercise 1. IIR digital filter design % We wish to design an IIR digital filter given some specifications. % We use the example given in page 30 of chapter 5. % The task is to design a low-pass filter, whose magnitude response
specifications % are as follows: sampling_frequency = 8000 % fs = 8 kHz passband_frequency = 1300 % fc = 1.3 kHz stopband_frequency = 2600 % fh = 2.6 kHz passband_ripple = 0.1 % 0.1 dB stopband_ripple = 33.5 % 33.5 dB % Step 1. Evaluate digital frequencies passband_digital_frequency = 2*pi*passband_frequency/sampling_frequency stopband_digital_frequency = 2*pi*stopband_frequency/sampling_frequency % Step 2. Evaluate analog frequencies passband_analog_frequency =
2*sampling_frequency*tan(passband_digital_frequency/2) stopband_analog_frequency =
2*sampling_frequency*tan(stopband_digital_frequency/2) % Step 3. Determine the normalized analog low-pass filter [filter_order, cutoff_frequency] = ellipord(... passband_analog_frequency, stopband_analog_frequency, ... passband_ripple, stopband_ripple, 's') [numerator, denominator] = ellip (filter_order, ... passband_ripple, stopband_ripple, cutoff_frequency, 's')
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
% Plot the magnitude response of the analog low-pass filter frequency = 1:sampling_frequency; angular_frequency = frequency*2*pi; [frequency_response] = freqs(numerator, denominator,
angular_frequency); magnitude_response = 20*log10(abs(frequency_response)); figure(1), clf plot(frequency, magnitude_response) grid on title ('Magnitude response of the analog filter') ylabel('Magnitude (dB)') xlabel('Analog frequency') hold on semilogx([0 passband_analog_frequency/2/pi], [-passband_ripple -
passband_ripple], 'r') semilogx([passband_analog_frequency
passband_analog_frequency]/2/pi, [-passband_ripple -stopband_ripple*2], 'r')
semilogx([stopband_analog_frequencystopband_analog_frequency]/2/pi, [1 -stopband_ripple], 'r')
semilogx([stopband_analog_frequency/2/pi sampling_frequency], [-stopband_ripple -stopband_ripple], 'r')
axis([0 sampling_frequency -stopband_ripple*2 0]) hold off
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
0 1000 2000 3000 4000 5000 6000 7000 8000
-60
-50
-40
-30
-20
-10
0Magnitude response of the analog filter
Mag
nitu
de(d
B)
Analog frequency
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
% Step 4. Apply bilinear transformation to obtain the digital filter transfer function [digital_numerator, digital_denominator] = bilinear(numerator, denominator,
sampling_frequency) % Impulse invariant method can be selected instead of bilinear transformation. % Matlab provides a build-in command called impinvar'. % You may experiment with `impinvar' and compare the outcome with those of the bilinear
transformation. % Plotting the magnitude response digital_frequency = (0:0.01:1)*pi; frequency_response = freqz(digital_numerator, digital_denominator, digital_frequency); magnitude_response = 20*log10(abs(frequency_response)); figure(2), clf plot(digital_frequency, magnitude_response) grid on title ('Magnitude response of the digital filter') ylabel('Magnitude (dB)') xlabel('Digital frequency') hold on semilogx([0 passband_digital_frequency], [-passband_ripple -passband_ripple], 'r') semilogx([passband_digital_frequency passband_digital_frequency], [-passband_ripple -
stopband_ripple*2], 'r') semilogx([stopband_digital_frequency stopband_digital_frequency], [1 -stopband_ripple],
'r') semilogx([stopband_digital_frequency pi], [-stopband_ripple -stopband_ripple], 'r') hold off axis([0 pi -stopband_ripple*2 0])
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
% There are several methods to produce the impulse responseof the digital IIR filter.
% One method is to feed a unit impulse function into the filter. impulse_response_iir = filter(digital_numerator,
digital_denominator, [1 zeros(1,50)]); figure(3), clf stem(impulse_response_iir) % Another method is to use Matlab's built-in command, `impz'. % `impz' also accepts additional inputs. Use `help' to find out
more. [impulse_response_iir, time] = impz(digital_numerator,
digital_denominator); stem(impulse_response_iir) % You may try different specifications. Other analog filter types,
such as, chebyshev type % I can also be used, simply by replacing `ellipord' and `ellip'
with `cheb1ord' and `cheby1'.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
0 0.5 1 1.5 2 2.5 3
-60
-50
-40
-30
-20
-10
0Magnitude response of the digital filter
Mag
nitu
de(d
B)
Digital frequency
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
0 5 10 15 20 25 30-0.2
-0.1
0
0.1
0.2
0.3
0.4
0.5Impulse response of the IIR filter
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Example 2 :
We wish to design a digital filter which meets thefollowing specifications:
Low-pass filter: 0 to 10 kHz passband Sampling frequency: fs = 100 kHz Transition band: 10 kHz to 20 kHz Stopband attenuation : -10 dB(Starting at 20 kHz)
The filter must be monotonic in the pass and stopbands, (i.e. no ripple).
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Step 1 :
The monotonic requirement indicates aButterworth filter.
2.0000,100
000,1022
s
cc f
f
4.02 s
hh f
f
and
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Step 2 :
We can calculate the corresponding analoguefilter frequencies:
5106498.0)1.0tan(222.0
tan2
sc fT
5104531.1)2.0tan(2 hh f
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Step 3 : The required order of the Butterworth filter can be
determined by using the following equations,ensuring at least 10 dB attenuation at
N
c
h
aH 22
1
1)(
N
aH2
2
6498.04531.1
1log10)(log10
367.1106498.04531.11
2
N
N
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Thus we choose N = 2 (even). The poles occur incomplex conjugate pairs and lie on the left-hand sideof the s-plane.
)7071.07071.0(106498.0 543
1 jepj
c
)7071.07071.0(106498.0 545
2 jepj
c
952
9
21
21
10223.410919.0
10223.4)(
sspspspp
sH
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Step 4 :
Now apply the bilinear transformations
to obtain H(z)
1
15
11
102
zz
s
)4123.0143.11(0675.01349.00675.0
)( 21
21
zz
zzzH
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
5.3.3 Digital -To-Digital Transformations
We have seen in the lecture notes that one methodfor the design of analogue filters relied on applying atransformation to an analogue low-pass filter with aunit bandwidth. It was shown that we could obtainlow-pass, high-pass, band-pass and band-stop filtersby selecting the appropriate transformation.
Similarly, a set of transformations can be formed thattake a low-pass digital filter and turn it into high-pass, band-pass, and band-stop or another low-passdigital filter.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
The transformations are given below:
Digital to Digital Transformations
p
k1
0
p’
k1
0
20 log |H()|
Low-pass to Low-pass
20 log |H()|
1
11
1
z
zz
]2/)'sin[(
]2/)'sin[(
pp
pp
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
p
k1
0
p’
k1
020 log |H()|
20 log |H()|
Low-pass to High-pass
1
11
1
z
zz
Simplest transformation is to change the signs of poles and zeros ofthe LP LP transformation
]2/)'cos[(
]2/)'cos[(
pp
pp
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
p
k1
0
20 log |H()|
uL
20 log |H()|0
-3 dB
Lowpass to Band-pass
11
211
11
12
12
12
1
zk
kz
kk
kk
zk
kz
z
]2/)cos[(]2/)cos[(
Lu
Lu
2tan)2/)cot(( p
Luk
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Lowpass to Band-stop
uL
20 log |H()|
p
k1
0
20 log |H()|
11
211
11
12
12
12
1
zk
zkk
kk
zk
zz
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
5.4 Window FunctionsSome of the most commonly used window functions are:
0 5 10 15 200
0.2
0.4
0.6
0.8
1Rectangular
0 5 10 15 200
0.2
0.4
0.6
0.8
1Bartlett
0 5 10 15 200
0.2
0.4
0.6
0.8
1Blackman
0 5 10 15 200
0.2
0.4
0.6
0.8
1Hamming
0 5 10 15 200
0.2
0.4
0.6
0.8
1Hanning
0 5 10 15 200
0.2
0.4
0.6
0.8
1Kaiser, beta=4
Rectangular
Blackman
Hanning
Bartlett
Hamming
Kaiser, beta=4
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
To Analyze a truncation process we model it as amultiplication of the desired sequence by finite
duration window sequence denote by w[n].Truncation of a sequence s[n] is equivalent to
placing a rectangular time window around s[n].
Frame 1 Frame 2w[n]
s[n]speech signal
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Vocal tract shape changes every 15ms. When using
a sampling frequency of 8 kHz (T = 125s) with
100 samples in each frame (12.5ms),
Thus when window is applied, the frequency domain
convolution causes distortion in the spectrum Y(). It can beshown that the rectangular window creates ripples in the
spectrum Y(). To reduce the distortion, use Hamming orKaiser Window.
nwnsny )()( WSY
(Multiplication becomes convolution in the frequency domain)
In frequencydomain,
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Rectangular Window :
N
1.0
w[n]
n
otherwise0
101 Nnnw
1)1(21
1
0 11
.......1)()(
zz
zzzznwzWN
NN
n
n
j
jN
ez ee
zWW j
11
)()(
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
2
2sin)( 21
N
eWNj
21N
2sin
2sin
N
W
|W()|
-2/N 2/N
-
Main LobeSide lobes or ripples
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
If N increases the width of the main lobedecreases but the peak amplitude of the sidelobes grows in a manner such that the areaunder each lobe is constant while the width
of each lobe decreases with N.
|W()|
-2/N 2/N
-
Main LobeSide lobes or ripples
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
5.5 Design Methods for FIR filters [11]
The most essential feature of FIR filters is, bydefinition, the finite length of the impulse response.Another important point is that it can be seemdirectly from the impulse response of an FIR filterwhether we have a linear phase characteristic or not.
A filter is said to have a linear phase response of itsresponse satisfies one of the following relationships.
)2(
)1()(
ab
a
where a and b are constants.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
)2(
)1()(
ab
a
It can be shown that for condition (1) above to besatisfied the impulse response of the filter must havepositive symmetry.
where N denotes the filter length.
2
1,1
NanNhnh
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
When the condition given in (2) is satisfied, theimpulse response of the filter has negative symmetry.
2
and2
1,1 bNanNhnh
centre of symmetry(Positive symmetry)
n0 2 4 6 8 10 12
N = 13 (odd)
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
n
N = 12 (even)
centre of symmetry(N even, positive symmetry)
0 4 6 8
2 10
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
5.5.1 Design of FIR filters using Windows
The easiest way to obtain an FIR filter is to simplytruncate the impulse response of an IIR filter. If
hd[n] represents the impulse response of a desiredIIR filter, then an FIR filter with impulse response
h[n] can be obtained as follows:
otherwise0
21 NnNnhnh d
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
In general h[n] can be thought of as being formed by the
product hd[n] and a window function w[n] as follows:
otherwise0
21 NnNnhnh d
)()()( WHH
nwnhnh
d
d
let it be an ideal low pass filterwith cut off frequency 0
let it be , for example arectangular window
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
|Hd()|
-0 0- -
2/N
*
-00
|H()|
-
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Therefore it is seen that the convolution produces asmeared version of the ideal low pass frequency
response Hd().
In general, the wider the main lobe of W(), themore spreading, where as the narrower the main
lobe (larger N) the closer |H()| comes to |Hd()|.
In general we are left with a trade off of making Nlarge enough so that smearing is minimized, yetsmall enough to allow reasonable implementation.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
% Exercise 2. FIR filter design % We now consider the FIR filter design. % The first method we consider is the windowing method. % Matlab provides a command called `fir1' to design the FIR filter using the windowing method. % We design a FIR filter using the same specifications as in exercise 1. filter_order = 500; passband_norm_frequency = passband_frequency/sampling_frequency * 2*pi / pi stopband_norm_frequency = stopband_frequency/sampling_frequency * 2*pi / pi cutoff_frequency = passband_frequency/sampling_frequency * 2*pi / pi filter_coeff = fir1(filter_order, cutoff_frequency); digital_frequency = (0:0.001:1)*pi; frequency_response = freqz(filter_coeff, 1, digital_frequency); magnitude_response = 20*log10(abs(frequency_response)); figure(4), clf plot(digital_frequency/pi, magnitude_response) grid on title ('Magnitude response of the digital filter') ylabel('Magnitude (dB)') xlabel('Normalized digital frequency') hold on semilogx([0 passband_norm_frequency], [-passband_ripple -passband_ripple], 'r') semilogx([passband_norm_frequency passband_norm_frequency], [-passband_ripple -stopband_ripple*2],
'r') semilogx([stopband_norm_frequency stopband_norm_frequency], [1 -stopband_ripple], 'r') semilogx([stopband_norm_frequency 1], [-stopband_ripple -stopband_ripple], 'r') hold off axis([0 1 -stopband_ripple*2 0]) % Observe that we can nearly meet the required specifications when the filter order is over 500. % By default the `fir1' uses a hamming window. % There is a variety of windows to choose from. % You may experiment with different windows and observe its impact on the magnitude response. % (You may need to reduce the filter order and not to worry about meeting the specifications.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-60
-50
-40
-30
-20
-10
0Magnitude response of the digital filter
Mag
nitu
de(d
B)
Normalized digital frequency
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
% We now consider another method of designing a FIR filter, which is based on % the Parks-McClellan optimal algorithm. % The command is available in Matlab and is called `remez'. % We design a FIR filter using the same specifications as in exercise 1. filter_order = 13 % The lowest filter order that meets the required specifications. passband_norm_frequency = passband_frequency/sampling_frequency * 2*pi / pi stopband_norm_frequency = stopband_frequency/sampling_frequency * 2*pi / pi passband_delta = 10^(0.1/20)-1 % Converting from dB stopband_delta = 1/10^(33.5/20) % Converting from dB frequency_band = [0 passband_norm_frequency stopband_norm_frequency 1]; % The passband frequency is 0.2pi and the stopband frequency is 0.4pi. amplitude = [1 1 0 0]; % This amplitude configuration represents a lowpass filter. weight = [1/passband_delta 1/stopband_delta] % Setting error weight at the passband and stopband filter_coeff = remez(filter_order, frequency_band, amplitude) digital_frequency = (0:0.01:1)*pi; frequency_response = freqz(filter_coeff, 1, digital_frequency); magnitude_response = 20*log10(abs(frequency_response)); figure(5), clf plot(digital_frequency/pi, magnitude_response) grid on title ('Magnitude response of the digital filter') ylabel('Magnitude (dB)') xlabel('Normalized digital frequency') hold on semilogx([0 passband_norm_frequency], [-passband_ripple -passband_ripple], 'r') semilogx([passband_norm_frequency passband_norm_frequency], [-passband_ripple -stopband_ripple*2], 'r') semilogx([stopband_norm_frequency stopband_norm_frequency], [1 -stopband_ripple], 'r') semilogx([stopband_norm_frequency 1], [-stopband_ripple -stopband_ripple], 'r') hold off axis([0 1 -stopband_ripple*2 0]) % Note that given some design specifications, we find the filter order by trial-and-error % until the transition bandwidth, passband and stopband ripples satisfy the required % specifications. % Generally, a FIR filter requires higher order than an IIR filter given the same specifications. % You may try different filter order and observe its impact on the transition bandwidth, % passband and stopband ripples. % Another method of designing a FIR filter is to use the least-squares error minimization algorithm. % The Matlab command to do this is `firls'.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-60
-50
-40
-30
-20
-10
0Magnitude response of the digital filter
Mag
nitu
de(d
B)
Normalized digital frequency
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
5.5.2 Design Procedure [11]
An ideal low pass filter with linear phase of slope -βand cut-off ωc can be characterized in the frequencydomain by
The corresponding impulse response can beobtained by taking the inverse Fourier transform ofand easily shown to be
c
cj
d wwe
H0
)(
nhd
dH
n
nnh c
d
sin
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
A causal FIR filter with impulse response h[n] can beobtained by multiplying by a window beginning
at the origin and ending at N-1 as follows :
For h[n] to be a linear phase , βmust be selected so
that the resulting h[n] is symmetric.
As is symmetric about n= βand the
window is symmetric about
nhd
nn
nnh c )(
)(sin
nnc )(sin
.2
1
Nn
21 N Symmetric about β
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Example :(a) Determine the impulse response of the low-
pass filter whose frequency response is given by
(b) To obtain a finite impulse response from a
rectangular window of length N = 9 is used.Compute the coefficients of the FIR filter with alinear phase characteristic ands with this finiteimpulse response.
nhd
3
01
30
)(
H
nhd
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Solution:
nn
jne
deHnh
nj
njdd
33
3
sin121
)(21
0)3/sin(03
1
nnn
nnhd
(a)
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
(b) For a linear phase filter, is symmetric about n = 0and the window is symmetric about .
nhd
42
192
)1(
Nn
nnhnh d
834
034
32
23
1
333.00
h
h
h
h
h
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
The coefficients are
876543210n
00.33308
343
23
23
43
83
Symmetry about n = 4
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
5.6 Frequency-Sampling Filter [11]
Although it is implied that all FIR filters are non-recursive, this is not the case. To illustrate theapproach, let us consider the following FIR filterhaving a casual finite-duration unit-sample response
containing N elements of constant value.
otherwise0
100 Nnnh N
g
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
The corresponding filter system function is equal to
10
10
1
0
0)1(210
1
1
1
1
.........1)(
z
gNz
z
zNg
zNg
zzzNg
zH
NN
N
p
pN
Comb filterHc(z)
ResonatorHR0(z)
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
This analytic form of the system function suggests anovel way to implement the above filter, as the two-stage cascade structure shown below.
z-1
y[n]
1/N
z -N
x[n]
-1 1Comb filter Resonator
g0
+ +
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Example: Let N = 8 and g0 = 11
8
11
81
)(
zz
zH
+1/8
z-8
x[n]
-1
+
z-1
y[n]
1
0 1 2
1/8
8
-1/80 1 2 3
1
1 5 8n
0
1/8
0
1/8
Filter implementation using the comb filter resonator structure.
1 5 6 7 8 9 n
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Hc(z) is given as
is shown in the next slide for N = 8 .has N zeros equally spaced over the frequencyrange , Because the magnitude responseresembles a comb, this filter has become known as acomb filter.
Nz
zHN
c
1)(
2sin
21)( 2
N
eN
jNe
cHNjNj
)(cH )(cH
20
4sin41
28
sin82
)( 428
jj
C jeej
H
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
0 2/8 2
1/4
|Hc()|
|Hc()| vs for a Comb filter
|4sin|41
|)(| cH
The pole/zero pattern for the comb filter can beobtained using the transfer function
The above equation explicitly indicates that there are Nequally spaced zeros over the unit circle with the firstzero at z = 0.
1
0
12
)1(1111)(N
k
Nk
j
N
NN
c zeNz
zNN
zzH
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
2j
e
4
je
2
je
je
43
je
8 poles
Pole/zero pattern for Comb filter N = 8
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
HR0(z) is the system function of a resonator, or a filter
that has poles on the unit circle at frequency = 0 i.e.at z = 1. Since this pole is not strictly within the unitcircle, the filter is not stable. When this resonator iscascaded with the comb filter, however, the zero of thecomb filter located at z = 1 cancels the resonator pole,making the combination stable.
The transfer function of this two-stage filter is equal to
2sin
2sin
11
)( 21
00
N
eNg
ee
Ng
HNj
j
Nj
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
2sin
2sin
11
)( 21
00
N
eNg
ee
Ng
HNj
j
Nj
111)(
zz
NgzH
No
2sin
2sin
)( 21
0
N
eNgH
Nj
The transfer function of this two-stage filter is equal to
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Example :
For N=8, |H()| has a maximum at =0, equal g0
and is equal to zero at .
Let us consider a second-order resonator, whosecoefficients are real-valued, and the poles are situatedat the following zero locations of the comb filter.
Nk
k
2
g0
|H()|
2/N
Magnitude response ofComb filter plus resonator(N = 8)
-
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
N 2
1 12
2
N
2j
e4j
e
2j
e
je
43j
e
4
je
43
je
8 poles at theorigin
(Let N = 8)
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
The system function of the second-order resonatorcan be written in parallel form as
This procedure can be generalized to include eachsecond-order resonator cancelling a pair of zeros ofthe comb filter. These resonators are all connected inparallel and this parallel combination is thenconnected in cascade with the comb filter to produce
the total filter HT(z) given by
121
121
1
11
ze
g
ze
gH
Nj
Nj
R
1
0 12
1
1)(
N
k Nk
j
kN
T
ze
gNz
zH
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
1-z-NY(z)X(z)
1/N
10
1 zg
121
121
11
ze
g
ze
g
Nj
Nj
12
12
11
ze
g
ze
gk
Nj
k
Nk
j
k
142
142
11
ze
g
ze
g
Nj
Nj
+
kN
kj
geH
2
kN
kjgeH
2
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Example:
Lets us consider implementing the linearinterpolator with the comb and resonatorstructure. The impulse response of the linearinterpolator is given by
otherwise0
21
2;11;21
0
nh
andhhh
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Solution:
Since the number of elements in the unit sample response
is equal to 3, we choose N = 3. The comb filter systemfunction is then
)cos1()(211
21)( 21
jeH
zzzH
31
)(3
z
zHc
)(zHc3
2 kj
ez
has three zeros located at for k = 0,1 & 2.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
The zero at z = 1 will be cancelled by a real
resonator, and zeros at will be cancelled by
a pair of complex resonators. The gains of theresonators are equal to
32
jez
21
1
132
32
132
32
1
10*
13
23
4
342
32
32100
1
121
1
21
1
21
)(
12
)(,21
21
)(
21
)(,2)(
zz
z
ze
e
ze
ezH
zzHgeeHg
eHgHg
j
j
j
j
R
R
jj
j
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
z-1
z-1
z-1
z-3
x[n]
1
-1
-1/3
2
-1/2
-1
-1
-1
11/2
3 401/2
2/3
0 12 y[n]
1/3
0 1
1/6 -1/6
+
+
+ +
+
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Note: If the comb filter is followed by arecursive network that has a number of polesthat coincide exactly with the same numberof zeros of the comb filter, we obtain afrequency-sampling filter. The frequency-sampling filter can be particularly attractivesolution if we want to make a narrow-bandfilter; the N is large, while the number ofrecursive sections can be very small. Thismeans that the filter contain only a fewmultipliers and adders.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
For practical applications we have to keep an eye on anumber of things. In theory we start by assuming that anumber of poles and zeros coincide exactly on the unit circlein the z-plane. This requires that we should be able to realizethe filter coefficients to an accuracy of 100%. However, apartfrom a few obvious exceptions such as -1,0 and +1 this isnever the case.
This means that while we can locate the zeros of the comb-filter sections in exactly the right position, we cannot do sofar the corresponding poles. The best we can do is to getthem in the vicinity. This can lead to a very erratic localvariation of the frequency response, or even an unstablesystem if one of the poles lies just outside the unit circle. Inpractice both zeros and poles are therefore deliberatelylocated just inside the unit circle. For comb filter the systemfunction is then chosen as NazzH )(1)( 1where a is made lightly less than 1.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Problem Sheet A5 [1,11]Q1. Consider the following analogue system with a
transfer function
where a = 104 rad/sec and the sampling period T is 100 s.(i) What is the dc gain of H(z)?(ii) At what frequency is the H() equal to zero? (-digital frequency).
(iii) Calculate the impulse response h[n].
(iv) Assuming that the impulse response decays to 1/eof its initial value at n = N samples, show that:
teths
sH
)()(
)ln(
11
ln
aa
a
N
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Q2. A digital low-pass filter is required to meet thefollowing specifications:
Passband ripple ≤1dB (peak–to–peak ripple) Passband edge : 4kHz Stopband attenuation : ≥40dB Stopband edge : 6kHz Sampling rate : 24kHz
The filter is to be desired by performing a bilineartransformation on an analogue filter. Determine what orderChebyshev design must be used to meet the specificationsin the digital implementation.
(Hint: use the design formula given in the lecture notes)
{Ans: n = 6}.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Q3. The block diagram shows a digital oscillatorwhich is initialized by an impulse as shown inthe figure below. The desired unit impulseresponse is nunAnh )cos( 0
Z-1
Z-1
-b1
-b2
a0
a1
a2
[n]
22
11
22
110
1)(
zbzbzazaa
zH
+ +
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
(a) Assuming 0 is the resonant frequency ofthe digital oscillator and writing appropriateequations find the values of a0, a1, a2, b1 and b2 .
(Ans: a0=A, a1= -Acos0, a2=0,b1= 2cos= 2cos0, b2 = 1)
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
(b) The frequency of oscillation is determined by the
coefficient b1. Show that
where fs is the sampling frequency (16kHz) and f0 isthe desired frequency of oscillation.Calculate the highest frequency resolution that isobtainable and show that this obtainable accuracydepends on the desired oscillation frequency. You
may assume that b1 is represented by a K-bitnumber (fractional arithmetic) and is given by
s
s
ff
bff
0
10
2sin4
11
21
12 K
b21 2
1 Kband where K = 16.
(Ans: )Hzf 0777.00
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
(c) Using the equations obtained and the valuesin parts (a) and (b) above , show that thelowest oscillation frequency obtainable is
given by ss ff
ff 0min0 for
256
21)cos(
2xx You may assume that , given small f0.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
(d) For the structure shown in figure below,write down the appropriate differenceequations and hence state the function ofthis structure.
y2[n]
z-1
y1[n]
2cos
z-1
-1
-1
sin21
+
+
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Q4.(a) A second-order analogue band pass filter with an
s-domain transfer function is given by,
Where ωp and bp are the centre frequency andbandwidth of the filter; respectively, both expressed
in rad/s. By applying the bilinear transformation toequation (1) a digital filter with the following transferfunction can be obtained:
(1).)( 22pp
p
sbs
sbsH
(2).1
)( 22
11
210
zbzbzaazH
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
22
22
2
22
22
1
2210
24
24
24
82
24
2
TTb
TbTb
TTb
Tb
TTb
Tbaa
pp
pp
pp
p
pp
p
Show that the digital filter coefficients are given by
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
(b) A digital filter with a centre frequency of 1000 Hzand a bandwidth of 150 Hz is required. Assuming a
sampling frequency of 10kHz, compute the digital
filter coefficients a0, a1, b1 & b2 and show that
a0 = a1 = 0.04409115; b1 = -1.551 and b2 = 0.918176
(c) Comment on the stability of the digital filter H(z) (seeequation 2 ) which you have obtained .
(2).1
)( 22
11
210
zbzb
zaazH
(Ans : Stable)
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Q5. A second-order resonant system is given by,
By applying the impulse invariant transformations tothe above equation, a digital filter with the followingtransfer function can be obtained.
22
1)(
pp
p sQ
s
sH
p
pp Q
b
BandwidthQ-factorAssociatedwith thepole
resonantfrequency
22
11
1
1)(
zbzbkz
zH
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Show that the filter coefficients b1 and b2
are given by,TpTp ebTqeb 22 2
221 );cos(2
)sin(4 222 TqeqK Tp
14and2
2222 p
p
p QpqQ
p
Also show that
, where
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Q6.(a) An FIR filter has an impulse response shown inthe figure below.
h[n]
1
1 20 3 4 5 n
Show that the frequency response of this filter isgiven by
2
25
)2(
sinsin
)(
jeH
where is the digital frequency.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
(b) Draw an alternate implementation of this filterusing pole and zero configuration.
(c) Draw an FIR filter structure that has the sameimpulse response as the figure below. State clearlythe values of the FIR filter coefficients.
z-1
z-1
X(z)
Y(z)
b
c d e
+
+
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Q7. (a) Determine the impulse response hd[n]of the bandpass filter whose frequencyresponse is given by
(b) To obtain a finite impulse response from
hd[n] a Bartlett window of length N = 7 is
used. Compute the coefficients of the FIRfilter with this impulse response.
otherwise04
34)(
3
j
deH
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Note: The Bartlett Window function is given by
otherwise0
12
11
22
21
01
2
NnN
Nn
Nn
Nn
nwB
Where N is the length of the window.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
33)3sin()3sin(
:21
443
)3(1
nnnn
nhAns nd
6543210n
000hd[n]
after windowinghd[0]Ans:
21
31
31
21
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Q8. (i) (a) Find the transfer function for the following:
(b) Draw a pole-zero diagram
(c) Sketch the magnitude frequency response.
(a) If , sketch the magnitude response
|H()|.
(b) If , sketch the magnitude response of
|H1()|.
X(z) Y(z)
1/5
51 1)( zzH
152
1522
1
53
1
53
)(
zeze
zHjj
31)(
3 zzH
31
11
)( 1
3
1
zz
zH
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Q9. A frequency sampling filter is shown below & N = 3
(a) Determine a0 , a1 & a2 such that this filter has a real
impulse response h[n], where
1-z-NX(z)
1/N+
Y(z)
12
2
121
11
ze
a
ze
a
Nj
Nj
10
1 za
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
336
32)(and3)0( jHH
kN
kj
kN
kjaeHaeH
)(;
22
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
(b) Draw the frequency-sampling filter structureusing delay elements, multipliers and adders.
(c) Derive a general expression for H().
(d) Give a filter that has same frequency
response H(), but is realized an FIR filter.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Summary of Part A Chapter 5 At the end of this chapter, it is expected that you should know:
The properties of FIR and IIR filters, so that you can justifyyour choice of filter type for a given problem. The linear phaseproperty of symmetric FIR filters is particularly important.
Design techniques, the differences between them, and why eachare used. FIR: windowing and frequency sampling. IIR: impulse invariant transformation (when and why it is
used), bilinear transformation (when and why it is used) andpole-zero placement.
Prewarping and its role in bilinear transformation–based design.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Given a digital filter specification, how to design an IIR digitalfilter using an analog prototype.
Digital to digital transformations, especially lowpass to lowpass,and lowpass to highpass.
Types of window functions, the differences between them, andthe fundamental trade-off between time and frequencyresolution. Students should understand the importance ofstopband attenuation, and the role of the main lobe width in thedefinition of frequency resolution.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia
Comb filters as a frequency sampling filter.
Comb filters as a particular case of FIR filter design.
How to draw comb filter structure, and limitationsassociated with the comb filter structure.
Profes
sor E
. Ambik
airaja
h
UNSW, A
ustra
lia