Title: Lecture 19: Filter design
1Lecture 19Filter design
- Svetoslav NikolovØrstedDTU, Building 349
2Today
- Causality
- Linear phase filters
- Filter design using window functions
- Filter design using windowed sinc function
- Design IIR using SPtool.
3Filter causality
- Frequency response H(?) cannot be 0, except at a
finite set of points - H(?) cannot be constant in any finite range of
? - Transition from stop- to pass-band cannot be
infinitely sharp - Real and imaginary parts are related via Hilbert
transform.
4Characteristics of practical filters
Fdatool demo!
5Linear phase filters
Input signal
Non-linear phase
Demo non-linear phase
Linear phase
6Symmetric and Antisymmetric FIR filters
7Shapes of window functions
8Rectangular window
61 coefficients
31 coefficients
9Hamming window
Hamming
Rectangular
10Windowed sinc rectangular window
11Using other windows
Rectangular window
Hamming window
12Example
- Design a 15 coefficient causal law-pass filter
with a bandwidth of B Hz and sampling rate of 4B
Hz. Calculate the amplitude of the actual
transfer function. - Apply a Hamming filter on the designed filter and
determine the resulting frequency response.
13Example result 1
i 014 b sinc((i-7)/2)/2 freqz(b,1)
14Example result 2
i 014 b sinc((i-7)/2)/2 b
b.hamming(15)' freqz(b,1)
15Design of optimum linear phase filter
f 0 400 600 900 1100 2500/2500 m 0 0 1 1
0 0 b remez(31, f, m) freqz(b,1,400, 5000)
16Recursive filters
- Chebyshev (???????, Chebychev, Tcsheysheff,
Tchebichef) filters are based on a mathematical
strategy for achieving a faster roll-off by
allowing a ripple in frequency response. - Butterworth filter has a ripple of 0 .
- Filters with ripple in pass-band are type 1, and
with ripple in the stop-band are type 2 (seldom
used). - Elliptic filters have ripples both in pass- and
stop-band
17Designing recursive filters in Matlab
- Use Matlab to design an 8th order elliptic
lowpass filter with a cutoff freq. of 300 Hz, 0.5
dB ripple in pass band and a minimum stop-band
attenuation of 50 dB for use with a signal
sampled at 4 kHz. - Evaluate the response using 53, 20 and 12 bit
precision. - Implement it as a cascade of second order
sections.
18Example with elliptic filter
b, a ellip(8, .5, 50, 300/2000) z, p, k
ellip(8, .5, 50, 300/2000) zplane(b,a) b12
round(b211)/211 a12 round(b211)/211 zpl
ane(b12,a12)
53-bit precision (double)
1912-bit coefficients
b, a ellip(8, .5, 50, 300/2000) z, p, k
ellip(8, .5, 50, 300/2000) zplane(b,a) b12
round(b211)/211 a12 round(b211)/211 zpl
ane(b12,a12)
12-bit precision
20The transfer function
53 bit
subplot(3,1,1) h,f freqz(b,a, 512, 4000) m
20log10(abs(h)) plot(f,m) axis(0 2000 -80
20) ylabel ('H(f) dB')
20 bit
12 bit
21Using 4 2nd-order sections
m zp2sos(z,p,k) m12 round (m211)/211 fig
ure subplot(2,2,1) zplane(m12(1,13),
m12(1,46))
22Summary
- Symmetric FIR filters have a linear phase.
- A simple method to design them is to use
windowing functions in combination with a
truncated sinc. - Recursive filters have better performance, but
the phase is not linear and are subject to
stability issues with integer coefficients.