SlideShare a Scribd company logo
‫َر‬‫د‬‫ـ‬ْ‫ﻘ‬‫ِـ‬‫ﻧ‬،،،‫ﻟﻣﺎ‬‫اﻧﻧﺎ‬ ‫ﻧﺻدق‬ْ‫ﻘ‬ِ‫ﻧ‬‫َر‬‫د‬
LECTURE (10)
FIR Filter Design
Assist. Prof. Amr E. Mohamed
Ideal Filters
 One of the reasons why we design a filter is to remove disturbances
 We discriminate between signal and noise in terms of the frequency
spectrum
2

)(ns
)(nv
)(nx )()( nsny Filter
SIGNAL
NOISE
F
)(FS
)(FV
0F0F 0F
F
)(FY
0F0F
Conditions for Non-Distortion
 Problem: ideally we do not want the filter to distort the signal we want to
recover.
 Consequence on the Frequency Response:
3
IDEAL
FILTER
)()( tstx  )()( TtAsty  Same shape as s(t),
just scaled and
delayed.
0 200 400 600 800 1000
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
0 200 400 600 800 1000
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
0 200 400 600 800 1000
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
0 200 400 600 800 1000
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2





otherwise
passbandtheinisFifAe
FH
FTj
0
)(
2
F
F
|)(| FH
)(FH
constant
linear
Phase Distortion
 Phase distortion results from a variable time delay (phase delay) for
different frequency components of a signal.
 If the phase response of a filter is a linear function of frequency, then
the phase delay is constant for all frequencies and no phase distortion
occurs.
4
Real Time Implementation
 For real time implementation we also want the filter to be causal, ie.
 FACT (Bad News!): by the Paley-Wiener Theorem, if h(n) is causal and with
finite energy,
 ie ( ) cannot be zero on an interval, therefore it cannot be ideal.
5
0for0)(  nnh

 




h n( )
n

 since 



0
)()()(
k
knxkhny

onlyspast value






 dH )(ln
)(H
   dHH )(log)0log()(log
1 2 1
2
Practical Filter specifications
 Filters
 Frequency-selective Filter
 Three Stages
 Specifications
 Approximation of the Specifications.
 Realization
6

|)(| H
p
IDEAL
Practical Filter specifications
 In practical design the following parameters would be specified:
 The maximum ripple allowed in the pass-band:
 The maximum ripple allowed in the stop-band:
 The pass-band edge frequency:
 The stop-band edge frequency:
 The order of the FIR or IIR filter.
7
p
s
p
s
Selection of Digital Filters (FIR & IIR)
 Finite Impulse Response (FIR) filter
 always stable,
 the phase can be made exactly linear,
 we can approximate any filter we want.
 Higher order w.r.t IIR filter (we need a lot of coefficients (N large) for good
performance)
 Infinite Impulse Response (IIR) filter
 very selective with a few coefficients
 Always Nonlinear Phase.
8
Design of FIR Filters
 Design means calculation (determination) of the coefficients of the
difference equation or the transfer function.
 Methods of FIR Filter Design:
 Window Method
 Frequency sampling method.
9


M
k
knxkhny
0
)()()(



M
k
k
zkhzH
0
)()(
Window Method
10
11
Design of FIR Filters (Window Method)
 Simplest way of designing FIR filters
 Method is all discrete-time no continuous-time involved
 Start with ideal frequency response
 Choose ideal frequency response as desired response
 Most ideal impulse responses are of infinite length
 The easiest way to obtain a causal FIR filter from ideal is by evaluating the
IDTFT of
   




n
nj
d
j
d enheH 
    




deeHnh njj
dd 

2
1
 j
d eH
12
Design of FIR Filters (Window Method)
 In general, the obtained impulse response is infinite in duration and
must be truncated at some point say at: = to give an FIR filter of
length M. Truncation of to a length M is equivalent to multiplying by a
rectangular window defined as:
 Thus, the impulse response of the FIR filter becomes :
 
 


 

else
Mnnh
nh d
0
0
       


 

else
Mn
nwnwnhnh d
0
01
where
 nhd
 nhd
13
Effect of the Window Size
 As the width of the window increases, its spectrum will be sharper and
the resulting convolution will be near ideal.
 The rectangular window truncates the impulse response to be of
duration . But this truncation introduces ripples (oscillations) in the
resulting frequency response characteristics (results of convolution).
14
>> n=0:20;
>> omega=pi/4; % This is the cut-off frequency
>> h=(omega/pi)*sinc(omega*(n-10)/pi); % Note the 10 step shift
>> stem(n,h)
>> title('Sample-Shifted LP Impulse Response')
>> xlabel('n')
>> ylabel('h[n]')
>> fvtool(h,1)
0 2 4 6 8 10 12 14 16 18 20
-0.1
-0.05
0
0.05
0.1
0.15
0.2
0.25
Sample-Shifted LP Impulse Response
n
h[n]
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
0
0.2
0.4
0.6
0.8
1
1.2
1.4
Normalized Frequency ( rad/sample)
Magnitude
Magnitude Response
Note the linear phase properties of
the impulse response
Example: 21 Coefficient LP Filter with Ω0 = π/4
>> n=0:200; % This sets the order of the filter where length(n)=201
>> omega=pi/4;
>> h=(omega/pi)*sinc((n-100)*omega/pi); %Note the sample shift of 100 samples
>> fvtool(h,1)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
0
0.2
0.4
0.6
0.8
1
1.2
1.4
Normalized Frequency ( rad/sample)
Magnitude
Magnitude Response
Higher order = sharper
transition
Side-lobe “ripple” (Gibbs
phenomenon) due to
abrupt truncation of the
impulse response
Example: 201 Coefficient LP Filter with Ω0 = π/4
How to reduce the Gibbs phenomenon?
1) using a window that tapers smoothly
to zero at each end.
2) providing a smooth transition from
the passband to the stopband.
17
Windowing in Frequency Domain
 Windowed frequency response
 The windowed version is smeared version of desired response
 If w[n]=1 for all n, then W(ej) is pulse train with 2 period
     
  





deWeHeH jj
d
j 


2
1
18
Properties of Windows
 Prefer windows that concentrate around DC in frequency
 Less smearing, closer approximation
 Prefer window that has minimal span in time
 Less coefficient in designed filter, computationally efficient
 So we want concentration in time and in frequency
 Contradictory requirements
 Example: Rectangular window
 
 
  
 2/sin
2/1sin
1
1 2/
1
0 



 



 





M
e
e
e
eeW Mj
j
MjM
n
njj
Window Parameters
 Two important parameters:
 Main lobe width.
 Relative side lobe level.
 The effect of window function on FIR filter
design
 The window have a small main lobe width will
ensure a fast transition from the passband to
the stopband.
 The area under the side lobes small will reduce
the ripple.
19
0 0.5 1 1.5 2 2.5 3
-120
-100
-80
-60
-40
-20
0
20
0 0.5 1 1.5 2 2.5 3
-120
-100
-80
-60
-40
-20
0
20

attenuation
transition
region
-100 -50 0 50 100
-0.1
-0.05
0
0.05
0.1
0.15
0.2
0.25
L L
)(nhw
n
with = +
20
Rectangular Window
 


 

else0
Mn01
nw
 Narrowest main lob
 4/(M+1)
 Sharpest transitions at discontinuities in
frequency
 Large side lobs
 -13 dB
 Large oscillation around discontinuities
 Simplest window possible
21
Bartlett (Triangular) Window
 








else0
Mn2/MM/n22
2/Mn0M/n2
nw
 Medium main lob
 8/M
 Side lobs
 -25 dB
 Hamming window performs better
 Simple equation
22
Hanning Window
 
















 


else0
Mn0
M
n2
cos1
2
1
nw
 Medium main lob
 8/M
 Side lobs
 -31 dB
 Hamming window performs better
 Same complexity as Hamming
23
Hamming Window
 Medium main lob
 8/M
 Side lobs
 -41 dB
 Simpler than Blackman
 









 


else0
Mn0
M
n2
cos46.054.0
nw
24
Blackman Window
 









 





 


else0
Mn0
M
n4
cos08.0
M
n2
cos5.042.0
nw
 Large main lob
 12/M
 Very good side lobs
 -57 dB
 Complex equation
Example of Design of an FIR filter using Windows
 Specifications:
 Pass Band = 0 - 4 kHz
 Stop Band > 5kHz with attenuation of at least 40dB
 Sampling Frequency = 20kHz
 Step 1: translate specifications into digital frequency
 Pass Band
 Stop Band
 Step 2: from pass band, determine ideal filter impulse
response
25
2 5 20 2  / /  rad
0 2 4 20 2 5  / / rad
h n nd
c c
( ) 





 










sinc sinc
2n
5
2
5
 40dB
F kHz54 10

2
2
5




10
Example of Design of an FIR filter using Windows
 Step 3: from desired attenuation choose the window.
 In this case we can choose the hamming window;
 Step 4: from the transition region choose the length N of the impulse response.
Choose an odd number N such that:
 So choose N = 81 which yields the shift L=40.
 Finally the impulse response of the filter
26
8
10
 
N

h n
n
n
( )
. . cos , ,






 











  





2
5
054 046
2
80
0 80sinc
2(n -40)
5
if
0 otherwise

Example of Design of an FIR filter using Windows
 The Frequency Response of the Filter:
27


H( )
 H( )
dB
rad
Design Example: 201 Coefficient HP with Ω0 = 3π/4
>> n=0:200;
>> omega=3*pi/4;
>> h=sinc(n-100)-(omega/pi)*sinc(omega*(n-100)/pi); % Both terms shifted by 100
% samples
>> hw=h.*blackman(201)';
>> fvtool(hw,1)
28
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
-200
-150
-100
-50
0
50
Normalized Frequency ( rad/sample)
Magnitude(dB)
Magnitude Response (dB)
The Blackman tapering
window provides greater
suppression of stop-band
side-lobes
Kaiser Window (A Parametrized Window)
 All the windows discussed so far can be
approximated by an equivalent Kaiser
window.
 Parameterized equation forming a set of
windows
 Parameter to change main-lob width,
 and side-lob area trade-off.
 I0(.) represents zero-th order modified Bessel
function of first kind.
  represent the shape parameter coefficient.
29
 
 






















 


else0
Mn0
I
2/M
2/Mn
1I
nw
0
2
0
Kaiser Window Filter Design Method
 Parameterized equation forming a set of windows
 Parameter to change main-lob width,
 and side-lob area trade-off.
 where
 I0(.) represents zero-th order modified Bessel function of first kind.
30
 
 






















 


else0
Mn0
I
2/M
2/Mn
1I
nw
0
2
0





2
0
cos
.
2
1
)( dexI x
o 

 














1
2
2!
1
1)(
k
k
o
x
k
xI
Design guidelines using Kaiser windows
 Assume a low pass filter.
 Given that Kaiser windows have linear phase, we will only focus on the
function in the approximation filter
 Normalize to unity for , where is the cutoff frequency of
the ideal low pass filter.
 Specify in terms of
 a passband frequency ,
 a stop band frequency ,
 a maximum passband distortion of ,
 and a maximum stopband distortion of ,
 The cutoff frequency of the ideal low pass filter is midway between and
 and should be equal, because of the nature of windowing.
31
)( jw
eA)( jw
eH
)( jw
eH c 0 c
)( jw
eA
p
s
1
2
c p s
1 2
Design guidelines using Kaiser windows
 Let
 and
 The shape parameter  should be
 The filter order M is determined approximately by
32
ps  
21  
10log20A
 
   









210
50212107886.0215842.0
507.81102.0
4.0
A
AAA
AA




285.2
8A
M
33
Example: Kaiser Window Design of a Lowpass Filter
 Example: Determine , , , when
 Solution:
 Cutoff frequency,
 Since, , this means
 Since, , and
 Then the impulse response is given as
001.0,6.0,4.0 21   sp


 5.0
2


 ps
c
 2.0ps
60log20 10  A 653.5)7.860(1102.0 
3722.36
2.0285.2
860





M
    
   





















 



else
Mn
I
n
I
n
nnh
0
0
653.5
5.18
5.18
1653.5
.
5.18
5.185.0sin
0
2
0


c  M
60log20A 10 
34
General Frequency Selective Filters
 A general multiband impulse response can be written as
 Window methods can be applied to multiband filters
 Example multiband frequency response
 Special cases of
• Bandpass
• Highpass
• Bandstop
     
 




mbN
1k
k
1kkmb
2/Mn
2/Mnsin
GGnh
Frequency Sampling Method
35
FIR Filter Design (Frequency Sampling Method)
 In this approach we are given and need to find
 This is an interpolation problem and the solution is given in the DFT
part of the course
 It has similar problems to the windowing approach
36





 
1
0 1
2
.1
1
).(
1
)(
N
k k
N
j
N
ze
z
kH
N
zH 
)(kH )(zH
37

More Related Content

PDF
DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems
PDF
DSP_FOEHU - Lec 11 - IIR Filter Design
PDF
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
PPTX
Spread spectrum
PDF
DSP_2018_FOEHU - Lec 04 - The z-Transform
PDF
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
PPTX
Angle Modulation
PDF
DSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and Systems
DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems
DSP_FOEHU - Lec 11 - IIR Filter Design
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
Spread spectrum
DSP_2018_FOEHU - Lec 04 - The z-Transform
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
Angle Modulation
DSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and Systems

What's hot (20)

PPTX
Fourier transforms
PPTX
High pass-low-pass-filter
PDF
Basics of Digital Filters
PPTX
Butterworth filter
PPT
Filter- IIR - Digital signal processing(DSP)
PDF
Sampling Theorem
PPTX
Fir filter design (windowing technique)
PDF
DSP_2018_FOEHU - Lec 07 - IIR Filter Design
PPTX
Properties of fourier transform
PPT
Fourier transform
PDF
Design of FIR filters
PDF
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier Transform
PPTX
Radix-2 DIT FFT
PPT
Fir and iir filter_design
PPSX
Multirate digital signal processing
PPTX
Windowing techniques of fir filter design
PPTX
5. convolution and correlation of discrete time signals
PPTX
Design of Filters PPT
PDF
DSP_2018_FOEHU - Lec 06 - FIR Filter Design
PPTX
Properties of dft
Fourier transforms
High pass-low-pass-filter
Basics of Digital Filters
Butterworth filter
Filter- IIR - Digital signal processing(DSP)
Sampling Theorem
Fir filter design (windowing technique)
DSP_2018_FOEHU - Lec 07 - IIR Filter Design
Properties of fourier transform
Fourier transform
Design of FIR filters
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier Transform
Radix-2 DIT FFT
Fir and iir filter_design
Multirate digital signal processing
Windowing techniques of fir filter design
5. convolution and correlation of discrete time signals
Design of Filters PPT
DSP_2018_FOEHU - Lec 06 - FIR Filter Design
Properties of dft
Ad

Viewers also liked (9)

PDF
Modern Control - Lec07 - State Space Modeling of LTI Systems
PDF
Modern Control - Lec 04 - Analysis and Design of Control Systems using Root L...
PDF
DSP_FOEHU - MATLAB 03 - The z-Transform
PDF
Modern Control - Lec 05 - Analysis and Design of Control Systems using Freque...
PDF
SE2_Lec 22_Software Configuration Management
PDF
SE18_Lec 09_UML Use Cases
PDF
DSP_FOEHU - Lec 13 - Digital Signal Processing Applications I
PDF
Modern Control - Lec 04 - Analysis and Design of Control Systems using Root L...
PDF
Modern Control - Lec 06 - PID Tuning
Modern Control - Lec07 - State Space Modeling of LTI Systems
Modern Control - Lec 04 - Analysis and Design of Control Systems using Root L...
DSP_FOEHU - MATLAB 03 - The z-Transform
Modern Control - Lec 05 - Analysis and Design of Control Systems using Freque...
SE2_Lec 22_Software Configuration Management
SE18_Lec 09_UML Use Cases
DSP_FOEHU - Lec 13 - Digital Signal Processing Applications I
Modern Control - Lec 04 - Analysis and Design of Control Systems using Root L...
Modern Control - Lec 06 - PID Tuning
Ad

Similar to DSP_FOEHU - Lec 10 - FIR Filter Design (20)

PPTX
FIR Filters Lecture (What are FIR FIlters)pptx
PPTX
Design of digital filters
PDF
Paper id 252014114
PPT
PDF
Dsp book ch15
PDF
DSP_FOEHU - Lec 07 - Digital Filters
PPTX
Dss
PDF
Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...
DOCX
digital filter design
PPT
Fir filter_utkarsh_kulshrestha
DOCX
Content beyond syllabus power electronics
PDF
Design Technique of Bandpass FIR filter using Various Window Function
PDF
Design Technique of Bandpass FIR filter using Various Window Function
PDF
Signal Processing
PDF
Advantages of blackman window over hamming window method for designing fir fi...
DOCX
dsp module 4 pptpptrpppptxppppppppp.docx
PPT
Digital Filters Part 1
PPTX
9-MC Modulation and OFDM.pptx9-MC Modulation and OFDM.pptx9-MC Modulation and...
FIR Filters Lecture (What are FIR FIlters)pptx
Design of digital filters
Paper id 252014114
Dsp book ch15
DSP_FOEHU - Lec 07 - Digital Filters
Dss
Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...
digital filter design
Fir filter_utkarsh_kulshrestha
Content beyond syllabus power electronics
Design Technique of Bandpass FIR filter using Various Window Function
Design Technique of Bandpass FIR filter using Various Window Function
Signal Processing
Advantages of blackman window over hamming window method for designing fir fi...
dsp module 4 pptpptrpppptxppppppppp.docx
Digital Filters Part 1
9-MC Modulation and OFDM.pptx9-MC Modulation and OFDM.pptx9-MC Modulation and...

More from Amr E. Mohamed (20)

PDF
Dsp 2018 foehu - lec 10 - multi-rate digital signal processing
PDF
Dcs lec03 - z-analysis of discrete time control systems
PDF
Dcs lec02 - z-transform
PDF
Dcs lec01 - introduction to discrete-time control systems
PDF
DDSP_2018_FOEHU - Lec 10 - Digital Signal Processing Applications
PDF
SE2018_Lec 17_ Coding
PDF
SE2018_Lec-22_-Continuous-Integration-Tools
PDF
SE2018_Lec 21_ Software Configuration Management (SCM)
PDF
SE2018_Lec 18_ Design Principles and Design Patterns
PDF
Selenium - Introduction
PPTX
SE2018_Lec 20_ Test-Driven Development (TDD)
PDF
SE2018_Lec 19_ Software Testing
PDF
DSP_2018_FOEHU - Lec 05 - Digital Filters
PDF
SE2018_Lec 15_ Software Design
PDF
DSP_2018_FOEHU - Lec 1 - Introduction to Digital Signal Processing
PDF
DSP_2018_FOEHU - Lec 0 - Course Outlines
PDF
SE2018_Lec 14_ Process Modeling and Data Flow Diagram.pptx
PDF
SE18_Lec 13_ Project Planning
PDF
SE18_SE_Lec 12_ Project Management 1
PDF
SE18_Lec 10_ UML Behaviour and Interaction Diagrams
Dsp 2018 foehu - lec 10 - multi-rate digital signal processing
Dcs lec03 - z-analysis of discrete time control systems
Dcs lec02 - z-transform
Dcs lec01 - introduction to discrete-time control systems
DDSP_2018_FOEHU - Lec 10 - Digital Signal Processing Applications
SE2018_Lec 17_ Coding
SE2018_Lec-22_-Continuous-Integration-Tools
SE2018_Lec 21_ Software Configuration Management (SCM)
SE2018_Lec 18_ Design Principles and Design Patterns
Selenium - Introduction
SE2018_Lec 20_ Test-Driven Development (TDD)
SE2018_Lec 19_ Software Testing
DSP_2018_FOEHU - Lec 05 - Digital Filters
SE2018_Lec 15_ Software Design
DSP_2018_FOEHU - Lec 1 - Introduction to Digital Signal Processing
DSP_2018_FOEHU - Lec 0 - Course Outlines
SE2018_Lec 14_ Process Modeling and Data Flow Diagram.pptx
SE18_Lec 13_ Project Planning
SE18_SE_Lec 12_ Project Management 1
SE18_Lec 10_ UML Behaviour and Interaction Diagrams

Recently uploaded (20)

PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
Visual Aids for Exploratory Data Analysis.pdf
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPT
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PPTX
UNIT - 3 Total quality Management .pptx
PPTX
introduction to high performance computing
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PPT
Occupational Health and Safety Management System
PPTX
Current and future trends in Computer Vision.pptx
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PDF
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PPTX
communication and presentation skills 01
PDF
Integrating Fractal Dimension and Time Series Analysis for Optimized Hyperspe...
Fundamentals of safety and accident prevention -final (1).pptx
Categorization of Factors Affecting Classification Algorithms Selection
Safety Seminar civil to be ensured for safe working.
Visual Aids for Exploratory Data Analysis.pdf
Automation-in-Manufacturing-Chapter-Introduction.pdf
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
Exploratory_Data_Analysis_Fundamentals.pdf
UNIT - 3 Total quality Management .pptx
introduction to high performance computing
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Occupational Health and Safety Management System
Current and future trends in Computer Vision.pptx
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
III.4.1.2_The_Space_Environment.p pdffdf
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
communication and presentation skills 01
Integrating Fractal Dimension and Time Series Analysis for Optimized Hyperspe...

DSP_FOEHU - Lec 10 - FIR Filter Design

  • 2. Ideal Filters  One of the reasons why we design a filter is to remove disturbances  We discriminate between signal and noise in terms of the frequency spectrum 2  )(ns )(nv )(nx )()( nsny Filter SIGNAL NOISE F )(FS )(FV 0F0F 0F F )(FY 0F0F
  • 3. Conditions for Non-Distortion  Problem: ideally we do not want the filter to distort the signal we want to recover.  Consequence on the Frequency Response: 3 IDEAL FILTER )()( tstx  )()( TtAsty  Same shape as s(t), just scaled and delayed. 0 200 400 600 800 1000 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 0 200 400 600 800 1000 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 0 200 400 600 800 1000 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 0 200 400 600 800 1000 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2      otherwise passbandtheinisFifAe FH FTj 0 )( 2 F F |)(| FH )(FH constant linear
  • 4. Phase Distortion  Phase distortion results from a variable time delay (phase delay) for different frequency components of a signal.  If the phase response of a filter is a linear function of frequency, then the phase delay is constant for all frequencies and no phase distortion occurs. 4
  • 5. Real Time Implementation  For real time implementation we also want the filter to be causal, ie.  FACT (Bad News!): by the Paley-Wiener Theorem, if h(n) is causal and with finite energy,  ie ( ) cannot be zero on an interval, therefore it cannot be ideal. 5 0for0)(  nnh        h n( ) n   since     0 )()()( k knxkhny  onlyspast value        dH )(ln )(H    dHH )(log)0log()(log 1 2 1 2
  • 6. Practical Filter specifications  Filters  Frequency-selective Filter  Three Stages  Specifications  Approximation of the Specifications.  Realization 6  |)(| H p IDEAL
  • 7. Practical Filter specifications  In practical design the following parameters would be specified:  The maximum ripple allowed in the pass-band:  The maximum ripple allowed in the stop-band:  The pass-band edge frequency:  The stop-band edge frequency:  The order of the FIR or IIR filter. 7 p s p s
  • 8. Selection of Digital Filters (FIR & IIR)  Finite Impulse Response (FIR) filter  always stable,  the phase can be made exactly linear,  we can approximate any filter we want.  Higher order w.r.t IIR filter (we need a lot of coefficients (N large) for good performance)  Infinite Impulse Response (IIR) filter  very selective with a few coefficients  Always Nonlinear Phase. 8
  • 9. Design of FIR Filters  Design means calculation (determination) of the coefficients of the difference equation or the transfer function.  Methods of FIR Filter Design:  Window Method  Frequency sampling method. 9   M k knxkhny 0 )()()(    M k k zkhzH 0 )()(
  • 11. 11 Design of FIR Filters (Window Method)  Simplest way of designing FIR filters  Method is all discrete-time no continuous-time involved  Start with ideal frequency response  Choose ideal frequency response as desired response  Most ideal impulse responses are of infinite length  The easiest way to obtain a causal FIR filter from ideal is by evaluating the IDTFT of         n nj d j d enheH           deeHnh njj dd   2 1  j d eH
  • 12. 12 Design of FIR Filters (Window Method)  In general, the obtained impulse response is infinite in duration and must be truncated at some point say at: = to give an FIR filter of length M. Truncation of to a length M is equivalent to multiplying by a rectangular window defined as:  Thus, the impulse response of the FIR filter becomes :          else Mnnh nh d 0 0              else Mn nwnwnhnh d 0 01 where  nhd  nhd
  • 13. 13
  • 14. Effect of the Window Size  As the width of the window increases, its spectrum will be sharper and the resulting convolution will be near ideal.  The rectangular window truncates the impulse response to be of duration . But this truncation introduces ripples (oscillations) in the resulting frequency response characteristics (results of convolution). 14
  • 15. >> n=0:20; >> omega=pi/4; % This is the cut-off frequency >> h=(omega/pi)*sinc(omega*(n-10)/pi); % Note the 10 step shift >> stem(n,h) >> title('Sample-Shifted LP Impulse Response') >> xlabel('n') >> ylabel('h[n]') >> fvtool(h,1) 0 2 4 6 8 10 12 14 16 18 20 -0.1 -0.05 0 0.05 0.1 0.15 0.2 0.25 Sample-Shifted LP Impulse Response n h[n] 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0 0.2 0.4 0.6 0.8 1 1.2 1.4 Normalized Frequency ( rad/sample) Magnitude Magnitude Response Note the linear phase properties of the impulse response Example: 21 Coefficient LP Filter with Ω0 = π/4
  • 16. >> n=0:200; % This sets the order of the filter where length(n)=201 >> omega=pi/4; >> h=(omega/pi)*sinc((n-100)*omega/pi); %Note the sample shift of 100 samples >> fvtool(h,1) 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0 0.2 0.4 0.6 0.8 1 1.2 1.4 Normalized Frequency ( rad/sample) Magnitude Magnitude Response Higher order = sharper transition Side-lobe “ripple” (Gibbs phenomenon) due to abrupt truncation of the impulse response Example: 201 Coefficient LP Filter with Ω0 = π/4 How to reduce the Gibbs phenomenon? 1) using a window that tapers smoothly to zero at each end. 2) providing a smooth transition from the passband to the stopband.
  • 17. 17 Windowing in Frequency Domain  Windowed frequency response  The windowed version is smeared version of desired response  If w[n]=1 for all n, then W(ej) is pulse train with 2 period               deWeHeH jj d j    2 1
  • 18. 18 Properties of Windows  Prefer windows that concentrate around DC in frequency  Less smearing, closer approximation  Prefer window that has minimal span in time  Less coefficient in designed filter, computationally efficient  So we want concentration in time and in frequency  Contradictory requirements  Example: Rectangular window         2/sin 2/1sin 1 1 2/ 1 0                 M e e e eeW Mj j MjM n njj
  • 19. Window Parameters  Two important parameters:  Main lobe width.  Relative side lobe level.  The effect of window function on FIR filter design  The window have a small main lobe width will ensure a fast transition from the passband to the stopband.  The area under the side lobes small will reduce the ripple. 19 0 0.5 1 1.5 2 2.5 3 -120 -100 -80 -60 -40 -20 0 20 0 0.5 1 1.5 2 2.5 3 -120 -100 -80 -60 -40 -20 0 20  attenuation transition region -100 -50 0 50 100 -0.1 -0.05 0 0.05 0.1 0.15 0.2 0.25 L L )(nhw n with = +
  • 20. 20 Rectangular Window        else0 Mn01 nw  Narrowest main lob  4/(M+1)  Sharpest transitions at discontinuities in frequency  Large side lobs  -13 dB  Large oscillation around discontinuities  Simplest window possible
  • 21. 21 Bartlett (Triangular) Window           else0 Mn2/MM/n22 2/Mn0M/n2 nw  Medium main lob  8/M  Side lobs  -25 dB  Hamming window performs better  Simple equation
  • 22. 22 Hanning Window                       else0 Mn0 M n2 cos1 2 1 nw  Medium main lob  8/M  Side lobs  -31 dB  Hamming window performs better  Same complexity as Hamming
  • 23. 23 Hamming Window  Medium main lob  8/M  Side lobs  -41 dB  Simpler than Blackman                else0 Mn0 M n2 cos46.054.0 nw
  • 24. 24 Blackman Window                       else0 Mn0 M n4 cos08.0 M n2 cos5.042.0 nw  Large main lob  12/M  Very good side lobs  -57 dB  Complex equation
  • 25. Example of Design of an FIR filter using Windows  Specifications:  Pass Band = 0 - 4 kHz  Stop Band > 5kHz with attenuation of at least 40dB  Sampling Frequency = 20kHz  Step 1: translate specifications into digital frequency  Pass Band  Stop Band  Step 2: from pass band, determine ideal filter impulse response 25 2 5 20 2  / /  rad 0 2 4 20 2 5  / / rad h n nd c c ( )                   sinc sinc 2n 5 2 5  40dB F kHz54 10  2 2 5     10
  • 26. Example of Design of an FIR filter using Windows  Step 3: from desired attenuation choose the window.  In this case we can choose the hamming window;  Step 4: from the transition region choose the length N of the impulse response. Choose an odd number N such that:  So choose N = 81 which yields the shift L=40.  Finally the impulse response of the filter 26 8 10   N  h n n n ( ) . . cos , ,                            2 5 054 046 2 80 0 80sinc 2(n -40) 5 if 0 otherwise 
  • 27. Example of Design of an FIR filter using Windows  The Frequency Response of the Filter: 27   H( )  H( ) dB rad
  • 28. Design Example: 201 Coefficient HP with Ω0 = 3π/4 >> n=0:200; >> omega=3*pi/4; >> h=sinc(n-100)-(omega/pi)*sinc(omega*(n-100)/pi); % Both terms shifted by 100 % samples >> hw=h.*blackman(201)'; >> fvtool(hw,1) 28 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 -200 -150 -100 -50 0 50 Normalized Frequency ( rad/sample) Magnitude(dB) Magnitude Response (dB) The Blackman tapering window provides greater suppression of stop-band side-lobes
  • 29. Kaiser Window (A Parametrized Window)  All the windows discussed so far can be approximated by an equivalent Kaiser window.  Parameterized equation forming a set of windows  Parameter to change main-lob width,  and side-lob area trade-off.  I0(.) represents zero-th order modified Bessel function of first kind.   represent the shape parameter coefficient. 29                               else0 Mn0 I 2/M 2/Mn 1I nw 0 2 0
  • 30. Kaiser Window Filter Design Method  Parameterized equation forming a set of windows  Parameter to change main-lob width,  and side-lob area trade-off.  where  I0(.) represents zero-th order modified Bessel function of first kind. 30                               else0 Mn0 I 2/M 2/Mn 1I nw 0 2 0      2 0 cos . 2 1 )( dexI x o                   1 2 2! 1 1)( k k o x k xI
  • 31. Design guidelines using Kaiser windows  Assume a low pass filter.  Given that Kaiser windows have linear phase, we will only focus on the function in the approximation filter  Normalize to unity for , where is the cutoff frequency of the ideal low pass filter.  Specify in terms of  a passband frequency ,  a stop band frequency ,  a maximum passband distortion of ,  and a maximum stopband distortion of ,  The cutoff frequency of the ideal low pass filter is midway between and  and should be equal, because of the nature of windowing. 31 )( jw eA)( jw eH )( jw eH c 0 c )( jw eA p s 1 2 c p s 1 2
  • 32. Design guidelines using Kaiser windows  Let  and  The shape parameter  should be  The filter order M is determined approximately by 32 ps   21   10log20A                210 50212107886.0215842.0 507.81102.0 4.0 A AAA AA     285.2 8A M
  • 33. 33 Example: Kaiser Window Design of a Lowpass Filter  Example: Determine , , , when  Solution:  Cutoff frequency,  Since, , this means  Since, , and  Then the impulse response is given as 001.0,6.0,4.0 21   sp    5.0 2    ps c  2.0ps 60log20 10  A 653.5)7.860(1102.0  3722.36 2.0285.2 860      M                                    else Mn I n I n nnh 0 0 653.5 5.18 5.18 1653.5 . 5.18 5.185.0sin 0 2 0   c  M 60log20A 10 
  • 34. 34 General Frequency Selective Filters  A general multiband impulse response can be written as  Window methods can be applied to multiband filters  Example multiband frequency response  Special cases of • Bandpass • Highpass • Bandstop             mbN 1k k 1kkmb 2/Mn 2/Mnsin GGnh
  • 36. FIR Filter Design (Frequency Sampling Method)  In this approach we are given and need to find  This is an interpolation problem and the solution is given in the DFT part of the course  It has similar problems to the windowing approach 36        1 0 1 2 .1 1 ).( 1 )( N k k N j N ze z kH N zH  )(kH )(zH
  • 37. 37