Anda di halaman 1dari 28

FIR Filter Design

Chapter 12.8
Lecture 16

1
2 Types of Filters
• Finite Impulse Response (FIR)
– Easy to design No poles:
– Always stable! always stable
– Phase distortion is LINEAR
– Large and slow to implement
• y[n] = b0x[n] + b1x[n-1] + ….+ bmx[n-m]
• Infinite Impulse Response (IIR)
– Harder to design
– Can be unstable
– More efficient (faster)!
• y[n] = -a1y[n-1] + …+ aNy[n-N] + b0x[n] + ….+ bmx[n-m]

2
Design an FIR LPF
• Start with Ideal Filter:

• Obtain the time domain impulse response

3
• Now, let’s observe this filter in the time
domain using MATLAB:
– Let Ω1 = π/3

4
MATLAB CODE
• close all
• clear all

• %note: we must truncate a sinc function! So, let's begin by
observing the
• %function from n = -m:m for different values of m

• n = -10:10;
• h = sin(pi/3*n)./(pi*n);
• h(11) = 1/3;
• figure, stem(n, h)
• a = 1;
• figure, freqz(h, a)

5
Example
• Design a LPF-FIR filter if Ω1 = π/3, m = 10

fB = 0.3π
0db in pass band Ringing in stop band

6
Example 2
• Design a LPF-FIR filter if Ω1 = π/3, m = 20
Ringing in pass band (we’ll
see this better in a bit) More ringing in the stop band
Steeper cut off
0db in pass band

7
Example 3
• Design a LPF-FIR filter if Ω1 = π/3, m = 50

8
Design a FIR BPF
• How do you think we could adjust the LPF
into a BPF?

9
Example
• Design a BPF-FIR filter if • close all
• clear all

• %note: we must truckate a sinc function! So, let's
Ω0 = 0.6π, begin by observing the
• %function from n = -m:m for different values of m

• n = -20:20;
Ω1 = π/6, • h = (1./(pi.*n)).*(sin(pi/6.*n)).*(cos(0.6*pi.*n));
• h(21) = 0.1667;
m = 20, 40, 100 • figure, stem(n, h)
• a = 1;
• figure, freqz(h, a)

10
BPF with
Ω0 = 0.6π, Ω1 = π/6, m = 20

11
BPF with
Ω0 = 0.6π, Ω1 = π/6, m = 40

12
BPF with
Ω0 = 0.6π, Ω1 = π/6, m = 100

13
Design an FIR HPF
• n = -10:10;
• h = (1./
(pi.*n)).*(sin(2*pi/3.*n)).*(cos(pi.*n));
• h(11) = 2/3;
• figure, stem(h)
• a = 1;
• figure, freqz(h, a)

14
HPF with
Ω1 = π/3, m = 10

15
Improving FIR Filter
• Look again at LPF results

• What would we really like to see? Where


does this problem come from?

16
Improving FIR Filter: Ideal vs Real
• Ideal LPF

• Real LPF

• How do we improve?

17
Types of windows
• What if a more “gradual” window is used?
– Triangle:

– Von Hann (aka: the raised cosine window)

– Hamming Window (an improved Von Hann Window)

18
Example
Design a 51-term FIR LPF with Ω1=0.3π
Using a rectangular window:
h[n] =

h[0] =

19
Rectangular Window

20
Example
Design a 51-term FIR LPF with Ω1=0.3π
Using a Triangular window
h[n] =

h[n] =

21
Triangular Window

22
Example
Design a 51-term FIR LPF with Ω1=0.3π
Using a Von Hann window
h[n] =

h[n] =

23
Von Hann Window

24
Example
Design a 51-term FIR LPF with Ω1=0.3π
Using a Hamming window
h[n] =

h[n] =

25
Hamming Window

26
Closer comparison

27
Log Comparison

28

Anda mungkin juga menyukai