Professional Documents
Culture Documents
Toolbox
O R E
I G N E
S L I D
THI S
IIR Filter Structures
3 structures to implement an IIR filter:
Direct Form – According to (2) and have 2 parts, namely
moving average part and recursive part (the numerator and
denominator). There are 2 versions; direct forms 1 and direct
forms 2.
O R E
G N
Parallel Form – Similar to cascade form, but use partial
I E
fraction to represent the system function.
S L I D
THIS
Review………
Discrete-time system:
y (ν ) = Φ ( x(k ))
Review………
MATLAB example 1:
N = 80; k = 0:(N-1);
MATLAB filter
b0 = 1;
command
b1 = -1; corresponds to
b2 = 1; the symbol Φ
B = [b0 b1 b2];
f = 1/8;
x = sin(2*pi*f*k+pi/6); y (n) = b0 x(n) + b1 x(n − 1) + b2 x(n − 2)
y = filter(B,1,x); y (n) = Φ ( x(k ))
subplot(2,1,1)
systemFIR(0,0,4,5,10,'b')
subplot(2,1,2)
plot(k,x,'go', k,y,'bo',...
k,x,'g-', k,y,'b-')
legend('input','output')
Review………
Impulse response:
h(n) = Φ (δ (k ))
Review………
MATLAB example 2:
N = 16; k = 0:(N-1);
b0 = 1; y (n) = b0 x(n) + b1 x(n − 1) + b2 x(n − 2)
b1 = -1;
b2 = 2;
B = [b0 b1 b2];
x = (k==0);
y = filter(B,1,x); h(n) = Φ (δ (k ))
subplot(3,1,1)
systemFIR(0,0,4,5,10,'b')
subplot(3,1,2)
stem(k,x,'r')
ylabel('input')
subplot(3,1,3)
stem(k,y,'b')
ylabel('output')
FIR and IIR Filters and System
What are FIR and IIR systems?
A discrete system is said to be an FIR system if
its impulse response has zero-valued samples
for n > M > 0
Integer number M is called the
length of the impulse response
IIR system is a discrete system with an infinite
impulse response
FIR = Finite Impulse Response
IIR = Infinite Impulse Response
FIR and IIR Filters and System
MATLAB example 3:
N = 80; k = 0:(N-1); y (n) = x(n − 1) + ay (n − 1)
a = 0.97;
B = [0 1]; The impulse response
A = [1 -a];
does not vanish after
finite number of
x = (k==0); samples
y = filter(B,A,x);
subplot(3,1,1)
draw1stIIR(0,0,4,5,10,'b')
subplot(3,1,2)
stem(k,x,'r')
ylabel('input')
subplot(3,1,3)
stem(k,y,'b')
ylabel('output')
Basic FIR structures
Direct form, Transposed form, Cascade form,
Linear-phase, Symmetric
Step 4: Implementation
Classical digital filter design
Start with specification:
Classical digital filter design
Start with specification:
Classical digital filter design
Step 1: Approximation; Select Chebyshev
Type I
Classical digital filter design
Export coefficients: File, Export
Classical digital filter design
Step 2: Realization; Direct-form II biquads
Classical digital filter design
Step 3: Study of imperfections:
Quantization The spec is
violated!
Classical digital filter design
Redo step 1: Approximation, Increase
order
Classical digital filter design
Redo step 3: Study of imperfections
(Quantization) The spec is
OK
Classical digital filter design
Step 4: Implementation as a C header file
Digital filters: FIR filter design
Overview
FIR filters
Design techniques
FIR filter design
using Filter Design Toolbox
Digital filters: FIR filter design
FIR filter
FIR filter is characterized by a unit sample
response that has a finite duration
An advantage of FIR filters compared to IIR
counterparts is that FIR filters can be designed
with exactly linear phase
Linear phase is important for applications where
phase distortion due to nonlinear phase can
degrade performance (e.g., data transmission)
Digital filters: FIR filter design
Design of FIR filters
Windowing techniques
Equiripple FIR filters
Least squares and related techniques
Linear programming (LP) and mixed integer
linear programming (MILP)
Computationally efficient FIR filters using
periodic subfilters as building blocks
Digital filters: FIR filter design
Windowing techniques
One of the earliest design techniques
Coefficients can be obtained in
closed form
There is no need for solving complex
optimization problems
Most frequently used window functions are
Bartlett, Hann, Hamming, Blackman, and Kaiser
Windows
Digital filters: FIR filter design
Filter Design Toolbox windows
Overview:
Drawback of the classic design
Advanced design paradigm
AFDesign toolbox
Example design
Advanced digital filter design
Design example 1
Design a lowpass filter that satisfies the
following specification:
Fp = 1600 Hz
Fs = 1696 Hz
Ap = 0.2 dB
As = 40 dB
Fsamp = 8 kHz
Goal: Optimize group delay
Advanced digital filter design
Classic design
Fp = 1600; Fs = 1696; Gdmax is over 100
Ap = 0.2; As = 40;
Fsamp = 8000; Fnyquist = Fsamp/2;
Wp = Fp/Fnyquist;
Ws = Fs/Fnyquist;
[N, Wn] = ellipord(Wp, Ws, Ap, As)
[num,den] = ellip(N, Ap, As, Wn)
[H,f]=freqz(num, den, 512, Fsamp);
[Gd,fGd]=grpdelay(num,den,512,Fsamp);
plot(fGd,Gd);
figure; plot(f,-20*log10(abs(H)));
Advanced digital filter design
Advanced design: AFDesign
D4a has a smoother magnitude response, and that is the main reason for
lower Q-factors and smaller variation of the group delay in the passband.
Advanced digital filter design
Design alternative D4b