DSP-CIS Chapter-4: FIR & IIR Filter Design Marc Moonen Dept. E.E./ESAT, KU Leuven

Slides:



Advertisements
Similar presentations
Nonrecursive Digital Filters
Advertisements

Signal and System IIR Filter Filbert H. Juwono
Chapter 6 Infinite Impulse Response Filter Design.
CHAPTER 7 Digital Filter Design Wang Weilian School of Information Science and Technology Yunnan University.
Hossein Sameti Department of Computer Engineering Sharif University of Technology.
Filtering Filtering is one of the most widely used complex signal processing operations The system implementing this operation is called a filter A filter.
Infinite Impulse Response (IIR) Filters
So far We have introduced the Z transform
Hossein Sameti Department of Computer Engineering Sharif University of Technology.
Digital Signal Processing – Chapter 11 Introduction to the Design of Discrete Filters Prof. Yasser Mostafa Kadah
Unit 9 IIR Filter Design 1. Introduction The ideal filter Constant gain of at least unity in the pass band Constant gain of zero in the stop band The.
LINEAR-PHASE FIR FILTERS DESIGN
Chapter 8 FIR Filter Design
Parks-McClellan FIR Filter Design
AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters.
EEE422 Signals and Systems Laboratory Filters (FIR) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky.
ELEN 5346/4304 DSP and Filter Design Fall Lecture 11: LTI FIR filter design Instructor: Dr. Gleb V. Tcheslavski Contact:
Relationship between Magnitude and Phase (cf. Oppenheim, 1999)
DSP-CIS Chapter-6: Filter Implementation Marc Moonen Dept. E.E./ESAT, KU Leuven
1 Lecture 2: February 27, 2007 Topics: 2. Linear Phase FIR Digital Filter. Introduction 3. Linear-Phase FIR Digital Filter Design: Window (Windowing)
Practical Signal Processing Concepts and Algorithms using MATLAB
1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Filtros Digitais.
DSP-CIS Chapter-5: Filter Realization Marc Moonen Dept. E.E./ESAT-STADIUS, KU Leuven
1 Lecture 5: March 20, 2007 Topics: 1. Design of Equiripple Linear-Phase FIR Digital Filters (cont.) 2. Comparison of Design Methods for Linear- Phase.
Chapter 7 IIR Filter Design
Filter Design Techniques
Zhongguo Liu_Biomedical Engineering_Shandong Univ. Biomedical Signal processing Chapter 7 Filter Design Techniques Zhongguo Liu Biomedical.
EE Audio Signals and Systems Digital Signal Processing (Synthesis) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky.
MATLAB for Signal Processing The MathWorks Inc. Natick, MA USA Filter Design.
IIR Filter design (cf. Shenoi, 2006) The transfer function of the IIR filter is given by Its frequency responses are (where w is the normalized frequency.
DSP-CIS Chapter-4: FIR & IIR Filter Design Marc Moonen Dept. E.E./ESAT-STADIUS, KU Leuven
Digital Signal Processing FIR Filter Design
Copyright ©2010, ©1999, ©1989 by Pearson Education, Inc. All rights reserved. Discrete-Time Signal Processing, Third Edition Alan V. Oppenheim Ronald W.
1 Chapter 7 Filter Design Techniques (cont.). 2 Optimum Approximation Criterion (1)  We have discussed design of FIR filters by windowing, which is straightforward.
Dan Ellis 1 ELEN E4810: Digital Signal Processing Topic 9: Filter Design: FIR 1.Windowed Impulse Response 2.Window Shapes 3.Design by Iterative.
Digital Signal Processing II Chapter 3: FIR & IIR Filter Design
Dan Ellis 1 ELEN E4810: Digital Signal Processing Topic 8: Filter Design: IIR 1.Filter Design Specifications 2.Analog Filter Design 3.Digital.
Fundamentals of Digital Signal Processing. Fourier Transform of continuous time signals with t in sec and F in Hz (1/sec). Examples:
Chapter 7 Finite Impulse Response(FIR) Filter Design
1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.
Chapter 9-10 Digital Filter Design. Objective - Determination of a realizable transfer function G(z) approximating a given frequency response specification.
Chapter 7. Filter Design Techniques
1 Digital Signal Processing Digital Signal Processing  IIR digital filter structures  Filter design.
P. 1 DSP-II Digital Signal Processing II Lecture 2: FIR & IIR Filter Design Marc Moonen Dept. E.E./ESAT, K.U.Leuven homes.esat.kuleuven.be/~moonen/
Signals and Systems Filter Design. Part III Design.
Chapter 4 LTI Discrete-Time Systems in the Transform Domain
The IIR FILTERs These are highly sensitive to coefficients,
DISP 2003 Lecture 5 – Part 1 Digital Filters 1 Frequency Response Difference Equations FIR versus IIR FIR Filters Properties and Design Philippe Baudrenghien,
Digital Signal Processing Lecture 6 Frequency Selective Filters
Chapter 6. Digital Filter Structures and Designs Section
Finite Impulse Response Filtering EMU-E&E Engineering Erhan A. Ince Dec 2015.
EEE4176 Application of Digital Signal Processing
DSP-CIS Part-II / Chapter-4 : Filter Design Marc Moonen Dept. E.E./ESAT-STADIUS, KU Leuven
Professor A G Constantinides 1 Digital Filter Specifications We discuss in this course only the magnitude approximation problem There are four basic types.
IIR Filter design (cf. Shenoi, 2006)
UNIT - 5 IIR FILTER DESIGN.
Lecture: IIR Filter Design
EEE422 Signals and Systems Laboratory
IIR Filters FIR vs. IIR IIR filter design procedure
Infinite Impulse Response (IIR) Filters
J McClellan School of Electrical and Computer Engineering
Fourier Series FIR About Digital Filter Design
LINEAR-PHASE FIR FILTERS DESIGN
Filter Design by Windowing
Ideal Filters One of the reasons why we design a filter is to remove disturbances Filter SIGNAL NOISE We discriminate between signal and noise in terms.
Chapter 7 FIR Digital Filter Design
Chapter 7 Finite Impulse Response(FIR) Filter Design
ELEN E4810: Digital Signal Processing Topic 9: Filter Design: FIR
Chapter 7 Finite Impulse Response(FIR) Filter Design
DSP-CIS Chapter-4: FIR & IIR Filter Design
Presentation transcript:

DSP-CIS Chapter-4: FIR & IIR Filter Design Marc Moonen Dept. E.E./ESAT, KU Leuven

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 2 Filter Design/Realization Step-1 : define filter specs (pass-band, stop-band, optimization criterion,…) Step-2 : derive optimal transfer function FIR or IIR design Step-3 : filter realization (block scheme/flow graph) direct form realizations, lattice realizations,… Step-4 : filter implementation (software/hardware) finite word-length issues, … question: implemented filter = designed filter ? ‘You can’t always get what you want’ -Jagger/Richards (?) Chapter-4 Chapter-5 Chapter-6

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 3 Step-1: Filter Specification Ex: Low-pass

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 4 Chapter-4: FIR & IIR Filter Design FIR filters –Linear-phase FIR filters –FIR design by optimization Weighted least-squares design, Minimax design –FIR design in practice `Windows’, Equiripple design, Software (Matlab,…) IIR filters –Poles and Zeros –IIR design by optimization Weighted least-squares design, Minimax design –IIR design in practice Analog IIR design : Butterworth/Chebyshev/elliptic Analog->digital : impulse invariant, bilinear transform,… Software (Matlab)

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 5 FIR Filters FIR filter = finite impulse response filter Also known as `moving average filters’ (MA) L poles at the origin z=0 (hence guaranteed stability) L zeros (zeros of B(z)), `all zero’ filters corresponds to difference equation impulse response

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 6 Linear Phase FIR Filters Non-causal zero-phase filters : example: symmetric impulse response (length 2.L o +1) h[-L o ],….h[-1], h[0],h[1],...,h[L o ] h[k]=h[-k], k=1..L o frequency response is i.e. real-valued (=zero-phase) transfer function k Lo

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 7 Linear Phase FIR Filters Causal linear-phase filters = non-causal zero-phase + delay example: symmetric impulse response & L even h[0],h[1],….,h[L] L=2.L o h[k]=h[L-k], k=0..L frequency response is = i.e. causal implementation of zero-phase filter, by introducing (group) delay k N0

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 8 Linear Phase FIR Filters Type-1 Type-2 Type-3 Type-4 N=2L o =even N=2L o +1=odd symmetric symmetric anti-symmetric anti-symmetric h[k]=h[N-k] h[k]=h[N-k] h[k]=-h[N-k] h[k]=-h[N-k] zero at zero at zero at LP/HP/BP LP/BP BP HP PS: `modulating’ Type-2 with 1,-1,1,-1,.. gives Type-4 (LP->HP) PS: `modulating’ Type-4 with 1,-1,1,-1,.. gives Type-2 (HP->LP) PS: `modulating’ Type-1 with 1,-1,1,-1,.. gives Type-1 (LP HP) PS: `modulating’ Type-3 with 1,-1,1,-1,.. gives Type-3 (BP BP) PS: IIR filters can NEVER have linear-phase property ! (proof see literature)

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 9 FIR Filter Design by Optimization (I) Weighted Least Squares Design : select one of the basic forms that yield linear phase e.g. Type-1 specify desired frequency response (LP,HP,BP,…) optimization criterion is where is a weighting function

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 10 FIR Filter Design by Optimization …this is equivalent to = `Quadratic Optimization’ problem

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 11 FIR Filter Design by Optimization Example: Low-pass design optimization function is i.e.

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 12 FIR Filter Design by Optimization a simpler problem is obtained by replacing the F(..) by… where the wi’s are a set of (n) selected sample frequencies This leads to an equivalent (`discretized’) quadratic optimization function: +++ : simple : unpredictable behavior in between sample freqs. Compare to p.10

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 13 FIR Filter Design by Optimization This is often supplemented with additional constraints, e.g. for pass-band and stop-band ripple control : The resulting optimization problem is : minimize : (=quadratic function) subject to (=pass-band constraints) (=stop-band constraints) = `Quadratic Programming’ problem

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 14 FIR Filter Design by Optimization (II) `Minimax’ Design : select one of the basic forms that yield linear phase e.g. Type-1 specify desired frequency response (LP,HP,BP,…) optimization criterion is where is a weighting function shown to be equivalent to a ‘semi-definite programming’ problem for which efficient algorithms/software is available.

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 15 FIR Filter Design by Optimization Conclusion: (I) weighted least squares design (II) minimax design provide general `framework’, procedures to translate filter design problems into standard optimization problems In practice (and in textbooks): emphasis on specific (ad-hoc) procedures : - filter design based on `windows’ - equiripple design

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 16 FIR Filter Design using `Windows’ Example : Low-pass filter design ideal low-pass filter is hence ideal time-domain impulse response is truncate h d [k] to L+1 samples (L even) : add (group) delay to turn into causal filter

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 17 FIR Filter Design using `Windows’ Example : Low-pass filter design (continued) PS : it can be shown (use Parceval’s theorem) that the filter obtained by such time-domain truncation is also obtained by using a weighted least-squares design procedure with the given H d, and weighting function truncation corresponds to applying a `rectangular window’ : +++: simple procedure (also for HP,BP,…) : truncation in time-domain results in `Gibbs effect’ in frequency domain, i.e. large ripple in pass-band and stop-band (at band edge discontinuity), which cannot be reduced by increasing the filter order L.

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 18 FIR Filter Design using `Windows’ Remedy : apply windows other than rectangular window: time-domain multiplication with a window function w[k] corresponds to frequency domain convolution with W(z) : candidate windows : Han, Hamming, Blackman, Kaiser,…. (see textbooks, see DSP-I) window choice/design = trade-off between side-lobe levels (define peak pass-/stop-band ripple) and width main-lobe (defines transition bandwidth)

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 19 FIR Equiripple Design Starting point is minimax criterion, e.g. Based on theory of Chebyshev approximation and the `alternation theorem’, which (roughly) states that the optimal d’s are such that the `max’ (maximum weighted approximation error) is obtained at L o +2 extremal frequencies… …that hence will exhibit the same maximum ripple (`equiripple’) Iterative procedure for computing extremal frequencies, etc. (Remez exchange algorithm, Parks-McClellan algorithm) Very flexible, etc., available in many software packages Details omitted here (see textbooks)

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 20 FIR Filter Design Software FIR Filter design abundantly available in commercial software Matlab: b=fir1(L,Wn,type,window), windowed linear-phase FIR design, L is filter order, Wn defines band-edges, type is `high’,`stop’,… b=fir2(L,f,m,window), windowed FIR design based on inverse Fourier transform with frequency points f and corresponding magnitude response m b=remez(L,f,m), equiripple linear-phase FIR design with Parks- McClellan (Remez exchange) algorithm

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 21 FIR Filter Design – Matlab Examples 1/10 for filter_order=10:30:100 % Impulse response b = fir1(filter_order,[W1 W2],'bandpass'); % Frequency response % Plotting end filter_order-10

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 22 FIR Filter Design – Matlab Examples 2/10 for filter_order=10:30:100 % Impulse response b = fir1(filter_order,[W1 W2],'bandpass'); % Frequency response % Plotting end filter_order-40

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 23 FIR Filter Design – Matlab Examples 3/10 for filter_order=10:30:100 % Impulse response b = fir1(filter_order,[W1 W2],'bandpass'); % Frequency response % Plotting end filter_order-70

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 24 FIR Filter Design – Matlab Examples 4/10 for filter_order=10:30:100 % Impulse response b = fir1(filter_order,[W1 W2],'bandpass'); % Frequency response % Plotting end filter_order-100

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 25 FIR Filter Design – Matlab Examples Full Matlab Code (ignore) % See help fir1 % Bandpass filter % B = FIR1(N,Wn,'bandpass') % Wn = [W1 W2] upper and lower cut-off frequencies W1 = 0.25; % 1/4*pi W2 = 0.75; % 3/4*pi for filter_order=10:30:100 % Impulse response b = fir1(filter_order,[W1 W2],'bandpass'); % Frequency response [H W]=freqz(b); % Plotting subplot(211) plot(W,db(abs(H)));hold on set(gca,'XTick',0:pi/2:pi) set(gca,'XTickLabel',{'0','pi/2','pi'}) title('FIR filter design'); xlabel('Circular frequency (Radians)'); ylabel('Magnitude response (dB)'); axis([0 pi ]) subplot(212) plot(b) xlabel('Samples'); ylabel('Impulse response'); axis([ ]) pause end hold off 5/10

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 26 FIR Filter Design – Matlab Examples 6/10

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 27 FIR Filter Design – Matlab Examples 7/10

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 28 FIR Filter Design – Matlab Examples 8/10

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 29 FIR Filter Design – Matlab Examples 9/10

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 30 FIR Filter Design – Matlab Examples Full Matlab Code (ignore) % See help fir1 % Bandpass filter % B = FIR1(N,Wn,'bandpass',win) % Wn = [W1 W2] upper and lower cut-off frequencies % win windown type W1 = 0.25; % 1/4*pi W2 = 0.75; % 3/4*pi filter_order = 50; win1 = triang(filter_order+1); win2 = rectwin(filter_order+1); win3 = hamming(filter_order+1); win4 = blackman(filter_order+1); b1 = fir1(filter_order,[W1 W2],'bandpass',win1); b2 = fir1(filter_order,[W1 W2],'bandpass',win2); b3 = fir1(filter_order,[W1 W2],'bandpass',win3); b4 = fir1(filter_order,[W1 W2],'bandpass',win4); [H1 W] = freqz(b1); [H2 W] = freqz(b2); [H3 W] = freqz(b3); [H4 W] = freqz(b4); subplot(211) plot(W,db(abs(H1)));hold on;plot(W,db(abs(H2)));plot(W,db(abs(H3)));plot(W,db(abs(H4)));hold off set(gca,'XTick',0:pi/2:pi) set(gca,'XTickLabel',{'0','pi/2','pi'}) title('Blackman window'); xlabel('Circular frequency (Radians)'); ylabel('Magnitude response (dB)'); axis([0 pi ]) subplot(212) plot(b4);hold on;plot(win4,'r');;hold off xlabel('Samples'); ylabel('Impulse response'); axis([0 filter_order ]) 10/10

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 31 IIR filters Rational transfer function : L poles (zeros of A(z)), L zeros (zeros of B(z)) infinitely long impulse response stable iff poles lie inside the unit circle corresponds to difference equation = also known as `ARMA’ (autoregressive-moving average)

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 32 IIR Filter Design +++ low-order filters can produce sharp frequency response low computational cost design more difficult stability should be checked/guaranteed phase response not easily controlled (e.g. no linear-phase IIR filters) coefficient sensitivity, quantization noise, etc. can be a problem (see Chapter-6)

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 33 IIR filters Frequency response versus pole-zero location : (cfr. frequency response is z-transform evaluated on the unit circle) Example-1 : Low-pass filter poles at DC (z=1) Nyquist freq (z=-1) pole Re Im pole near unit-circle introduces `peak’ in frequency response hence pass-band can be set by pole placement

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 34 IIR filters Frequency response versus pole-zero location : Example-2 : Low-pass filter poles at zeros at DC Nyquist freq zero pole zero near (or on) unit-circle introduces `dip’ (or transmision zero) in freq. response hence stop-band can be emphasized by zero placement

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 35 IIR Filter Design by Optimization (I) Weighted Least Squares Design : IIR filter transfer function is specify desired frequency response (LP,HP,BP,…) optimization criterion is where is a weighting function stability constraint :

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 36 IIR Filter Design by Optimization (II) `Minimax’ Design : IIR filter transfer function is specify desired frequency response (LP,HP,BP,…) optimization criterion is where is a weighting function stability constraint :

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 37 IIR Filter Design by Optimization These optimization problems are significantly more difficult than those for the FIR design case… : Problem-1: presence of denominator polynomial leads to non-linear (non-quadratic) optimization Problem-2: stability constraint (zeros of a high-order polynomial are related to the polynomial’s coefficients in a highly non-linear manner) –Solutions based on alternative stability constraints, that e.g. are affine functions of the filter coefficients, etc… –Topic of ongoing research, details omitted here

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 38 IIR Filter Design by Optimization Conclusion: (I) weighted least squares design (II) minimax design provide general `framework’, procedures to translate filter design problems into ``standard’’ optimization problems In practice (and in textbooks): emphasis on specific (ad-hoc) procedures : - IIR filter design based analog filter design (s-domain design) and analog->digital conversion - IIR filter design by modeling = direct z-domain design (Pade approximation, Prony, etc.)

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 39 IIR Filter Design Software IIR filter design considerably more complicated than FIR design (stability, phase response, etc..) (Fortunately) IIR Filter design abundantly available in commercial software Matlab: [b,a]=butter/cheby1/cheby2/ellip(L,…,Wn), IIR LP/HP/BP/BS design based on analog prototypes, pre-warping, bilinear transform, … immediately gives H(z) analog prototypes, transforms, … can also be called individually filter order estimation tool etc...

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 40 IIR Filter Design – Matlab Examples Butterworth 2nd order 1/5

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 41 IIR Filter Design – Matlab Examples Butterworth 10th order 2/5

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 42 IIR Filter Design – Matlab Examples Butterworth 18th order 3/5

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 43 IIR Filter Design – Matlab Examples Butterworth 26th order 4/5

DSP-CIS / Chapter-4: FIR & IIR Filter Design / Version p. 44 IIR Filter Design – Matlab Examples Full Matlab Code (ignore) % See help butter % Bandpass filter % [B,A] = butter(filter_order,[W1 W2],'bandpass'); % Wn = [W1 W2] upper and lower cut-off frequencies W1 = 0.25; % 1/4*pi W2 = 0.75; % 3/4*pi for filter_order=2:8:28 % Coefficients response [B,A] = butter(filter_order,[W1 W2],'bandpass'); % Frequency response [H W] = freqz(B,A); % Impulse response h = filter(B,A,[zeros(2,1);1;zeros(100,1)]); % Plotting subplot(211) plot(W,db(abs(H)));hold on set(gca,'XTick',0:pi/2:pi) set(gca,'XTickLabel',{'0','pi/2','pi'}) title('IIR filter design'); xlabel('Circular frequency (Radians)'); ylabel('Magnitude response (dB)'); axis([0 pi ]) subplot(212) plot(h) xlabel('Samples'); ylabel('Impulse response'); axis([ ]) pause end hold off 5/5