Digital Filter Design using MATLAB

Similar documents
FIR Filters in Matlab

DSP Laboratory (EELE 4110) Lab#10 Finite Impulse Response (FIR) Filters

Digital Filters IIR (& Their Corresponding Analog Filters) Week Date Lecture Title

Filter Notes. Terminology and Real Filter Concepts. Transition band and filter shape factor

GEORGIA INSTITUTE OF TECHNOLOGY. SCHOOL of ELECTRICAL and COMPUTER ENGINEERING. ECE 2026 Summer 2018 Lab #8: Filter Design of FIR Filters

EE 422G - Signals and Systems Laboratory

Matlab exercises ELEC-E5410 Signal processing for communications

Filter Notes. Terminology and Real Filter Concepts. Transition band and filter shape factor

Outline. Introduction to Biosignal Processing. Overview of Signals. Measurement Systems. -Filtering -Acquisition Systems (Quantisation and Sampling)

EE 403: Digital Signal Processing

DIGITAL FILTERS. !! Finite Impulse Response (FIR) !! Infinite Impulse Response (IIR) !! Background. !! Matlab functions AGC DSP AGC DSP

Digital Filters FIR and IIR Systems

EEO 401 Digital Signal Processing Prof. Mark Fowler

Brief Introduction to Signals & Systems. Phani Chavali

A comparative study on main lobe and side lobe of frequency response curve for FIR Filter using Window Techniques

DIGITAL SIGNAL PROCESSING TOOLS

Signal Processing Toolbox

GUJARAT TECHNOLOGICAL UNIVERSITY

FIR window method: A comparative Analysis

Digital Signal Processing

(i) Understanding of the characteristics of linear-phase finite impulse response (FIR) filters

Electrical & Computer Engineering Technology

ijdsp Workshop: Exercise 2012 DSP Exercise Objectives

(i) Understanding of the characteristics of linear-phase finite impulse response (FIR) filters

UNIT-II MYcsvtu Notes agk

ELEC-C5230 Digitaalisen signaalinkäsittelyn perusteet

AC : INTERACTIVE LEARNING DISCRETE TIME SIGNALS AND SYSTEMS WITH MATLAB AND TI DSK6713 DSP KIT

Aparna Tiwari, Vandana Thakre, Karuna Markam Deptt. Of ECE,M.I.T.S. Gwalior, M.P, India

ELEC3104: Digital Signal Processing Session 1, 2013

Filters. Phani Chavali

Gibb s Phenomenon Analysis on FIR Filter using Window Techniques

Sampling of Continuous-Time Signals. Reference chapter 4 in Oppenheim and Schafer.

Octave Functions for Filters. Young Won Lim 2/19/18

Performance Analysis of FIR Digital Filter Design Technique and Implementation

EEO 401 Digital Signal Processing Prof. Mark Fowler

Window Method. designates the window function. Commonly used window functions in FIR filters. are: 1. Rectangular Window:

ECE 203 LAB 2 PRACTICAL FILTER DESIGN & IMPLEMENTATION

Multirate Digital Signal Processing

F I R Filter (Finite Impulse Response)

4. Design of Discrete-Time Filters

ECE 5650/4650 MATLAB Project 1

Plot frequency response around the unit circle above the Z-plane.

Digital Filtering: Realization

ELT COMMUNICATION THEORY

ECE438 - Laboratory 7a: Digital Filter Design (Week 1) By Prof. Charles Bouman and Prof. Mireille Boutin Fall 2015

EECE 301 Signals & Systems Prof. Mark Fowler

Experiment 4- Finite Impulse Response Filters

ECE 4213/5213 Homework 10

Design of FIR Filters

Design IIR Filters Using Cascaded Biquads


SMS045 - DSP Systems in Practice. Lab 1 - Filter Design and Evaluation in MATLAB Due date: Thursday Nov 13, 2003

DSP Filter Design for Flexible Alternating Current Transmission Systems

FIR FILTER DESIGN USING A NEW WINDOW FUNCTION

Optimal FIR filters Analysis using Matlab

Lab 4 An FPGA Based Digital System Design ReadMeFirst

DFT: Discrete Fourier Transform & Linear Signal Processing

3F3 Digital Signal Processing (DSP)

CS3291: Digital Signal Processing

Digital Signal Processing Fourier Analysis of Continuous-Time Signals with the Discrete Fourier Transform

Design Band Pass FIR Digital Filter for Cut off Frequency Calculation Using Artificial Neural Network

Lecture 4 Frequency Response of FIR Systems (II)

Digital Signal Processing

Noise estimation and power spectrum analysis using different window techniques

Discrete Fourier Transform (DFT)

ECE 3793 Matlab Project 4

PROBLEM SET 6. Note: This version is preliminary in that it does not yet have instructions for uploading the MATLAB problems.

FIR FILTER DESIGN USING NEW HYBRID WINDOW FUNCTIONS

Design IIR Band-Reject Filters

Decoding a Signal in Noise

ISSN (PRINT): , (ONLINE): , VOLUME-5, ISSUE-2,

1 PeZ: Introduction. 1.1 Controls for PeZ using pezdemo. Lab 15b: FIR Filter Design and PeZ: The z, n, and O! Domains

Bibliography. Practical Signal Processing and Its Applications Downloaded from

Design and comparison of butterworth and chebyshev type-1 low pass filter using Matlab

Concordia University. Discrete-Time Signal Processing. Lab Manual (ELEC442) Dr. Wei-Ping Zhu

Advanced Digital Signal Processing Part 5: Digital Filters

COURSE PLAN. : DIGITAL SIGNAL PROCESSING : Dr.M.Pallikonda.Rajasekaran, Professor/ECE

Final Exam Practice Questions for Music 421, with Solutions

Basic Signals and Systems

Comparative Study of RF/microwave IIR Filters by using the MATLAB

DIGITAL SIGNAL PROCESSING (Date of document: 6 th May 2014)

Design of FIR Filter for Efficient Utilization of Speech Signal Akanksha. Raj 1 Arshiyanaz. Khateeb 2 Fakrunnisa.Balaganur 3

Digital Video and Audio Processing. Winter term 2002/ 2003 Computer-based exercises

ELEC3104: Digital Signal Processing Session 1, 2013 LABORATORY 3: IMPULSE RESPONSE, FREQUENCY RESPONSE AND POLES/ZEROS OF SYSTEMS

LECTURER NOTE SMJE3163 DSP

DESIGN OF FIR AND IIR FILTERS

Digital Signal Processing for Audio Applications

Digital Processing of Continuous-Time Signals

Final Exam Solutions June 14, 2006

ECE 421 Introduction to Signal Processing

Digital Processing of

Massachusetts Institute of Technology Department of Electrical Engineering & Computer Science 6.341: Discrete-Time Signal Processing Fall 2005

Fig 1 describes the proposed system. Keywords IIR, FIR, inverse Chebyshev, Elliptic, LMS, RLS.

Lecture 3, Multirate Signal Processing

Signals and Systems Using MATLAB

Signal processing preliminaries

EC6502 PRINCIPLES OF DIGITAL SIGNAL PROCESSING

Digital Signal Processing

Keywords FIR lowpass filter, transition bandwidth, sampling frequency, window length, filter order, and stopband attenuation.

ASN Filter Designer Professional/Lite Getting Started Guide

Transcription:

Digital Filter Design using MATLAB Dr. Tony Jacob Department of Electronics and Electrical Engineering Indian Institute of Technology Guwahati April 11, 2015 Dr. Tony Jacob IIT Guwahati April 11, 2015 1 / 30

Outline of the Talk Review of LTI Systems Filter Specifications Linear Phase FIR Filters FIR Filter Design Hands on MATLAB Session Dr. Tony Jacob IIT Guwahati April 11, 2015 2 / 30

What is an LTI System? Dr. Tony Jacob IIT Guwahati April 11, 2015 3 / 30

Impulse Response Description: Convolution Dr. Tony Jacob IIT Guwahati April 11, 2015 4 / 30

Transform Domain Description: Fourier Transform Dr. Tony Jacob IIT Guwahati April 11, 2015 5 / 30

Transform Domain Description: Fourier Transform Dr. Tony Jacob IIT Guwahati April 11, 2015 6 / 30

Transform Domain Description: z Transform Dr. Tony Jacob IIT Guwahati April 11, 2015 7 / 30

Difference Equation Description Dr. Tony Jacob IIT Guwahati April 11, 2015 8 / 30

Conversion between Descriptions Dr. Tony Jacob IIT Guwahati April 11, 2015 9 / 30

Properties of LTI Systems Dr. Tony Jacob IIT Guwahati April 11, 2015 10 / 30

What is a Filter? An LTI system processes a signal x[n] by amplifying or attenuating the sinusoids in its Fourier representation (DTFT) X (e jω ) by the complex factor H(e jω ). This inspires the terminology that X (e jω ) is filtered by H(e jω ) to produce Y (e jω ). Dr. Tony Jacob IIT Guwahati April 11, 2015 11 / 30

Ideal Filters Categories of Ideal Filters Ideal Low Pass Filters Ideal High Pass Filters Ideal Band Pass Filters Ideal Band Stop Filters Dr. Tony Jacob IIT Guwahati April 11, 2015 12 / 30

Low Pass Filter Specifications Dr. Tony Jacob IIT Guwahati April 11, 2015 13 / 30

Low Pass Filter Specifications Dr. Tony Jacob IIT Guwahati April 11, 2015 14 / 30

Low Pass Filter Specifications Dr. Tony Jacob IIT Guwahati April 11, 2015 15 / 30

FIR Filters: Linear Phase Dr. Tony Jacob IIT Guwahati April 11, 2015 16 / 30

FIR Filters: Linear Phase Dr. Tony Jacob IIT Guwahati April 11, 2015 17 / 30

Design Method 1: Windowing Dr. Tony Jacob IIT Guwahati April 11, 2015 18 / 30

Design Method 1: Windowing Dr. Tony Jacob IIT Guwahati April 11, 2015 19 / 30

Design Method 1: Windowing Dr. Tony Jacob IIT Guwahati April 11, 2015 20 / 30

Design Method 1: Windowing Dr. Tony Jacob IIT Guwahati April 11, 2015 21 / 30

Design Method 1: Windowing Dr. Tony Jacob IIT Guwahati April 11, 2015 22 / 30

Design Method 1: Windowing Dr. Tony Jacob IIT Guwahati April 11, 2015 23 / 30

Design Method 1: Windowing Dr. Tony Jacob IIT Guwahati April 11, 2015 24 / 30

Design Method 1: Windowing Dr. Tony Jacob IIT Guwahati April 11, 2015 25 / 30

Design Method 1: Windowing Dr. Tony Jacob IIT Guwahati April 11, 2015 26 / 30

Other Design Methods Frequency Sampling Optimal Equiripple Filters Dr. Tony Jacob IIT Guwahati April 11, 2015 27 / 30

Exercises Familiarize yourselves with the commands: boxcar, bartlett, hann, hamming, blackman, kaiser. Design a digital FIR low pass filter with the following specifications: ω p = 0.2π, ω s = 0.3π, R p = 0.25dB and A s = 50dB. Try various window functions for this pupose. Determine the impulse response and provide a plot of the frequency response of the designed filter. Familiarize yourselves with designfilt command. Launch FDATool and FVTool and familiarize yourselves with their features. Dr. Tony Jacob IIT Guwahati April 11, 2015 28 / 30

References 1 Vinay K. Ingle and John G. Proakis, Digital Signal Processing Using MATLAB, 3rd Ed., Cengage Learning, 2012. 2 Alan V. Oppenheim and Ronald W. Schafer, Discrete-Time Signal Processing, 3rd Ed., Pearson Education, 2010. 3 John G. Proakis and Dmitris K. Manolakis, Digital Signal Processing: Principles, Algorithms, and Applications, 4th Ed., Prentice Hall, 2006. 4 Dmitris K. Manolakis and Vinay K. Ingle, Applied Digital Signal Processing, Cambridge University Press, 2011. Dr. Tony Jacob IIT Guwahati April 11, 2015 29 / 30

Online Courses 1 Alan V. Oppenheim, 6.007 Signals and Systems, MIT OCW. 2 Alan V. Oppenheim, 6.008 Digital Signal Processing, MIT OCW. 3 Alan V. Oppenheim and Thomas A. Baran, 6.341x Discrete-Time Signal Processing, edx. 4 Paolo Prandoni and Martin Vetterli, Digital Signal Processing, Coursera. Dr. Tony Jacob IIT Guwahati April 11, 2015 30 / 30

Questions? Dr. Tony Jacob IIT Guwahati April 11, 2015 31 / 30

Discrete Fourier transform (DFT). >> ts = 0.0001 ; >> fs = 1/ts ; >> N = 30001 ; >> T = (N-1)*ts ; >> t = 0:ts:T; >> x = 2*sind(360* 2000* t); >> noise = 1*sind(360* 4000* t); >> SIG = x + noise + 1; >> FFT = fftshift(fft(sig)); % fft finds DFT using FFT algorithm. % fftshift shifts the DTF to the scale pi to pi >> f = (-fs/2) : (fs/ (N-1)) : (fs/2); >> figure;plot (f, (abs(fft)).^2) >> PSD = FFT.*conj(FFT); >> figure;plot (f, PSD) TRY >> psd(sig)

Discrete Fourier transform (DFT). >> ts = 0.0001 ; >> fs = 1/ts ; >> N = 30001 ; >> T = (N-1)*ts ; >> t = 0:ts:T; >> x = 2*sind(360* 2000* t); >> noise = 1*sind(360* 4000* t); >> SIG = x + noise + 1; >> FFT = fftshift(fft(sig)); % fft finds DFT using FFT algorithm. % fftshift shifts the DTF to the scale pi to pi >> f = (-fs/2) : (fs/ (N-1)) : (fs/2); >> figure;plot (f, (abs(fft)).^2) >> PSD = FFT.*conj(FFT); >> figure;plot (f, PSD) TRY >> psd(sig)

Filters IIR Filters >> [ b, a ] = butter( N, fc, 'low') % N = Order, fc = filter cutoff frequency Note: fc is the normalised frequency in the range 0 1. If sampling frequency is Fs, 1 is mapped to Fs/2. Choose low high stop pass accordingly. For stop or pass, fc = [ fc1, fc2 ] upper & lower cutoff frequencies. Eg; >> [b, a] = butter (10, 0.5,'low'); % for a lowpass filter >> [b, a] = butter ( 16, [ 0.5, 0.8], stop ) % for a band stop filter. >> [N, fc] = buttord( fp, fs, Rp, Rs) % For finding optimal filter order. Note: Rp, Rs are the pass & stop band ripples in db and for LPF: fp =.1, fs =.2 HPF: fp =.2, fs =.1 BPF: fp = [.2.7], fs = [.1.8] BSF: fp = [.1.8], fs = [.2.7] The above written format must be followed for your design

Filters IIR Filters Use cheby1, cheby2, ellip functions instead of butter to meet your various design requirements. >> Y = filter ( b, a, X); % to filter the data X ; Y receives the filtered data. a and b are digital filter coeffs generated by any of the previously discussed filter functions. >> freqz ( b, a ) % plots Z domain frequency response >> [ H,W ] = freqz (b, a, N) % gives response in H and N point freq scale in W. >> freqs (b, a ) % plots S domain frequency response >> [ H,W ] = freqs (b, a, N) % gives response in H and N freq point scale in W. TRY >> fvtool ( b, a )

Filters FIR Filters In FIR, it is possible to design filters of linear phase. That is group delay is a constant. Types of FIR filters.

Filters FIR Filters How to find b0, b1, b2,.. bn using Matlab? >> b = fir1( N, Wn, low ) % for an FIR lowpass filter Note: use high, stop, bandpass as per requirement. N must be even for fir1(. ). Matlab will show an error otherwise. Wn is the normalised frequency in range 0 1; 1 maps to Fs/2. Wn must be of the form [ W1 W2] for stop and pass filters. >>Y = filter ( b, 1, X); % to filter the data X ; Y receives the filtered data. b is the digital filter coeffs generated by fir1 (.) since there are no poles, a is taken as 1.

Filters FIR Filters Choosing Windows in the design of FIR filters >> b = fir1( N, Wn, low, window) % specify the required window. Matlab uses hamming as the default window Note: Window along with its parameters need to be specified. Matlab provides the following windows bartlett - Bartlett window. barthannwin- Modified Bartlett-Hanning window. blackman- Blackman window. blackmanharris- Min 4-term Blackman-Harris bohmanwin- Bohman window. chebwin - Chebyshev window. flattopwin - Flat Top window. gausswin- Gaussian window. hamming - Hamming window. hann - Hann window. kaiser - Kaiser window. triang- Triangular window. parzenwin - Parzen window. rectwin - Rectangular window. taylorwin- Taylor window. tukeywin - Tukey window. nuttallwin- Nuttall defined min 4-term Blackman-Harris

Filters FIR Filters Choosing Windows in the design of FIR filters >> b = fir1( N, Wn, low, kaiser ( N+1, 4) ) % here beta of kaiser = 4. How to specify a window of your design? How to caliberate one? >> wintool % allows you to design your own windows. % also you can tune the available matlab windows. Note: The length of the window must be chosen carefully to match the length of the filter ; other wise Matlab will give an error. >> b = fir1( N, Wn, low, yourwindow) % yourwindow must be available in the Workspace.

Filters FIR Filters Design FIR filters with desired frequency response >> b = fir2( N, F, A ) % F is the frequency sample points. % A is the corresponding amplitude at those freqs Note: vector in F must be normalised; first and last samples of the vector must be 0 and 1 respectively. For example : >> F = [0 : 1: 21] ; >> F = F./ 21; % this is done for normalizing the vector F >> A = [0 : 1 : 10 ] ; >> A = [A, fliplr ( A ) ] ; >> b = fir2 (100, F, A) ; >> fvtool ( b, 1 )

Filters Filters design tool for instant designing >> fdatool % allows user to quickly design or analyse a filter Note: Options are available for choosing all types of filters in both IIR and FIR categories. The designed filters can be exported to the workspace in various forms. For easy usage, the design can be ported as filter objects.

Let s filter some real time data using the filters designed in Matlab.