Eng. Julian S. Bruno - SASE · Imaginary Part 21 Pole/Zero Plot SASE 2012 Eng. Julian S. Bruno 0 50...
Transcript of Eng. Julian S. Bruno - SASE · Imaginary Part 21 Pole/Zero Plot SASE 2012 Eng. Julian S. Bruno 0 50...
Eng. Julian S. Bruno
REAL TIME
DIGITAL
S
www.electron.frba.utn.edu.ar/dplabSASE 2012
SIGNAL
PROCESSING
FIR and IIR.
� Design parameters.
Digital Filters
� Design parameters.
� Implementation types.
� Constraints.
SASE 2012 Eng. Julian S. Bruno
Filters: General classification
SASE 2012 Eng. Julian S. Bruno
Filters: General classification
SW Smith, The Scientist and Engineer’s guide to DSP. California Tech. Pub. 1997.SASE 2012 Eng. Julian S. Bruno
Filters: Frequency domain features
� Fast rollroll--offoff , flat passbandpassband and high attenuation in attenuation in stopbandstopband are stopbandstopband are desirable features.
� They can’t be achieved at the same time, so the design procedure is a trade trade offoff between these between these features.features.
SASE 2012 Eng. Julian S. Bruno
Filters: Time domain features
� Step response evidence the most important time domain features.
� In this case the trade off trade off is between fast step between fast step is between fast step between fast step response and overshootovershoot .
� Overshoot is an undesirable distortion and must be avoided.
� Simetry is a “fingerprint” of a linear phase response system (FIR).
SASE 2012 Eng. Julian S. Bruno
Filters: Phase response
The phase response phase response of a filter gives the radian phase shift radian phase shift experienced by each
SASE 2012 Eng. Julian S. Bruno
experienced by each sinusoidal component of the input signal. Sometimes it is more meaningful to consider phase phase delaydelay
Filters: Group and Phase Delay
SASE 2012 Eng. Julian S. Bruno
Filters: Group and Phase Delay
|H(w)| = 1
140
Phase Delay
200
250
300
350
Normalized Frequency: 0.1000977Group delay: 343.8103
Gro
up
del
ay (
in s
amp
les)
Group Delay
SASE 2012 Eng. Julian S. Bruno
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
40
60
80
100
120Normalized Frequency: 0.1000977Phase Delay: 112.9315
Normalized Frequency (×××× ππππ rad/sample)
Ph
ase
Del
ay (
sam
ple
s)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
50
100
150
Normalized Frequency (×××× ππππ rad/sample)
Gro
up
del
ay (
in s
amp
les)
-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5
-1
-0.5
0
0.5
1
Real Part
Imag
inar
y P
art
Pole/Zero Plot
0 200 400 600-1
0
1
0
1
Filters: Group Delay
W = 0.1
W = 0.32
4Input
Gd(0,1)= 343 samples
0 200 400 600-1
0
0 200 400 600-1
0
1
0 200 400 600-1
0
1
SASE 2012 Eng. Julian S. Bruno
W = 0.5
W = 0.7
0 200 400 600 800-4
-2
0
2
4Output
0 200 400 600 800-4
-2
0
1
0 200 400 600-1
0
1
1
Filters: Phase Delay
1
Pd(0,1)= 113 samples
250 300 350 400 450 500-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
SASE 2012 Eng. Julian S. Bruno
250 300 350 400 450 500-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Digital Filters: Design steps
� Requirement specifications.
� Coefficients calculation.
� Filter realization:
� Structure.
� Wordlength effects.
� Software or Hardware implementation.
EC Ifeachor, BW Jervis. Digital Signal Processing. A Practical approach. Second Edition. Prentice Hall.
SASE 2012 Eng. Julian S. Bruno
Digital Filters: Specifications
pA
pδ−1
pδ+1
( )ωH
Ideal filter 1
ppp H ωωδωδ ≤≤+≤≤− 0 ,1)(1
10
120log dB
1p
pp
Aδδ
+= −
SASE 2012 Eng. Julian S. Bruno
Passband
pδ−1
Stopband
0 pω sω
sδ ω π cω
sA
Actual filter
Transition band
πωωδω ≤≤≤ s ,)( sH
1020log dBs sA δ= −
Ap : Ripple in band (dB)As : Band-stop attenuation (dB)π-ωs : Band-stop start/endωp-ωs : Band-pass start/end
FIR
Finite Impulse Response
SASE 2012 Eng. Julian S. Bruno
FIR filters: General characteristics
� FIR digital filters use only currentcurrent and past input past input samplessamples . Require no feedback.
� Their transfer function has zeros around the Z zeros around the Z planeplane and poles at the originpoles at the origin , so FIR filters are planeplane and poles at the originpoles at the origin , so FIR filters are always stablealways stable .
� They can easily be designed to be linear phase linear phase and constant delay and constant delay by making the coefficient sequence symmetric.
� Finite duration of nonzero input values / Finite duration of nonzero output values. Finite Impulse Finite Impulse Response.Response.
SASE 2012 Eng. Julian S. Bruno
FIR filters: General characteristics
Being x(n) and h(n) are arrays of
UTN - FRBA 2011 Eng. Julian S. Bruno
� Being x(n) and h(n) are arrays of numbers. If we want to compute y(n) we have to multiply and sum the last M samples, being M the length of h(n).
� As you can see, any linear system uses multiplications, accumulations (sums), and loops intensively.
FIR filters: Perfect linear phase
( )
[ ]samplesM
delay
fgdpd f
2
1−=
∂Θ∂
−==
SASE 2012 Eng. Julian S. Bruno
� Zero phase filters are a particular case of linear phase with zero delay.
2
gd = 0gd = 25 delay = 25
� Type I: h(n) = h(N-n) with even N .� Type II: h(n) = h(N-n) with odd N.� Type III: h(n) = -h(N-n) with even N.� Type IV: h(n) = -h(N-n) with odd N.
Linear phase FIR filter
� Type IV: h(n) = -h(N-n) with odd N.
SASE 2012 Eng. Julian S. Bruno
Type I Even order - Even symmetric
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Imag
inar
y P
art
10
Pole/Zero Plot
0
0.1
0.2
0.3
0.4
0.5Impulse Response
Am
plit
ude
SASE 2012 Eng. Julian S. Bruno
0 5 10 15 20
-61.1544
-53.4141
-45.6737
-37.9334
-30.1931
-22.4527
-14.7124
-6.9721
0.7683
Frequency (kHz)
Mag
nitude
(dB)
Magnitude (dB) and Phase Responses
-8
-7
-6
-5
-4
-3
-2
-1
0
Pha
se (ra
dia
ns)
-1 -0.5 0 0.5 1 1.5 2
-1
-0.8
-0.6
-0.4
Real Part
0 20 40 60 80 100 120 140 160 180 200-0.2
-0.1
0
Time (useconds)
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Imag
inar
y P
art
11
Pole/Zero Plot
Type II Odd order – Even symmetric
0.1
0.2
0.3
0.4
0.5
0.6Impulse Response
Am
plitud
e
-1 -0.5 0 0.5 1 1.5
-1
-0.8
-0.6
Real Part
SASE 2012 Eng. Julian S. Bruno
We can´tdesign highpass filters(HPF)
0 50 100 150 200-0.1
0
Time (useconds)
0 5 10 15 20
-60
-50
-40
-30
-20
-10
0
Frequency (kHz)
Mag
nitude
(dB
)
Magnitude (dB) and Phase Responses
-8.4029
-7.0167
-5.6306
-4.2444
-2.8583
-1.4721
-0.086
Phas
e (r
adia
ns)
Type III Even order - Odd symmetric
-0.5
0
0.5
1
Imag
inar
y P
art
20
Pole/Zero Plot
-0.1012
-0.0506
0
0.0506
0.1012
0.1519
0.2025
0.2531Impulse Response
Am
plitu
de
SASE 2012 Eng. Julian S. Bruno
-1.5 -1 -0.5 0 0.5 1 1.5 2
-1
Real Part
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
-20
-15
-10
-5
0
Normalized Frequency (×π rad/sample)
Mag
nitu
de (
dB)
Magnitude (dB) and Phase Responses
-16.2522
-12.091
-7.9299
-3.7687
0.3924
Pha
se
(rad
ians
)
0 2 4 6 8 10 12 14 16 18 20-0.2531
-0.2025
-0.1519
Samples
We can´tdesign low and high passfilters (LPF and HPF)
Type IVOdd order – Odd symmetric
-0.3
-0.2
-0.1
0
0.1
0.2
0.3
0.4
0.5
Am
plitu
de
Impulse Response
-0.5
0
0.5
1
Imag
inar
y P
art
21
Pole/Zero Plot
SASE 2012 Eng. Julian S. Bruno
0 50 100 150 200 250 300 350 400
-0.5
-0.4
Time (useconds)
-1.5 -1 -0.5 0 0.5 1 1.5 2 2.5
-1
Real Part
0 5 10 15 20
-35
-30
-25
-20
-15
-10
-5
0
Frequency (kHz)
Mag
nitu
de (
dB)
Magnitude (dB) and Phase Responses
-22.2571
-19.4695
-16.6818
-13.8942
-11.1066
-8.319
-5.5314
-2.7437
Ph
ase
(rad
ians
)
We can´tdesign lowpass filters(LPF)
Minimun phase FIR filter
-1
-0.5
0
0.5
1
1.5
Imag
inar
y P
art
54
Pole/Zero Plot
-0.5
0
0.5
1
Imag
inar
y P
art
50
Pole/Zero Plot
SASE 2012 Eng. Julian S. Bruno0 5 10 15 20
-90
-80
-70
-60
-50
-40
-30
-20
-10
0
Frequency (kHz)
Mag
nitu
de
(dB
)
Magnitude (dB) and Phase Responses
-19.3495
-16.5521
-13.7546
-10.9571
-8.1597
-5.3622
-2.5647
0.2327
3.0302
5.8277
Ph
ase
(rad
ian
s)
-1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 4-1.5
Real Part
0 5 10 15 20
-90
-80
-70
-60
-50
-40
-30
-20
-10
0
Frequency (kHz)
Mag
nit
ud
e (d
B)
Magnitude (dB) and Phase Responses
-11.2977
-9.2226
-7.1475
-5.0724
-2.9973
-0.9222
1.1529
3.228
5.3031
7.3782
Ph
ase
(rad
ian
s)
-1.5 -1 -0.5 0 0.5 1 1.5
-1
Real Part
Minimun phase FIR filter
-0.05
0
0.05
0.1
0.15
Impulse Response
Am
plit
ud
e
-0.05
0
0.05
0.1
0.15
Impulse Response
Am
plit
ud
e
SASE 2012 Eng. Julian S. Bruno0 5 10 15 20
26.5
26.6
26.7
26.8
26.9
27
27.1
27.2
27.3
27.4
27.5
Frequency (kHz)
Gro
up d
elay
(in
sam
ple
s)
Group Delay
0 0.2 0.4 0.6 0.8 1
-0.15
-0.1
Time (mseconds)0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-0.1
Time (mseconds)
0 5 10 15 2012
14
16
18
20
22
24
26
Frequency (kHz)
Gro
up
del
ay (
in s
amp
les)
Group Delay
Minimum-Phase vs Linear Phase
� L-P FIR filter has zeros inside, on, and outside the unitcircle.
� M-P FIR filter has all of its zeros on or within the unit circle.
� Given optimal M-P and L-P digital FIR filters that meet the same magnitude specificationsame magnitude specification , the M-P filter would have same magnitude specificationsame magnitude specification , the M-P filter would have a reduced filter length reduced filter length of typically one half to three fourths of the L-P filter length, and Minimum group delayMinimum group delay , where energy would be concentrated in the lowlow --delaydelay instead of the medium-delay coefficients
� M-P filters can simultaneously meet constraints on delay constraints on delay and magnitude responseand magnitude response while generally requiring fewer computations and less memory than L-P filters.
SASE 2012 Eng. Julian S. Bruno
FIR filters: Coefficients calculation
� Moving average (MA)
� Windowed Sinc filters
� Remez exchange (Parks McClellan)
method
SASE 2012 Eng. Julian S. Bruno
Moving average filters
� Each output will be the average of the last M samples of the input.
� This kind of filters is very easy to implement, but it has very poor roll-off and attenuation in stopband.
� It is mainly used for smoothing purposes.SASE 2012 Eng. Julian S. Bruno
∑∑−
=
−
=
+−=−=1
0
1
0
]2/[1
][;][1
][M
j
M
j
MjnxM
nyjnxM
ny
MA filters: applications
� Improvements can be achieved if we increase M or if the same filter is passed multiple times.
SASE 2012 Eng. Julian S. Bruno
MA filters: Recursive Implementation
The cost of implementing a MA filter is M sums and � The cost of implementing a MA filter is M sums and 1 multiplication.
� This can be improved if a recursive approach is taken.
� So any MA filter can be implemented by 2 sums and one accumulator.
� Keep in mind that a higher M implies a higher delay.
SASE 2012 Eng. Julian S. Bruno
MA Filter: Example
0.5
1
1.5
input filter
output MA filteroutput FIR filter
SASE 2012 Eng. Julian S. Bruno
0 100 200 300 400 500 600-1.5
-1
-0.5
0
MA filter: M=50 , An=10% , FIR filter: Equiripple order 39
Windowed Sinc FIR filters
� A sinc of infinite duration is the time domain equivalent of an ideal filter response.As it is impossible to � As it is impossible to store this signal, it is truncated to M samples.
� This truncation causes a severe degradation to the ideal frequency response.
SASE 2012 Eng. Julian S. Bruno
Windowed Sinc FIR filters
� In order to obtain better filter features, the truncated sinc can be multiplied by a window function.
x
function.� These windows
achieve either better smoothness, roll-off or stopband attenuation than the sinc.
� For this purposes, many windows were designed.
=
SASE 2012 Eng. Julian S. Bruno
Windowed Sinc FIR filters: Design
� Windowed Sinc filters are very easy to design.
� We only have to multiply a window formula to the sinc signal.
� One problem of window filters is that they are they are not optimal in the not optimal in the kernel length sensekernel length sense .
� The frequency of the sinusoidal oscillation is approximately equal to Fc
SASE 2012 Eng. Julian S. Bruno
Windowed Sinc FIR filters: Windows
Hamming:
Blackman:
Hanning:
SASE 2012 Eng. Julian S. Bruno
Optimal FIR filters: Remez exchange (Parks McClellan) method
� This design algorithm allows filter designs that that are optimal in the kernel are optimal in the kernel length senselength sense .
� The usage of the method is as simple as passing the filter specification to the algorithm and receiving its filter kernel.
SASE 2012 Eng. Julian S. Bruno
FIR filters: Design method
Design method
Passband StopbandTransition
bandMatlab
Function
Equiripple Ripply Ripply Narrow remez(lf)
Least Squares Flat Ripply Narrow firls(lf)Least Squares Flat Ripply Narrow firls(lf)
Max. Flat (LP) Flat Flat Wide maxflat(*)
Least Pth-norm Flat Ripply Narrow firlpnorm(*)
Constrained Equiripple
Flat Ripply Narrow firceqrip(*)
Window ** ** ** fir1
SASE 2012 Eng. Julian S. Bruno
FIR filters: Implementation
� Direct form or transversal structure.� Symmetry (Linear phase) optimization.� Fast convolution (overlap add/save).
SASE 2012 Eng. Julian S. Bruno
FIR filters: Direct Form
z -1
x
z -1
x
z -1
x
+
x
+ + +
x(n)
y(n)
h0 h1 hM-1 hM
x(n+1) x(n+M-2) x(n+M-1)
� Most DSP architectures are optimized for implementing this structure.
M MAC operations
M RAM positions (signal)M RAM positions (filter)Computational cost:
SASE 2012 Eng. Julian S. Bruno
FIR filters: Transversal Form
x x x
+
x
+ +
x(n)
y(n)
h0 h1 hM-1 hM
x(n+1) x(n+M-2) x(n+M-1)
z -1 z -1 z -1
� Most DSP architectures are optimized for implementing this structure.
M MAC operations
M RAM positions (signal)M RAM positions (filter)Computational cost:
SASE 2012 Eng. Julian S. Bruno
FIR filters: Linear phase form
z -1 z -1 z -1x(n)
z -1 z -1 z -1
+ + +
x(n+1) x(n+half-1) x(half)
x(n+M-2)x(n+half+1)
x(n+M-1)
h(n)
half n
M odd
x
++ + + y(n)
h0
M/2 (even) M/2+1 (odd) MAC operations
M RAM positions (signal)M/2 (even) M/2+1 (odd) RAM positions (filter)Computational cost:
+ + +
xh1 xhhalf-1 xhhalf h(n)
half n
M even
SASE 2012 Eng. Julian S. Bruno
FIR filters: Fast convolution
FFT iFFTx(n) X y(n)
H(w) M : 2N multiple
M
M
� Overlap add/save algorithm.
M/2 complex multiplications
M (2M for performance) RAM positions (signal)M RAM positions (filter)
Computational cost:
H(w)
2 FFT (M . log2(M) )
SASE 2012 Eng. Julian S. Bruno
FIR filters: Wordlength effects
� ADC quantization noise.
SNRADC = 1.76 + 6.02 . ADCBits
� Coefficients quantization noise.� Coefficients quantization noise.
� Roundoff quantization noise.
� Arithmetic overflow noise
SASE 2012 Eng. Julian S. Bruno
FIR filters: Roundoff quantization
12
22 qQ =σx
+
B bitsB bits
2B bits
Non linear model
Q
Linear model
xB bits
B bits
2B bits
e(n)
(roundoff noise power)
q : ADC quantization step (V)+Q
B bits B bits
e(n) q : ADC quantization step (V)
� Each quantization process (multiplication) degrades system’s noise figure.
SASE 2012 Eng. Julian S. Bruno
IIR
Infinite Impulse Response
SASE 2012 Eng. Julian S. Bruno
IIR filters: General characteristics
� IIR filter output sample dependsdepends on previous inputinputsamples and previous filter outputoutput samples.
� Implemented using a recursion equation, instead a convolution and dondon ´́t have linear phase responsest have linear phase responses .
� IIR filters have poles poles and zeros around the Z planezeros around the Z plane , they are not always stableare not always stable .
� IIR filters have poles poles and zeros around the Z planezeros around the Z plane , they are not always stableare not always stable .
� Finite duration of nonzero input values / Infinite duration of nonzero output values. Infinite Impulse Infinite Impulse ResponseResponse
� IIR filters achieves better performance better performance than FIR for the same kernel length.
� Implementation is more complicatedmore complicated , and requires floating point or large word lengths.
SASE 2012 Eng. Julian S. Bruno
IIR filters: Non linear phase response
� As in analog domain, linear phase could be achieved at expense of loosing other desirable features.
� In other words, IIR filters are much faster than FIR filters but filter stability and phase distortion is a VERY important issue.
SASE 2012 Eng. Julian S. Bruno
IIR filters: Linear phase with bidirectional filtering
� Bidirectional filtering is a way of forcing an IIR filter to have perfect linear phase, at expense of speed since, at least, the computing cost is duplicated.
SASE 2012 Eng. Julian S. Bruno
IIR filters: the recursion equation
( ) ( )( )
∑
∑
−
−
=
+==
Mk
kN
kk
Za
Zb
zX
zYzH 0
)(
1
x +
x(n) y(n)b0
z -1
x +
b1
x+
z -1
+
-a1
SASE 2012 Eng. Julian S. Bruno
� Each output is a linear combination of past input and output samples
∑∑==
−−−=M
kk
N
kk knyaknxbny
1)(
0)( )(.)(.)(
( )∑
=
−+k
kk Za
zX
1)(1
The recursive coefficients are scaled to yield a0 = 1
x +
z -1 bN
x+
z -1-aM
IIR filters: Coefficients calculation
� Pole-zero placement.
� Impulse invariance.
Matched z-transform.� Matched z-transform.
� Bilinear z-transform.
SASE 2012 Eng. Julian S. Bruno
IIR filters: Analog & Digital
� As in the analog domain, simple filters could be implemented with a few coefficients.
For HP: And for LP: And for both: (Time decay)
(Cutoff frequency)
SASE 2012 Eng. Julian S. Bruno
IIR filters implementation: Direct Form 1
� DF1 is the most direct way of implementing an IIR filter.
� It uses two buffers (delay lines) and
∑∑==
−−−=M
kk
N
kk knyaknxbny
1)(
0)( )(.)(.)(
x(n) y(n)b0
x + +
SASE 2012 Eng. Julian S. Bruno
(delay lines) and 2(M+1) multiplications and sums.
� More sophisticated forms optimizes memory usage, coefficients precision sensibility and stability.
x +
z -1
x +
z -1
b1
bN
x+
z -1
x+
z -1
-a1
-aM
IIR filters implementation:Direct Form 2 (canonic)
� DF2 Reduces memory usage by two, since the delay line is shared. ∑
∑
=
=
−=
−−=
N
kk
M
kk
knwbny
knwanxnw
0)(
1)(
)(.)(
)(.)()(
SASE 2012 Eng. Julian S. Bruno
line is shared.
x +
x(n) y(n)b0
z -1
x +
x +
z -1
b1
bN
x+
+
x+
-a1
-aM
w(n)
IIR filters: SNR in DF1 and DF2
x +
x(n) y(n)b0
z -1
x +
b1
x+
z -1
+
-a1
x +
x(n) y(n)b0
z -1
x +
b1
x+
+
-a1
w(n)
quantization point quantization pointsInternal node
� The canonic section is susceptible to internal self-sustaining overflow.
� In practice, the poles of the canonic section tend to amplify noise generated during computation more.
SASE 2012 Eng. Julian S. Bruno
x +
x +
z -1 bN
x+
x+
z -1-aM
x +
x +
z -1 bN
x+
x+
-aM
IIR filters implementation: Design Pitfalls
� IIR implementation is conditioned mainly by finite wordlength effects.
� Coefficient quantization, overflow and roundoff errors are most common problems.errors are most common problems.
� To go through these problems, some precautions must be taken into account.
SASE 2012 Eng. Julian S. Bruno
IIR filters: Overflow
� The final result overflows.� Intermediate results overflow. (Modulo math)� Unity gain filters can have outputs that are
greater than ±1 with a bounded input.greater than ±1 with a bounded input.
SASE 2012 Eng. Julian S. Bruno
IIR filters: Noise
� Noise is generated by truncatingtruncating high resolution results.
� The noise generated by truncation often resembles the spectrum of the signal being filtered.
� The generated noise is most harmful when it re-� The generated noise is most harmful when it re-circulates through the recursive coefficientsthrough the recursive coefficients .
� Force correlated truncation noise truncation noise to be random (white) by using ditherusing dither .
� If the truncation process is deterministic then correction can be applied to the filter.
�� Fixed point truncation is deterministicFixed point truncation is deterministic .�� Floating point truncation is not deterministicFloating point truncation is not deterministic .
SASE 2012 Eng. Julian S. Bruno
IIR filters implementation: Coefficient quantization sensibility
� Frequency response are severely affected for small wordlengths.
� The sensibility grows with the order of the with the order of the system.
� Second order partitioning mitigate this problem by diminishing speed.
� Instability can occur for very sharp responses.
SASE 2012 Eng. Julian S. Bruno
IIR filters implementation: Coefficient quantization sensibility
Mkbbbzb
za
zbzHzazyzbzxzy
kkq
Mk
kq
N
k
kk
M
k
kkN
k
kk
M
k
kk
,,2,1
1)(,)()()(
1
0
10
K=∆+=
+=−=
∑
∑
∑∑∑
−
=
−
=
−
=
−
=
−
SASE 2012 Eng. Julian S. Bruno
Nkaaa
Mkbbb
zazH
kkkq
kkkq
N
k
k
kq
kkq
q ,,2,1
,,2,1
1)(
1
0
K
K
=∆+==∆+=
+=
∑
∑
=
−
=
∑
∑
∑
=
−
==
−
−
==
−
∆∂∂=∆∆+=
−Π=+==
−Π=+==
N
kk
k
iikkkq
kq
N
k
N
k
k
kqqq
k
N
k
N
k
kk
ap
ppppp
zpzazDzD
zNzH
zpzazDzD
zNzH
1
1
11
1
11
,
)1(1)(,)(
)()(
)1(1)(,)(
)()(
∑∏=
≠=
−
∆−
−=∆N
kkN
ill
li
kNi
i app
pp
1
1
)(
IIR filters implementation: Coefficient quantization sensibility
� Second order sections (SOS) can be grouped in cascade or parallel.
� When cascading SOS’s the
H1x(n) y(n)HN
� When cascading SOS’s the order is chosen to maximize SNR.
� Cascade is the most typically used in DSP processors.
H1x(n) y(n)
HN
+
SASE 2012 Eng. Julian S. Bruno
IIR Filter: SOS Forms
SASE 2012 Eng. Julian S. BrunoMark Allie comp.dsp 2004
Direct Form I
Z-1
Z-1
b0
b1 -a1
x(n) y(n)
Direct Form I
N
N
2N
2N
2N
2N N
Q
N(lo)
N(hi)yt(n)
e(n)
N
N N
N
Qyt(n)
SASE 2012 Eng. Julian S. Bruno
Z-1
Z-1
b2 -a2N 2N 2N N
Fixed Point:
Modulo math useful. One summer before saturator.
No Input scaling required to prevent internal overflow.
One truncation feedback error term.
Truncation noise affects recursive terms.
Truncation noise negligible for N large enough.
Floating point:
No input scaling required.
No overflow concerns.
Truncation error is coefficient dependant and not
correctible.
Truncation noise affects recursive terms.
Number of bits in mantissa critical.
N N
( ) )(1
1)(
1 12
11
12
11
22
110 zE
zazazX
zaza
zbzbbzYt −−−−
−−
++−
++++
=
Mark Allie comp.dsp 2004
Direct Form II
Z-1
b0x(n)
y(n)
Direct Form II
Q
2N
e1(n)
2N
Q
N(hi) N(hi)
N(lo)
e2(n)
w(n)N
N(lo)N
N N
N
yt(n)
SASE 2012 Eng. Julian S. Bruno
Z-1
b1
b2
-a1
-a2
2N
2N
2N
2N
w(n-1)
w(n-2)
Fixed Point:
Modulo math not useful. There are 2 sums
separated by a saturator.
Input scaling required to prevent internal overflow.
One truncation feedback error term.
Truncation noise affects all terms.
Truncation noise negligible for N large enough.
Floating point:
No input scaling required.
No overflow concerns.
Truncation error is coefficient dependant and not
correctible.
Truncation noise affects all terms.
Number of bits in mantissa critical.
N N
Mark Allie comp.dsp 2004
Direct Form I Transposed
SASE 2012 Eng. Julian S. BrunoMark Allie comp.dsp 2004
Direct Form II Transposed
Z-1
b0
y(n)
x(n)
Direct Form II Transposed
N 2N
N
2N
N
Q
N(hi)
N(hi)
yt(n)
Qyt(n)
N(lo)
N(lo)
e3(n)
Fixed Point:
Modulo math useful. One summer before saturator.
No Input scaling required to prevent internal overflow.
Multiple truncation feedback error terms*.
SASE 2012 Eng. Julian S. Bruno
Z-1
b1
b2
-a1
-a2
Q
Q
N(hi)
e1(n)
e2(n)
2N
N
2NN
2N
N
2N
N
2N
N
2N
N
N(lo)
(lo)Multiple truncation feedback error terms*.
Truncation noise affects recursive terms.
Truncation noise negligible for N large enough.
* One if Q1 and Q2 are removed. Dattorro
Floating point:
No input scaling required.
No overflow concerns.
Truncation error is coefficient dependant and not
correctible.
Truncation noise affects recursive terms.
Number of bits in mantissa critical.
Mark Allie comp.dsp 2004
Tabulated Results
Fixed PointDFI DFII DFIT DFIIT
Floating PointDFI DFII DFIT DFIIT
Input scaling + + + + + +
+ +
SASE 2012 Eng. Julian S. Bruno
Modulo math + +
Truncation noise + + + - - - -Performs well with 32 bit mantissa + + + + + +
Error compensation + + + - - - -
+ Good Attribute + Qualified Good Attribute - Poor Attribute
Mark Allie comp.dsp 2004
IIR Filters: Good News
� DFI and DFIIT both work.� A processor with 32 bit integer native word
size capabilities doesn’t need truncation error compensation.error compensation.
� Some modern floating point processors can do this inexpensively and fast.
� Some modern fixed point processors can do this inexpensively and more slowly.
SASE 2012 Eng. Julian S. Bruno
IIR Filters: Floating Point
� All DF IIR filters can work.� Complicated analysis and addend
evaluation. Floating point processors with extended � Floating point processors with extended precision results may work well.
� Analog devices has processors with 32 bit mantissa capabilities.
� Fixed point processing at 32 bits a sure bet
SASE 2012 Eng. Julian S. Bruno
Filters examples
SASE 2012 Eng. Julian S. Bruno
DC Blocker
SASE 2012 Eng. Julian S. Bruno
-1.5 -1 -0.5 0 0.5 1 1.5
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Real PartIm
agin
ary
Par
t
Pole/Zero Plot
DC Blocker: BF53X Fixed Point
1.15 1.159.31
Q
SASE 2012 Eng. Julian S. Bruno
1.31
Coefficient quantization error != 0
Product and Accumulator error = 0
Product Roundoff error != 0
Envelope detection
SASE 2012 Eng. Julian S. Bruno
Envelope detection
h(1) = h(3) = h(5) = h(7) = h(9) = h(11) = h(13) = 0
SASE 2012 Eng. Julian S. Bruno
Hilbert Filter
Decimation
)()(,,, Mnxmx
M
ff oldnew
oldsnews ==
Fs,new ≥ 2B
Polyphase implementation
SASE 2012 Eng. Julian S. Bruno
Fs,new < 2B
Interpolation
oldsnews fLf ,, ⋅=
SASE 2012 Eng. Julian S. BrunoPolyphase implementation
Efficient D/A conversion in compact hi-fi system
SASE 2012 Eng. Julian S. Bruno
Equalizing Techniques Flatten DAC Frequency Response
SASE 2012 Eng. Julian S. Bruno
Application in the acquisition of high quality data
SASE 2012 Eng. Julian S. Bruno
Recommended bibliography
� EC Ifeachor, BW Jervis. Digital Signal Processing. A Practical approach. Second Edition. Prentice Hall 2002.� Ch6: A framework for filter design.� Ch7 & 8: FIR & IIR filter design.� Ch13: Analysis of wordlength effects in fixed point DSP systems.
� RG Lyons, Understanding Digital Signal Processing. Third � RG Lyons, Understanding Digital Signal Processing. Third Edition. Prentice Hall 2010.� Ch5 & 6: FIR & IIR filters.
� SW Smith, The Scientist and Engineer’s guide to DSP. California Tech. Pub. 1997.� Ch14-21: FIR & IIR filter design.
� J. Dattorro, “The Implementation of Recursive Digital Filters for High Fidelity Audio,” J. Audio Eng. Soc., vol 36, pp 851-878 (1988 Nov)
NOTE: Many images used in this presentation were extracted from the recommended bibliography.SASE 2012 Eng. Julian S. Bruno
Thank you!
Questions?
SASE 2012Eng. Julian S. Bruno