SlideShare a Scribd company logo
By
Imtiyaz Mohiuddin
10361A0434
In charge
Dr.M.Narayana
Electronics and Communications Engineering
SECTION OUTLINE:
 Introduction to Digital filter design
 Introduction to FIR Filter
 Design of FIR Filter using WINDOW Techniques
 Introduction to IIR Filter
 Design of IIR Filter using Approximation Method
 MATLAB Code of Designed Filters
Introduction:
 A digital filter is a system that performs mathematical
operations on a sampled, discrete-time signal to reduce or
enhance certain aspects of that signal.
 In digital signal processing, there are two important types
of systems:
 Digital filters: perform signal filtering in the time
domain
 Spectrum analyzers: provide signal representation in the
frequency domain
Digital Filter:
xn yn
Digital Filter
Sampling
frequency
fS
A
D
C
D
A
C
x(t) y(t)
Analog
anti-
aliasing
filter
Analog
smoothing
filter
Preliminaries:
 The design of a digital filter is carried out in three steps:
 Specifications: they are determined by the applications
 Approximations: once the specification are defined, we use various
concepts and mathematics that we studied so far to come up with a
filter description that approximates the given set of specifications.
(in detail)
 Implementation: The product of the above step is a filter
description in the form of either a difference equation, or a system
function H(z), or an impulse response h(n). From this description
we implement the filter in hardware or through software on a
computer.
Classification:
 Digital filters are classified into one of two basic forms,
according to how they respond to a unit impulse:
 Finite impulse response
 Infinite impulse response
Finite Impulse Response:
 In signal processing, a finite impulse response
(FIR) filter is a filter whose impulse response is
of finite duration, because it settles to zero in finite
time.
 FIR digital filters use only current and past input
samples, and none of the filter's previous output
samples, to obtain a current output sample value
The transfer function is given by
 The length of Impulse Response is N
 All poles are at Z=0. .
 Zeros can be placed anywhere on the z-plane




1
0
).()(
N
n
n
znhzH
Filter Design by Windowing
 Simplest way of designing FIR filters
 Start with ideal frequency response
 Choose ideal frequency response as desired response
 Most ideal impulse responses are of infinite length
   




n
nj
d
j
d enheH     

 



deeH
2
1
nh njj
dd
   


 

else0
Mn0nh
nh d
Rectangular:
Bartlett:
Hamming:
Blackman:
Kaiser:
2
1

N
nN
n2
1






N
n2
cos1






N
n2
cos46.054.0











N
n
N
n  4
cos08.0
2
cos5.042.0
)(
1
2
1 0
2
0  J
N
n
J
















Commonly used windows
Kaiser window
 Kaiser window
β Transition
width (Hz)
Min. stop attn
dB
2.12 1.5/N 30
4.54 2.9/N 50
6.76 4.3/N 70
8.96 5.7/N 90
Rectangular Window
 


 

else0
Mn01
nw
 Narrowest main lob
– 4/(M+1)
– Sharpest transitions at
discontinuities in frequency
 Large side lobs
– Large oscillation around
discontinuities
– -13 dB
Simplest window possible
Hamming Window
 









 


else0
Mn0
M
n2
cos46.054.0
nw
 Medium main lob
– 8/M
 Good side lobs
– -41 dB
– Simpler than
Blackman
Kaiser Window
 Parameterized equation forming a set
of windows
 Parameter to change main-lob width
and side-lob area trade-off
 I0(.) represents zeroth-order
modified Bessel function of 1st kind
 
 






















 


else0
Mn0
I
2/M
2/Mn
1I
nw
0
2
0
MATLAB CODE:
 %Design of LPF&HPF using rectangular,hamming and kaiser windows
 clc;clear all;close all;
 rp=input('enter attenuation in pass band');
 rs=input('enter attenuation in stop band');
 fp=input('enter pass band frequency');
 fs=input('enter stop band frequency');
 Fs=input('enter sampling frequency');
 wp=2*pi*fp/Fs;
 ws=2*pi*fs/Fs;
 %formula for FIR filter
 num=-20*log10(sqrt(rp*rs))-13;
 den=14.6*(fs-fp)/Fs;
 n=ceil(num/den);
 disp('order of filter is n');
 disp(n);
 disp('press any key to continue');
 pause;
 n1=n+1;
 %For even order
 if(rem(n,2)~=0)
 n1=n;
 end
 %LPF
 %LPF
 s1=input('enter the value for window 0-rectangularLPF 1-kaiserLPF 2-hammingLPF 3-
rectangularHPF 4-kaiserHPF 5-hammingHPF');
 switch(s1);
 case 0
 y=rectwin(n1);
 [b,a]=fir1(n,wp,'low',y);
 freqz(b,a,512);
 case 1
 y=kaiser(n1);
 [b,a]=fir1(n,wp,'low',y);
 freqz(b,a,512);
 case 2
 y=hamming(n1);
 [b,a]=fir1(n,wp,'low',y);
 freqz(b,a,512);
 case 3
 y=rectwin(n1);
 [b,a]=fir1(n,wp,'high',y);
 freqz(b,a,512);
 case 4
 y=kaiser(n1);
 [b,a]=fir1(n,wp,'high',y);
 freqz(b,a,512);
 case 5
 y=hamming(n1);
 [b,a]=fir1(n,wp,'high',y);
 freqz(b,a,512);
 end
Pros & Cons:
FIR filters have the following
advantages:
 Exactly linear phase is possible
 Always stable, even when quantized
 Design methods are generally linear
 Efficient hardware realizations
 Startup transients have finite
duration
FIR filters have the following
disadvantages:
• Higher filter order than IIR
filters
• Corresponding greater
delays
Infinite Impulse Response Filter:
 IIR systems have an impulse response function that is
non-zero over an infinite length of time. This is in
contrast to finite impulse response (FIR) filters, which
have fixed-duration impulse responses
 IIR filters may be implemented as
either analog or digital filters
Cont..
 While designing a digital IIR filter , an analog filter
(e.g. Chebyshev filter, Butterworth filter) is first
designed and then is converted to a digital filter by
applying discretization techniques such as Bilinear
transform or Impulse invariance.
Discretization techniques
Chebyshev Filter:
 Chebyshev filters are analog or digital filters having a
steeper roll-off and more passband ripple (type I) or
stopband ripple (type II)
 Chebyshev filters have the property that they
minimize the error between the idealized and the
actual filter characteristic over the range of the filter,
but with ripples in the passband
Cont..
 Type-1 Chebyshev Filter
 Type-2 Chebyshev Filter:
Butterworth filter
 The Butterworth filter is a type of signal processing
filter designed to have as flat a frequency response as
possible in the pass band. It is also referred to as a
maximally flat magnitude filter
MATLAB Prototype Filter Design Commands
 [B,A] = BUTTER(N,Wn)
 [B,A] = CHEBY1(N,R,Wn)
 [B,A] = CHEBY2(N,R,Wn)
 [B,A] = ELLIP(N,Rp,Rs,Wn)
– N = filter order
– R = pass band ripple (cheby1) or stop-band ripple (cheby2) in
dB. (Rp and Rs respectively for the elliptic filter)
– Wn = cut-off frequency (radians/sec for analog filters or
normalized digital frequencies for digital filters)
– [B,A] = filter coefficients, s-domain (analog filter) or z-domain
(digital filter)
Design Example
 Filter Specifications:
 Butterworth response
 Pass-band edges = 400 Hz and 600 Hz
 Stop-band edges = 300 Hz and 700 Hz
 Pass-band ripple = 1 dB
 Stop-band attenuation = -20 dB
 Sampling Frequency = 2000 Hz
Design Example Results
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
Frequency (kHz)
Magnitude
Magnitude Response
Band Edges
(-1dB and -20 dB)
Design Example
Chebyshev II High-Pass Filter
 Filter specifications:
 Chebyshev II response (stop-band ripple)
 Pass-band edge = 1000 Hz
 Stop-band edge = 900 Hz
 Pass-band ripple = 1 dB
 Stop-band attenuation = -40 dB
 Sampling frequency = 8 kHz
MATLAB Code for Design Example
>> fs=8000;
>> Wp=[2*1000/fs]; % Pass-band edge normalized digital frequency
>> Ws=[2*900/fs]; % Stop-band edge normalized digital frequency
>> [N,Wn]=cheb2ord(Wp,Ws,1,40); % The “order” command
>> [B,A]=cheby2(N,40,Wn,'high');
% cheby2 is the “filter” command. In this command
% the syntax requires the stop-band attenuation
% as the second parameter
>> fvtool(B,A)
Design Example Results
0 0.5 1 1.5 2 2.5 3 3.5
-100
-80
-60
-40
-20
0
20
Frequency (kHz)
Magnitude(dB)
Magnitude Response (dB)
MATLAB CODE:
 %Design of IIR filters
 fp1=input('enter pass band frequency');
 fs1=input('enter stop band frequency');
 Fs1=input('enter sampling frequency');
 wp1=fp1/Fs1;
 ws1=fs1/Fs1;
 [n1,wn1]=buttord(wp1,ws1,2,60);
 [x,y]=butter(n1,wn1,'low');
 figure;
 freqz(x,y,512);
 [n1,wn1]=buttord(wp1,ws1,2,60);
 [x,y]=butter(n1,wn1,'high');
 figure;
 freqz(x,y,512);
 [n1,wn1]=cheb1ord(wp1,ws1,2,60);
 [x,y]=cheby1(n1,3,wn1,'low');
 figure;
 freqz(x,y,512);
 [n1,wn1]=cheb1ord(wp1,ws1,2,60);
 [x,y]=cheby1(n1,3,wn1,'high');
 figure;
 freqz(x,y,512);
Summary of IIR Filter:
 IIR filters can be design by pole-zero location
– Digital oscillators: poles on the unit circle
– Notch filters: zeros on the unit circle with nearby poles to
control notch width
 Classic analog filters can be designed using the
bilinear transformation
 IIR filters have the advantage of smaller filter order for
a given frequency response.
 IIR filters have the disadvantages of possible instability
due to coefficient quantization effects and non-linear
phase response.
References:
 “Design of IIR Filter” by K.S Chandra, M.Tech, IIT-Bombay, Jan-2006
 “Digital Filter Design” by Prof. A.G. Constantinides, University of
Auckland, 2006
 “FIR Filter Design”, Gao Xinbo,School of E.E., Xidian Univ.
xbgao@ieee.org
 “FIR Filter by Windowing”- The lab Book Pages.com
 “Digital Signal Processing”, Prof.Ramesh Babu, Pondicherry Govt.
College, TataMcgraw-Hill publication.
 Wikipedia.org
Design of Filters PPT

More Related Content

What's hot

Butterworth filter design
Butterworth filter designButterworth filter design
Butterworth filter designSushant Shankar
 
Pulse modulation
Pulse modulationPulse modulation
Pulse modulation
stk_gpg
 
Multirate DSP
Multirate DSPMultirate DSP
Multirate DSP
@zenafaris91
 
Design of FIR Filters
Design of FIR FiltersDesign of FIR Filters
Design of FIR Filters
Aranya Sarkar
 
DSP_FOEHU - Lec 10 - FIR Filter Design
DSP_FOEHU - Lec 10 - FIR Filter DesignDSP_FOEHU - Lec 10 - FIR Filter Design
DSP_FOEHU - Lec 10 - FIR Filter Design
Amr E. Mohamed
 
IIR filter design, Digital signal processing
IIR filter design, Digital signal processingIIR filter design, Digital signal processing
IIR filter design, Digital signal processing
Abhishek Thakkar
 
Discrete-Time Signal Processing
Discrete-Time Signal ProcessingDiscrete-Time Signal Processing
Discrete-Time Signal Processing
lancer350
 
DSP_2018_FOEHU - Lec 07 - IIR Filter Design
DSP_2018_FOEHU - Lec 07 - IIR Filter DesignDSP_2018_FOEHU - Lec 07 - IIR Filter Design
DSP_2018_FOEHU - Lec 07 - IIR Filter Design
Amr E. Mohamed
 
FILTER DESIGN
FILTER DESIGNFILTER DESIGN
FILTER DESIGN
naimish12
 
Sampling Theorem
Sampling TheoremSampling Theorem
Sampling Theorem
Dr Naim R Kidwai
 
DSP_FOEHU - Lec 07 - Digital Filters
DSP_FOEHU - Lec 07 - Digital FiltersDSP_FOEHU - Lec 07 - Digital Filters
DSP_FOEHU - Lec 07 - Digital Filters
Amr E. Mohamed
 
Digital modulation techniques...
Digital modulation techniques...Digital modulation techniques...
Digital modulation techniques...
Nidhi Baranwal
 
Circular convolution Using DFT Matlab Code
Circular convolution Using DFT Matlab CodeCircular convolution Using DFT Matlab Code
Circular convolution Using DFT Matlab Code
Bharti Airtel Ltd.
 
Pulse Modulation ppt
Pulse Modulation pptPulse Modulation ppt
Pulse Modulation ppt
sanjeev2419
 
Discrete Fourier Transform
Discrete Fourier TransformDiscrete Fourier Transform
Discrete Fourier Transform
Abhishek Choksi
 
Decimation in time and frequency
Decimation in time and frequencyDecimation in time and frequency
Decimation in time and frequency
SARITHA REDDY
 
Windowing techniques of fir filter design
Windowing techniques of fir filter designWindowing techniques of fir filter design
Windowing techniques of fir filter design
Rohan Nagpal
 
Decimation and Interpolation
Decimation and InterpolationDecimation and Interpolation
Decimation and Interpolation
Fernando Ojeda
 
DSP_FOEHU - Lec 11 - IIR Filter Design
DSP_FOEHU - Lec 11 - IIR Filter DesignDSP_FOEHU - Lec 11 - IIR Filter Design
DSP_FOEHU - Lec 11 - IIR Filter Design
Amr E. Mohamed
 
Multirate digital signal processing
Multirate digital signal processingMultirate digital signal processing
Multirate digital signal processing
MOHAN MOHAN
 

What's hot (20)

Butterworth filter design
Butterworth filter designButterworth filter design
Butterworth filter design
 
Pulse modulation
Pulse modulationPulse modulation
Pulse modulation
 
Multirate DSP
Multirate DSPMultirate DSP
Multirate DSP
 
Design of FIR Filters
Design of FIR FiltersDesign of FIR Filters
Design of FIR Filters
 
DSP_FOEHU - Lec 10 - FIR Filter Design
DSP_FOEHU - Lec 10 - FIR Filter DesignDSP_FOEHU - Lec 10 - FIR Filter Design
DSP_FOEHU - Lec 10 - FIR Filter Design
 
IIR filter design, Digital signal processing
IIR filter design, Digital signal processingIIR filter design, Digital signal processing
IIR filter design, Digital signal processing
 
Discrete-Time Signal Processing
Discrete-Time Signal ProcessingDiscrete-Time Signal Processing
Discrete-Time Signal Processing
 
DSP_2018_FOEHU - Lec 07 - IIR Filter Design
DSP_2018_FOEHU - Lec 07 - IIR Filter DesignDSP_2018_FOEHU - Lec 07 - IIR Filter Design
DSP_2018_FOEHU - Lec 07 - IIR Filter Design
 
FILTER DESIGN
FILTER DESIGNFILTER DESIGN
FILTER DESIGN
 
Sampling Theorem
Sampling TheoremSampling Theorem
Sampling Theorem
 
DSP_FOEHU - Lec 07 - Digital Filters
DSP_FOEHU - Lec 07 - Digital FiltersDSP_FOEHU - Lec 07 - Digital Filters
DSP_FOEHU - Lec 07 - Digital Filters
 
Digital modulation techniques...
Digital modulation techniques...Digital modulation techniques...
Digital modulation techniques...
 
Circular convolution Using DFT Matlab Code
Circular convolution Using DFT Matlab CodeCircular convolution Using DFT Matlab Code
Circular convolution Using DFT Matlab Code
 
Pulse Modulation ppt
Pulse Modulation pptPulse Modulation ppt
Pulse Modulation ppt
 
Discrete Fourier Transform
Discrete Fourier TransformDiscrete Fourier Transform
Discrete Fourier Transform
 
Decimation in time and frequency
Decimation in time and frequencyDecimation in time and frequency
Decimation in time and frequency
 
Windowing techniques of fir filter design
Windowing techniques of fir filter designWindowing techniques of fir filter design
Windowing techniques of fir filter design
 
Decimation and Interpolation
Decimation and InterpolationDecimation and Interpolation
Decimation and Interpolation
 
DSP_FOEHU - Lec 11 - IIR Filter Design
DSP_FOEHU - Lec 11 - IIR Filter DesignDSP_FOEHU - Lec 11 - IIR Filter Design
DSP_FOEHU - Lec 11 - IIR Filter Design
 
Multirate digital signal processing
Multirate digital signal processingMultirate digital signal processing
Multirate digital signal processing
 

Similar to Design of Filters PPT

1 digital filters (fir)
1 digital filters (fir)1 digital filters (fir)
1 digital filters (fir)
Ahmed A. Thabit
 
Dss
Dss Dss
Dss
nil65
 
01analog filters
01analog filters01analog filters
01analog filters
LingalaSowjanya
 
Digital Filters Part 1
Digital Filters Part 1Digital Filters Part 1
Digital Filters Part 1
Premier Farnell
 
Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...
Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...
Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...
Rohde & Schwarz North America
 
DSP_2018_FOEHU - Lec 06 - FIR Filter Design
DSP_2018_FOEHU - Lec 06 - FIR Filter DesignDSP_2018_FOEHU - Lec 06 - FIR Filter Design
DSP_2018_FOEHU - Lec 06 - FIR Filter Design
Amr E. Mohamed
 
Design of digital filters
Design of digital filtersDesign of digital filters
Design of digital filters
Naila Bibi
 
_Pulse-Modulation-Systems.pdf
_Pulse-Modulation-Systems.pdf_Pulse-Modulation-Systems.pdf
_Pulse-Modulation-Systems.pdf
SoyallRobi
 
1-Digital filters (FIR).pdf
1-Digital filters (FIR).pdf1-Digital filters (FIR).pdf
1-Digital filters (FIR).pdf
snehasingh75493
 
Signal Processing
Signal ProcessingSignal Processing
Signal Processing
Shayan Mamaghani
 
Design Technique of Bandpass FIR filter using Various Window Function
Design Technique of Bandpass FIR filter using Various Window FunctionDesign Technique of Bandpass FIR filter using Various Window Function
Design Technique of Bandpass FIR filter using Various Window Function
IOSR Journals
 
Design Technique of Bandpass FIR filter using Various Window Function
Design Technique of Bandpass FIR filter using Various Window FunctionDesign Technique of Bandpass FIR filter using Various Window Function
Design Technique of Bandpass FIR filter using Various Window Function
IOSR Journals
 
Digital Filters Part 2
Digital Filters Part 2Digital Filters Part 2
Digital Filters Part 2
Premier Farnell
 
Active filters
Active filtersActive filters
Active filters
Vinayak Bairagi
 
1-DSP Fundamentals.ppt
1-DSP Fundamentals.ppt1-DSP Fundamentals.ppt
1-DSP Fundamentals.ppt
KrishnaveniManickam3
 
design of sampling filter
design of sampling filter design of sampling filter
design of sampling filter
Anuj Arora
 
Dsp Concept Maping
Dsp Concept Maping Dsp Concept Maping
Dsp Concept Maping
Musa Mohd Mokji
 
IIR filter
IIR filterIIR filter
IIR filter
ssuser2797e4
 

Similar to Design of Filters PPT (20)

1 digital filters (fir)
1 digital filters (fir)1 digital filters (fir)
1 digital filters (fir)
 
Dss
Dss Dss
Dss
 
01analog filters
01analog filters01analog filters
01analog filters
 
Digital Filters Part 1
Digital Filters Part 1Digital Filters Part 1
Digital Filters Part 1
 
Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...
Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...
Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...
 
DSP_2018_FOEHU - Lec 06 - FIR Filter Design
DSP_2018_FOEHU - Lec 06 - FIR Filter DesignDSP_2018_FOEHU - Lec 06 - FIR Filter Design
DSP_2018_FOEHU - Lec 06 - FIR Filter Design
 
Design of digital filters
Design of digital filtersDesign of digital filters
Design of digital filters
 
_Pulse-Modulation-Systems.pdf
_Pulse-Modulation-Systems.pdf_Pulse-Modulation-Systems.pdf
_Pulse-Modulation-Systems.pdf
 
1-Digital filters (FIR).pdf
1-Digital filters (FIR).pdf1-Digital filters (FIR).pdf
1-Digital filters (FIR).pdf
 
Signal Processing
Signal ProcessingSignal Processing
Signal Processing
 
Design Technique of Bandpass FIR filter using Various Window Function
Design Technique of Bandpass FIR filter using Various Window FunctionDesign Technique of Bandpass FIR filter using Various Window Function
Design Technique of Bandpass FIR filter using Various Window Function
 
Design Technique of Bandpass FIR filter using Various Window Function
Design Technique of Bandpass FIR filter using Various Window FunctionDesign Technique of Bandpass FIR filter using Various Window Function
Design Technique of Bandpass FIR filter using Various Window Function
 
Digital Filters Part 2
Digital Filters Part 2Digital Filters Part 2
Digital Filters Part 2
 
Active filters
Active filtersActive filters
Active filters
 
1-DSP Fundamentals.ppt
1-DSP Fundamentals.ppt1-DSP Fundamentals.ppt
1-DSP Fundamentals.ppt
 
Exp passive filter (5)
Exp passive filter (5)Exp passive filter (5)
Exp passive filter (5)
 
Exp passive filter (4)
Exp passive filter (4)Exp passive filter (4)
Exp passive filter (4)
 
design of sampling filter
design of sampling filter design of sampling filter
design of sampling filter
 
Dsp Concept Maping
Dsp Concept Maping Dsp Concept Maping
Dsp Concept Maping
 
IIR filter
IIR filterIIR filter
IIR filter
 

Design of Filters PPT

  • 2. SECTION OUTLINE:  Introduction to Digital filter design  Introduction to FIR Filter  Design of FIR Filter using WINDOW Techniques  Introduction to IIR Filter  Design of IIR Filter using Approximation Method  MATLAB Code of Designed Filters
  • 3. Introduction:  A digital filter is a system that performs mathematical operations on a sampled, discrete-time signal to reduce or enhance certain aspects of that signal.  In digital signal processing, there are two important types of systems:  Digital filters: perform signal filtering in the time domain  Spectrum analyzers: provide signal representation in the frequency domain
  • 4. Digital Filter: xn yn Digital Filter Sampling frequency fS A D C D A C x(t) y(t) Analog anti- aliasing filter Analog smoothing filter
  • 5. Preliminaries:  The design of a digital filter is carried out in three steps:  Specifications: they are determined by the applications  Approximations: once the specification are defined, we use various concepts and mathematics that we studied so far to come up with a filter description that approximates the given set of specifications. (in detail)  Implementation: The product of the above step is a filter description in the form of either a difference equation, or a system function H(z), or an impulse response h(n). From this description we implement the filter in hardware or through software on a computer.
  • 6. Classification:  Digital filters are classified into one of two basic forms, according to how they respond to a unit impulse:  Finite impulse response  Infinite impulse response
  • 7. Finite Impulse Response:  In signal processing, a finite impulse response (FIR) filter is a filter whose impulse response is of finite duration, because it settles to zero in finite time.  FIR digital filters use only current and past input samples, and none of the filter's previous output samples, to obtain a current output sample value
  • 8. The transfer function is given by  The length of Impulse Response is N  All poles are at Z=0. .  Zeros can be placed anywhere on the z-plane     1 0 ).()( N n n znhzH
  • 9. Filter Design by Windowing  Simplest way of designing FIR filters  Start with ideal frequency response  Choose ideal frequency response as desired response  Most ideal impulse responses are of infinite length         n nj d j d enheH            deeH 2 1 nh njj dd          else0 Mn0nh nh d
  • 11. Kaiser window  Kaiser window β Transition width (Hz) Min. stop attn dB 2.12 1.5/N 30 4.54 2.9/N 50 6.76 4.3/N 70 8.96 5.7/N 90
  • 12. Rectangular Window        else0 Mn01 nw  Narrowest main lob – 4/(M+1) – Sharpest transitions at discontinuities in frequency  Large side lobs – Large oscillation around discontinuities – -13 dB Simplest window possible
  • 13. Hamming Window                else0 Mn0 M n2 cos46.054.0 nw  Medium main lob – 8/M  Good side lobs – -41 dB – Simpler than Blackman
  • 14. Kaiser Window  Parameterized equation forming a set of windows  Parameter to change main-lob width and side-lob area trade-off  I0(.) represents zeroth-order modified Bessel function of 1st kind                               else0 Mn0 I 2/M 2/Mn 1I nw 0 2 0
  • 15. MATLAB CODE:  %Design of LPF&HPF using rectangular,hamming and kaiser windows  clc;clear all;close all;  rp=input('enter attenuation in pass band');  rs=input('enter attenuation in stop band');  fp=input('enter pass band frequency');  fs=input('enter stop band frequency');  Fs=input('enter sampling frequency');  wp=2*pi*fp/Fs;  ws=2*pi*fs/Fs;  %formula for FIR filter  num=-20*log10(sqrt(rp*rs))-13;  den=14.6*(fs-fp)/Fs;  n=ceil(num/den);  disp('order of filter is n');  disp(n);  disp('press any key to continue');  pause;  n1=n+1;  %For even order  if(rem(n,2)~=0)  n1=n;  end  %LPF
  • 16.  %LPF  s1=input('enter the value for window 0-rectangularLPF 1-kaiserLPF 2-hammingLPF 3- rectangularHPF 4-kaiserHPF 5-hammingHPF');  switch(s1);  case 0  y=rectwin(n1);  [b,a]=fir1(n,wp,'low',y);  freqz(b,a,512);  case 1  y=kaiser(n1);  [b,a]=fir1(n,wp,'low',y);  freqz(b,a,512);  case 2  y=hamming(n1);  [b,a]=fir1(n,wp,'low',y);  freqz(b,a,512);  case 3  y=rectwin(n1);  [b,a]=fir1(n,wp,'high',y);  freqz(b,a,512);  case 4  y=kaiser(n1);  [b,a]=fir1(n,wp,'high',y);  freqz(b,a,512);  case 5  y=hamming(n1);  [b,a]=fir1(n,wp,'high',y);  freqz(b,a,512);  end
  • 17. Pros & Cons: FIR filters have the following advantages:  Exactly linear phase is possible  Always stable, even when quantized  Design methods are generally linear  Efficient hardware realizations  Startup transients have finite duration FIR filters have the following disadvantages: • Higher filter order than IIR filters • Corresponding greater delays
  • 18. Infinite Impulse Response Filter:  IIR systems have an impulse response function that is non-zero over an infinite length of time. This is in contrast to finite impulse response (FIR) filters, which have fixed-duration impulse responses  IIR filters may be implemented as either analog or digital filters
  • 19. Cont..  While designing a digital IIR filter , an analog filter (e.g. Chebyshev filter, Butterworth filter) is first designed and then is converted to a digital filter by applying discretization techniques such as Bilinear transform or Impulse invariance.
  • 21. Chebyshev Filter:  Chebyshev filters are analog or digital filters having a steeper roll-off and more passband ripple (type I) or stopband ripple (type II)  Chebyshev filters have the property that they minimize the error between the idealized and the actual filter characteristic over the range of the filter, but with ripples in the passband
  • 22. Cont..  Type-1 Chebyshev Filter  Type-2 Chebyshev Filter:
  • 23. Butterworth filter  The Butterworth filter is a type of signal processing filter designed to have as flat a frequency response as possible in the pass band. It is also referred to as a maximally flat magnitude filter
  • 24. MATLAB Prototype Filter Design Commands  [B,A] = BUTTER(N,Wn)  [B,A] = CHEBY1(N,R,Wn)  [B,A] = CHEBY2(N,R,Wn)  [B,A] = ELLIP(N,Rp,Rs,Wn) – N = filter order – R = pass band ripple (cheby1) or stop-band ripple (cheby2) in dB. (Rp and Rs respectively for the elliptic filter) – Wn = cut-off frequency (radians/sec for analog filters or normalized digital frequencies for digital filters) – [B,A] = filter coefficients, s-domain (analog filter) or z-domain (digital filter)
  • 25. Design Example  Filter Specifications:  Butterworth response  Pass-band edges = 400 Hz and 600 Hz  Stop-band edges = 300 Hz and 700 Hz  Pass-band ripple = 1 dB  Stop-band attenuation = -20 dB  Sampling Frequency = 2000 Hz
  • 26. Design Example Results 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 Frequency (kHz) Magnitude Magnitude Response Band Edges (-1dB and -20 dB)
  • 27. Design Example Chebyshev II High-Pass Filter  Filter specifications:  Chebyshev II response (stop-band ripple)  Pass-band edge = 1000 Hz  Stop-band edge = 900 Hz  Pass-band ripple = 1 dB  Stop-band attenuation = -40 dB  Sampling frequency = 8 kHz
  • 28. MATLAB Code for Design Example >> fs=8000; >> Wp=[2*1000/fs]; % Pass-band edge normalized digital frequency >> Ws=[2*900/fs]; % Stop-band edge normalized digital frequency >> [N,Wn]=cheb2ord(Wp,Ws,1,40); % The “order” command >> [B,A]=cheby2(N,40,Wn,'high'); % cheby2 is the “filter” command. In this command % the syntax requires the stop-band attenuation % as the second parameter >> fvtool(B,A)
  • 29. Design Example Results 0 0.5 1 1.5 2 2.5 3 3.5 -100 -80 -60 -40 -20 0 20 Frequency (kHz) Magnitude(dB) Magnitude Response (dB)
  • 30. MATLAB CODE:  %Design of IIR filters  fp1=input('enter pass band frequency');  fs1=input('enter stop band frequency');  Fs1=input('enter sampling frequency');  wp1=fp1/Fs1;  ws1=fs1/Fs1;  [n1,wn1]=buttord(wp1,ws1,2,60);  [x,y]=butter(n1,wn1,'low');  figure;  freqz(x,y,512);  [n1,wn1]=buttord(wp1,ws1,2,60);  [x,y]=butter(n1,wn1,'high');  figure;  freqz(x,y,512);  [n1,wn1]=cheb1ord(wp1,ws1,2,60);  [x,y]=cheby1(n1,3,wn1,'low');  figure;  freqz(x,y,512);  [n1,wn1]=cheb1ord(wp1,ws1,2,60);  [x,y]=cheby1(n1,3,wn1,'high');  figure;  freqz(x,y,512);
  • 31. Summary of IIR Filter:  IIR filters can be design by pole-zero location – Digital oscillators: poles on the unit circle – Notch filters: zeros on the unit circle with nearby poles to control notch width  Classic analog filters can be designed using the bilinear transformation  IIR filters have the advantage of smaller filter order for a given frequency response.  IIR filters have the disadvantages of possible instability due to coefficient quantization effects and non-linear phase response.
  • 32. References:  “Design of IIR Filter” by K.S Chandra, M.Tech, IIT-Bombay, Jan-2006  “Digital Filter Design” by Prof. A.G. Constantinides, University of Auckland, 2006  “FIR Filter Design”, Gao Xinbo,School of E.E., Xidian Univ. xbgao@ieee.org  “FIR Filter by Windowing”- The lab Book Pages.com  “Digital Signal Processing”, Prof.Ramesh Babu, Pondicherry Govt. College, TataMcgraw-Hill publication.  Wikipedia.org