Presentation is loading. Please wait.

Presentation is loading. Please wait.

Biomedical Signal processing Chapter 7 Filter Design Techniques

Similar presentations


Presentation on theme: "Biomedical Signal processing Chapter 7 Filter Design Techniques"— Presentation transcript:

1 Biomedical Signal processing Chapter 7 Filter Design Techniques
2018年11月16日7时43分 Biomedical Signal processing Chapter 7 Filter Design Techniques Zhongguo Liu Biomedical Engineering School of Control Science and Engineering, Shandong University 山东省精品课程《生物医学信号处理(双语)》 2018/11/16 1 Zhongguo Liu_Biomedical Engineering_Shandong Univ.

2 Chapter 7 Filter Design Techniques
7.0 Introduction 7.1 Filter Specifications 7.2 Design of Discrete-Time IIR Filters From Continuous-Time Filters 7.3 Discrete-Time Butterworth, Chebyshev and Elliptic Filters 7.4 Frequency Transformations of Lowpass IIR Filters 7.5 Design of FIR Filters by Windowing 7.6 Examples of FIR Filters Design by the Kaiser Window Method

3 Filter Design Techniques
7.0 Introduction

4 2018年11月16日7时43分 7.0 Introduction Frequency-selective filters pass only certain frequencies Any discrete-time system that modifies certain frequencies is called a filter. We concentrate on design of causal Frequency-selective filters (IIR, FIR).

5 Stages of Filter Design
1. Determine the specification of the desired properties of the system. 2.The approximation of the specifications using(designing) a causal discrete-time system. 3. The realization of the system. Our focus is on second step Specifications are typically given in the frequency domain.

6 Frequency-Selective Filters
Ideal lowpass filter (discrete-time system)

7 Frequency-Selective Filters
Ideal highpass filter(discrete-time system)

8 Frequency-Selective Filters
Ideal bandpass filter(discrete-time system)

9 Frequency-Selective Filters
Ideal bandstop filter(discrete-time system)

10 7.1 Filter Specifications
2018年11月16日7时43分 Figure depicts the typical representation of the tolerance limits associated with approximating a discrete-time ideal lowpass filter. tolerance scheme 容限图 may vary symmetrically around 1, δp1=δp2 or δp1=0 edge frequency

11 7.1 Filter Specifications
2018年11月16日7时43分 no constraints on phase response other than implicit requirements of stability and causality for IIR filter. The constraint for FIR filters: linear phase. tolerance scheme 容限图 may vary symmetrically around 1, δp1=δp2 or δp1=0 edge frequency

12 Ex. 7.1 Specifications for LTI DT system
If input is bandlimited and sampling frequency is high enough to avoid aliasing, then overall system behaves as an LTI continuous-time system effective continuous-time specifications are converted to discrete time specifications by:

13 Ex. 7.1 Determining Specifications for a Discrete-Time Filter H(ejw) .
Known: Specifications of the continuous-time filter: 1. passband 2. stopband For bandlimited input, aliasing avoided when sampling frequency is high enough

14 Ex. 7.1 Determining Specifications for a Discrete-Time Filter
Specifications of the continuous-time filter: 1. passband 2. stopband tolerance scheme 容限图

15 Ex. 7.1 Determining Specifications for a Discrete-Time Filter
Solution: Specifications of the discrete-time filter in Same tolerance limits:

16 Ex. 7.1 Determining Specifications for a Discrete-Time Filter
ideal passband gain in decibels maximum passband gain passband gain at passband edge maximum stopband gain tolerance scheme 容限图 edge frequency

17 Filter Design Constraints
Designing IIR filters is to find the approximation by a rational function of z. The poles of the system function must lie inside the unit circle(stability, causality). Designing FIR filters is to find the polynomial approximation. FIR filters are often required to be linear-phase.

18 Filter Design Techniques
7.2 Design of Discrete-Time IIR Filters From Continuous-Time Filters

19 7.2 Design of Discrete-Time IIR Filters From Continuous-Time Filters
The traditional approach to the design of discrete-time IIR filters involves the transformation of a continuous-time filter into a discrete filter meeting prescribed specification: Impulse Invariance, Bilinear transformation

20 Three Reasons The art of continuous-time IIR filter design is highly advanced, and useful results can be achieved, it is advantageous to use the design procedures already developed for continuous-time filters.

21 Three Reasons Many useful continuous-time IIR design method have relatively simple closed form design formulas. Therefore, discrete-time IIR filter design methods based on standard continuous-time design formulas are rather simple to carry out.

22 Three Reasons The standard approximation methods that work well for continuous-time IIR filters do not lead to simple closed-form design formulas when these methods are applied directly to the discrete-time IIR case, because the frequency response of a discrete-time filter is periodic, and that of a continuous-time filter is not.

23 Steps of DT filter design by transforming a prototype continuous-time filter
①Obtain the specifications for continuous-time filter by transforming the specifications for the desired discrete-time filter. ②Determine the system function Hc(s) or hc(t) of the continuous-time filter. ③System function H(z) or h[n] of discrete-time filter is obtained by applying transformation to Hc(s) or hc(t). require that the essential properties of the continuous-time frequency response be preserved.

24 H(s)极点分布与原函数的对应关系(稳定性)
几种典型情况 p211

25 Constraints of Transformation
In transformations, to preserve the essential properties of the frequency response, the imaginary axis of the s-plane is mapped onto the unit circle of the z-plane.

26 Constraints of Transformation
In order to preserve the property of stability, If the continuous system has poles only in the left half of the s-plane, then the discrete- time filter must have poles only inside the unit circle.

27 7.2.1 Filter Design by Impulse Invariance
The impulse response of discrete-time system is defined by sampling the impulse response of a continuous-time system. Relationship between two systems: i.e. the continuous-time filter is bandlimited, and Ωs >2Ωmax in one period

28 relation between frequencies
Relationship between two systems: S plane Z plane - No Aliasing one period

29 No Aliasing in the Impulse Invariance

30 Aliasing in the Impulse Invariance

31 Steps of DT filter design by transforming a prototype continuous-time filter
①Obtain the specifications for continuous-time filter by transforming the specifications for the desired discrete-time filter. ②Determine the system function Hc(s) or hc(t) of the continuous-time filter. ③System function H(z) or h[n] of discrete-time filter is obtained by applying transformation to Hc(s) or hc(t).

32 ① Transformation of specifications from discrete to continuous
In impulse invariance design procedure, assuming the aliasing in transformation is neglected, relation of specifications in transformation is:

33 Steps of DT filter design by transforming a prototype continuous-time filter
①Obtain the specifications for continuous-time filter by transforming the specifications for the desired discrete-time filter. ②Determine the system function Hc(s) or hc(t) of the continuous-time filter. ③System function H(z) or h[n] of discrete-time filter is obtained by applying transformation to Hc(s) or hc(t).

34 ②Determine the system function Hc(s) of Continuous-time IIR filters
Butterworth filters Chebyshev Type I filters Chebyshev Type II filters Elliptic filters

35 Steps of DT filter design by transforming a prototype continuous-time filter
①Obtain the specifications for continuous-time filter by transforming the specifications for the desired discrete-time filter. ②Determine the system function Hc(s) or hc(t) of the continuous-time filter. ③System function H(z) or h[n] of discrete-time filter is obtained by applying transformation to Hc(s) or hc(t).

36 ③ find H(z) or h[n] by applying transformation to Hc(s) or hc(t)
Laplace Transform 因果 稳定 impulse invariance z-Transform Left half of the s-plane z-plane: inside unit circle

37 Specifications for the discrete-time filter:
Ex. 7.2 design DT filter by Impulse Invariance with a Butterworth Filter Specifications for the discrete-time filter: passband: stopband: Solution: ① passband: stopband: Assume the effect of aliasing is negligible

38 ② find Hc(s) or hc(t) Butterworth Filter
magnitude-squared function is monotonic function of frequency magnitude characteristics of Butterworth depend on order N.

39 Example 7.2 Impulse Invariance with a Butterworth Filter
monotonic function of frequency

40 Example 7.2 Impulse Invariance with a Butterworth Filter
round N up to passband specifications met exactly stopband specifications exceeded. allows some margin for aliasing

41 Example 7.2 Impulse Invariance with a Butterworth Filter
Plole pairs: Left half of the s-plane

42 Example 7.2 Td=1

43 Example 7.2 Impulse Invariance with a Butterworth Filter
Plole pairs: Left half of the s-plane

44 Example 7.2 Impulse Invariance with a Butterworth Filter
Plole pairs:

45 Example 7.2 ;Ak, Sk same as Td=1 same as Td=1

46 Example 7.2 Impulse Invariance with a Butterworth Filter
Frequency response of 6th-order Butterworth filter Log magnitude in dB Magnitude Group delay

47 Program of Ex.7.2 using Impulse Invariance
clear all; wp=.2*pi; rp=-20*log10( ); ws=.3*pi; rs=-20*log10( ); Fs=1; wap=wp*Fs; was=ws*Fs; [n,wn]=buttord(wap,was,rp,rs,'s') % Note: 's'! [z,p,k]=buttap(n); [bp,ap]=zp2tf(z,p,k) [bs,as]=lp2lp(bp,ap,wn) %[bs,as] = butter(n,wn,'s'); [bz,az]=impinvar(bs,as,Fs) [Hz,Wz] = freqz(bz,az,512); subplot(311);plot(Wz,20*log10(abs(Hz)),'r'); Butterworth analog lowpass filter prototype

48 Program of Ex.7.2 using Impulse Invariance
[Hz,Wz] = freqz(bz,az,512); subplot(311) plot(Wz,20*log10(abs(Hz)),'r');grid on axis ([0 pi ]) set(gca,'XTick',0:0.2*pi:pi) set(gca,'XTickLabel',{'0','0.2π','0.4π','0.6π','0.8π','π'}) set(gca,'YTick',-100:20:20) set(gca,'YTickLabel',{'-100','-80','-60','-40','-20','0','20'}) xlabel('Frequency (Hz)'), ylabel('Magnitude (dB)'); title('Log Magnitude Response '); subplot(312) plot(Wz,(abs(Hz)),'r'); axis ([0 pi 0 1.2]) set(gca,'YTick',0:0.2:1.2) set(gca,'YTickLabel',{'0','0.2','0.4','0.6','0.8','1.0','1.2'}) xlabel('Frequency (Hz)'), ylabel('Magnitude '); title('Magnitude Response '); subplot(313) plot(Wz,(grpdelay(bz,az,Wz)),'r'); axis ([0 pi 0 12]) set(gca,'YTick',0:2:12) set(gca,'YTickLabel',{'0','2','4','6','8','10','12'}) xlabel('Frequency (Hz)'), ylabel('groupdelay '); title('groupdelay ');

49 Program of Ex.7.2 using Impulse Invariance
[Hz,Wz] = freqz(bz,az,512); set(gca,'XTickLabel',{'0','0.2π','0.4π','0.6π','0.8π','π'}) set(gca,'YTick',0:0.2:1.2) set(gca,'YTickLabel',{'0','0.2','0.4','0.6','0.8','1.0','1.2'}) xlabel('Frequency (Hz)'), ylabel('Magnitude '); title('Magnitude Response '); subplot(313) plot(Wz,(grpdelay(bz,az,Wz)),'r'); axis ([0 pi 0 12]) set(gca,'XTick',0:0.2*pi:pi) set(gca,'YTick',0:2:12) set(gca,'YTickLabel',{'0','2','4','6','8','10','12'}) xlabel('Frequency (Hz)'), ylabel('groupdelay '); title('groupdelay ');

50 Program of Ex.7.2 using Impulse Invariance
Log magnitude in dB Magnitude Group delay

51 summary for Impulse Invariance
The basis for Impulse Invariance is to choose an impulse response h[n] for the DT-filter that is similar to h(t) of the CT-filter. If CT filter is bandlimited, then the DT filter frequency response will closely approximate the CT filter frequency response.

52 summary for Impulse Invariance
The relationship between CT and DT frequency is linear; consequently, except for aliasing, the shape of the frequency response is preserved. aliasing frequency

53 7.2.2 Bilinear Transformation
Bilinear transformation can avoid the problem of aliasing. Bilinear transformation maps onto Bilinear transformation:

54 7.2.2 Bilinear Transformation

55 7.2.2 Bilinear Transformation

56 7.2.2 Bilinear Transformation
Derivation (textbook): relationship between w and Ω

57 relation between frequency response for CT, DT filter
2018年11月16日7时43分 relation between frequency response for CT, DT filter Same tolerance limit for Passband, stopband

58 Comments on the Bilinear Transformation
It avoids the problem of aliasing encountered with the use of impulse invariance. It is nonlinear compression of frequency axis. S plane Z plane - S plane Z plane

59 Comments on the Bilinear Transformation
bilinear transformation is useful only when this compression can be tolerated or compensated for, as the case of filters that approximate ideal piecewise-constant magnitude- response characteristics.

60 Bilinear Transformation of
distortion in the frequency axis also manifests warping of the phase response of the filter

61 Comparisons of Impulse Invariance and Bilinear Transformation
The use of bilinear transformation is restricted to the design of approximations to filters with piecewise-constant magnitude-response characteristics, such as highpass, lowpass and bandpass filters. Impulse invariance can be used to design lowpass filters. However, it cannot be used to map highpass CT designs to highpass DT designs because they are not bandlimited.

62 Comparisons of Impulse Invariance and Bilinear Transformation
Bilinear transformation cannot design filter whose magnitude-response isn’t piecewise constant, like differentiator. However, Impulse invariance can design an bandlimited differentiator.

63 7.3 Discrete-Time Butterworth, Chebyshev and Elliptic Filters
Ap­pendix B: characteristics of these three classes of continuous­ time filters. Butterworth Filter monotonic

64 7.3 Discrete-Time Butterworth, Chebyshev and Elliptic Filters
Chebyshev I Filter. 双曲余弦 Chebyshev polynomial x x

65 Chebyshev filters Chebyshev filter (type II) Chebyshev filter (type I)
1 Chebyshev filter (type I)

66 elliptic filters N阶雅可比(Jacobian)椭圆函数 ε为通带波纹参数,N为阶数。

67 elliptic filters N阶雅可比(Jacobian)椭圆函数
[n,wn]=ellipord(wap,was,rp,rs,'s') MATLAB函数涉及参数 ε为通带波纹参数,N为阶数由下式决定:

68 Design Butterworth, Chebyshev and Elliptic Filters
maximum passband gain passband gain at passband edge (minimum passband gain) maximum stopband gain 1 MATLAB函数涉及参数 容限图 衰减 edge [n,wn]=ellipord(wap,was,rp,rs,'s') [z,p,k]=ellipap(n,rp,rs);

69 Design Butterworth, Chebyshev and Elliptic Filters
minimum passband gain maximum stopband gain 用MATLAB函数: 衰减 [n,wn]=ellipord(wap,was,rp,rs,'s') % Note: 's'!模拟滤波器 [z,p,k]=ellipap(n,rp,rs); 原型低通椭圆滤波器: 截止频率wn=1 [n,wn]=buttord(wap,was,rp,rs,‘s’) ;模拟 [z,p,k]=buttap(n); 原型巴特沃斯滤波器: 截止频率wn=1 [n,wn]=cheb1ord(wap,was,rp,rs,'s') % 's'! [z,p,k]=cheb1ap(n,rp);模拟原型切比雪夫I型滤波器 [bp,ap]=zp2tf(z,p,k) [bs,as]=lp2lp(bp,ap,wn) [bz,az]=bilinear(bs,as,Fs) [bz,az]=impinvar(bs,as,Fs)

70 7.3 Discrete-Time Butterworth, Chebyshev and Elliptic Filters
7.3.1 Examples of IIR Filter Design Example 7.3 is to illustrate the steps in the design of a Butterworth filter using the bilinear transformation. Example 7.4, 7.5 illustrate design of: Butterworth Filter; Chebyshev (I, II) Approximation; Elliptic Approximation

71 Bilinear Transformation of a Butterworth Filter
Ex.7.3 Design DT filter, given specification: Solution: (1) CT fiter spec., (prewarp) monotonic

72 Ex.7.3 Bilinear Transformation: Butterworth Filter
passband specifications exceeded. stopband specifications met exactly (2) Butterworth Filter

73 Example 7.3 Bilinear Transformation of a Butterworth Filter
Left half of the s-plane Plole pairs:

74 Example 7.3 Bilinear Transformation of a Butterworth Filter
Plole pairs: (3) same as

75 Ex. 7.3 frequency response of DT filter
Log magnitude in dB Magnitude Group delay

76 Program of Ex.7.3 by Bilinear Transformation
clear all; wp=.2*pi; rp=-20*log10( ); ws=.3*pi; rs=-20*log10( ); Fs=1; wap=2*Fs*tan(wp/2);was=2*Fs*tan(ws/2); [n,wn]=buttord(wap,was,rp,rs,'s') % Note: 's'! [z,p,k]=buttap(n); [bp,ap]=zp2tf(z,p,k) [bs,as]=lp2lp(bp,ap,wn) %[bs,as] = butter(n,wn,'s'); [bz,az]=bilinear(bs,as,Fs) [Hz,Wz] = freqz(bz,az,512); subplot(311);plot(Wz,20*log10(abs(Hz)),'r'); Butterworth analog lowpass filter prototype [n,Wn]=buttord(.2*pi/pi,0.3*pi/pi,rp,rs) % no 's‘! [bs,as] = butter(n,wn);

77 Program of Ex.7.3 by Bilinear Transformation
[Hz,Wz] = freqz(bz,az,512); subplot(311) plot(Wz,20*log10(abs(Hz)),'r');grid on axis ([0 pi ]) set(gca,'XTick',0:0.2*pi:pi) set(gca,'XTickLabel',{'0','0.2π','0.4π','0.6π','0.8π','π'}) set(gca,'YTick',-100:20:20) set(gca,'YTickLabel',{'-100','-80','-60','-40','-20','0','20'}) xlabel('Frequency (Hz)'), ylabel('Magnitude (dB)'); title('Log Magnitude Response '); subplot(312) plot(Wz,(abs(Hz)),'r'); axis ([0 pi 0 1.2]) set(gca,'YTick',0:0.2:1.2) set(gca,'YTickLabel',{'0','0.2','0.4','0.6','0.8','1.0','1.2'}) xlabel('Frequency (Hz)'), ylabel('Magnitude '); title('Magnitude Response '); subplot(313) plot(Wz,(grpdelay(bz,az,Wz)),'r'); axis ([0 pi 0 12]) set(gca,'YTick',0:2:12) set(gca,'YTickLabel',{'0','2','4','6','8','10','12'}) xlabel('Frequency (Hz)'), ylabel('groupdelay '); title('groupdelay ');

78 Program of Ex.7.3 by Bilinear Transformation
Log magnitude in dB Magnitude Group delay

79 Program of Ex.7.3直接用数字滤波器设计指令
clear all; Fs=1 wp=.2*pi; rp=-20*log10( ); ws=.3*pi; rs=-20*log10( ); [n,Wn]=buttord(.2*pi/pi,0.3*pi/pi,rp,rs) % no 's'! [bz,az]=butter(n,Wn); freqz(bz,az,512, Fs) axis ([ ]) figure zplane(bz,az) [z,p,k]=tf2zp(bz,az) zplane(z,p,k) 6-order zeros

80 7.3.1 Examples of IIR Filter Design
Example7.4 design Butterworth, Chebyshev I,II, Elliptic filter. maximum passband gain minimum passband gain maximum stopband gain given specification:

81 Program of Ex.7.4 by Bilinear Transformation
clear all; wp=.5*pi; rp=0.3; ws=.6*pi; rs=30; Fs=1; wap=2*Fs*tan(wp/2); was=2*Fs*tan(ws/2); [n,wn]=buttord(wap,was,rp,rs,'s') % Note: 's'! [z,p,k]=buttap(n); [bp,ap]=zp2tf(z,p,k) [bs,as]=lp2lp(bp,ap,wn) %[bs,as] = butter(n,wn,'s'); [bz,az]=bilinear(bs,as,Fs) [Hz,Wz] = freqz(bz,az,512); subplot(311);plot(Wz,20*log10(abs(Hz)),'r'); Butterworth analog lowpass filter prototype [n,Wn]=buttord(.2*pi/pi,0.3*pi/pi,rp,rs) % no 's‘! [bs,as] = butter(n,wn);

82 Program of Ex.7.4 by Bilinear Transformation
[Hz,Wz] = freqz(bz,az,512); subplot(311) plot(Wz,20*log10(abs(Hz)),'r');grid on axis ([0 pi ]) set(gca,'XTick',0:0.2*pi:pi) set(gca,'XTickLabel',{'0','0.2π','0.4π','0.6π','0.8π','π'}) set(gca,'YTick',-50:10:10) set(gca,'YTickLabel',{'-50','-40','-30','-20','-10','0','10'}) xlabel('Frequency (Hz)'), ylabel('Magnitude (dB)'); title('Log Magnitude Response '); subplot(312) plot(Wz,(abs(Hz)),'r'); axis ([0 pi ]) set(gca,'YTick',0.94:0.02:1.02) set(gca,'YTickLabel',{'0.94','0.96','0.98','1','1.02'}) xlabel('Frequency (Hz)'), ylabel('Magnitude '); title('Magnitude Response '); subplot(313) plot(Wz,(grpdelay(bz,az,Wz)),'r'); axis ([0 pi 0 22]) set(gca,'YTick',0:5:25) set(gca,'YTickLabel',{'0','5','10','15','20','25'}) xlabel('Frequency (Hz)'), ylabel('groupdelay '); title('groupdelay ');

83 Ex.7.4 Butterworth filter Log magnitude in dB Magnitude Group delay

84 Program of Ex.7.4 by Bilinear Transformation
Butterworth filter clear all; wp=.5*pi; rp=0.3; ws=.6*pi; rs=30; Fs=1; [n,wn]=buttord(wp/pi,ws/pi,rp,rs) % Note: no's'! [z,p,k] = butter(n,wn,'low'); [sos,g] = zp2sos(z,p,k); % Convert to SOS form Hd=dfilt.df2tsos(sos,g); % Create a dfilt object h=fvtool(Hd); % Plot magnitude response set(h,'Analysis','freq') % Display frequency response figure zplane(z,p,k)

85 Program of Ex.7.4直接用数字滤波器设计指令
clear all; Fs=1 wp=.5*pi; rp=0.3; ws=.6*pi; rs=30; Fs=1; [n,Wn]=buttord(wp/pi,ws/pi,rp,rs) % no 's'! [bz,az]=butter(n,Wn); freqz(bz,az,512, Fs) axis ([0 ws/2 -rs 0]) [z,p,k]=butter(n,Wn); Butterworth filter 15 zeros figure zplane(bz,az) [z,p,k]=tf2zp(bz,az) zplane(z,p,k)

86 Program of Ex.7.4直接用数字滤波器设计指令
clear all; Fs=1 wp=.5*pi; rp=0.3; ws=.6*pi; rs=30; Fs=1; [n,Wn]=buttord(wp/pi,ws/pi,rp,rs) % no 's'! [bz,az]=butter(n,Wn); freqz(bz,az,512, Fs) axis ([0 ws/2 -rs 0]) [z,p,k]=butter(n,Wn); 15 order zeros [z,p,k]=tf2zp(bz,az) zplane(z,p,k) figure zplane(bz,az)

87 Program of Ex.7.4直接用数字滤波器设计指令
Chebyshev I filter clear all; Fs=1 wp=.5*pi; rp=0.3; ws=.6*pi; rs=30; Fs=1; [n,Wn]=cheb1ord(wp/pi,ws/pi,rp,rs) % no 's'! [bz,az]=cheby1(n,rp,Wn); freqz(bz,az,512, Fs) axis ([0 ws/2 -rs 0]) [z,p,k]=tf2zp(bz,az) [z,p,k]=cheby1(n,rp,Wn); figure zplane(z,p,k) 7 order zeros

88 Program of Ex.7.4 by Bilinear Transformation
[Hz,Wz] = freqz(bz,az,512); subplot(311) plot(Wz,20*log10(abs(Hz)),'r');grid on axis ([0 pi ]) set(gca,'XTick',0:0.2*pi:pi) set(gca,'XTickLabel',{'0','0.2π','0.4π','0.6π','0.8π','π'}) set(gca,'YTick',-50:10:10) set(gca,'YTickLabel',{'-50','-40','-30','-20','-10','0','10'}) xlabel('Frequency (Hz)'), ylabel('Magnitude (dB)'); title('Log Magnitude Response '); subplot(312) plot(Wz,(abs(Hz)),'r'); axis ([0 pi ]) set(gca,'YTick',0.94:0.02:1.02) set(gca,'YTickLabel',{'0.94','0.96','0.98','1','1.02'}) xlabel('Frequency (Hz)'), ylabel('Magnitude '); title('Magnitude Response '); subplot(313) plot(Wz,(grpdelay(bz,az,Wz)),'r'); axis ([0 pi 0 22]) set(gca,'YTick',0:5:25) set(gca,'YTickLabel',{'0','5','10','15','20','25'}) xlabel('Frequency (Hz)'), ylabel('groupdelay '); title('groupdelay '); Chebyshev I filter

89 Ex.7.4 Chebyshev I filter Log magnitude in dB Magnitude Group delay

90 Program of Ex.7.4直接用数字滤波器设计指令
Chebyshev II filter clear all; Fs=1 wp=.5*pi; rp=0.3; ws=.6*pi; rs=30; Fs=1; [n,Wn]=cheb2ord(wp/pi,ws/pi,rp,rs) % no 's'! [bz,az]=cheby2(n,rs,Wn); freqz(bz,az,512, Fs) axis ([0 ws/2 -rs 0]) [z,p,k]=cheby2(n,rs,Wn); [z,p,k]=tf2zp(bz,az) figure zplane(z,p,k) zplane(bz,az) 7 order zeros

91 Program of Ex.7.4 by Bilinear Transformation
[Hz,Wz] = freqz(bz,az,512); subplot(311) plot(Wz,20*log10(abs(Hz)),'r');grid on axis ([0 pi ]) set(gca,'XTick',0:0.2*pi:pi) set(gca,'XTickLabel',{'0','0.2π','0.4π','0.6π','0.8π','π'}) set(gca,'YTick',-50:10:10) set(gca,'YTickLabel',{'-50','-40','-30','-20','-10','0','10'}) xlabel('Frequency (Hz)'), ylabel('Magnitude (dB)'); title('Log Magnitude Response '); subplot(312) plot(Wz,(abs(Hz)),'r'); axis ([0 pi ]) set(gca,'YTick',0.94:0.02:1.02) set(gca,'YTickLabel',{'0.94','0.96','0.98','1','1.02'}) xlabel('Frequency (Hz)'), ylabel('Magnitude '); title('Magnitude Response '); subplot(313) plot(Wz,(grpdelay(bz,az,Wz)),'r'); axis ([0 pi 0 22]) set(gca,'YTick',0:5:25) set(gca,'YTickLabel',{'0','5','10','15','20','25'}) xlabel('Frequency (Hz)'), ylabel('groupdelay '); title('groupdelay '); Chebyshev II filter

92 Ex.7.4 Chebyshev II filter Log magnitude in dB Magnitude Group delay

93 Program of Ex.7.4直接用数字滤波器设计指令
Elliptic filter clear all; Fs=1 wp=.5*pi; rp=0.3; ws=.6*pi; rs=30; Fs=1; [n,Wn]=ellipord(wp/pi,ws/pi,rp,rs) % no 's'! [bz,az]=ellip(n,rp,rs,Wn); freqz(bz,az,512, Fs) axis ([0 ws/2 -rs 0]) [z,p,k]=ellip(n,rp,rs,Wn); [z,p,k]=tf2zp(bz,az) figure zplane(z,p,k) zplane(bz,az) 5 order zeros

94 Program of Ex.7.4 by Bilinear Transformation
[Hz,Wz] = freqz(bz,az,512); subplot(311) plot(Wz,20*log10(abs(Hz)),'r');grid on axis ([0 pi ]) set(gca,'XTick',0:0.2*pi:pi) set(gca,'XTickLabel',{'0','0.2π','0.4π','0.6π','0.8π','π'}) set(gca,'YTick',-50:10:10) set(gca,'YTickLabel',{'-50','-40','-30','-20','-10','0','10'}) xlabel('Frequency (Hz)'), ylabel('Magnitude (dB)'); title('Log Magnitude Response '); subplot(312) plot(Wz,(abs(Hz)),'r'); axis ([0 pi ]) set(gca,'YTick',0.94:0.02:1.02) set(gca,'YTickLabel',{'0.94','0.96','0.98','1','1.02'}) xlabel('Frequency (Hz)'), ylabel('Magnitude '); title('Magnitude Response '); subplot(313) plot(Wz,(grpdelay(bz,az,Wz)),'r'); axis ([0 pi 0 22]) set(gca,'YTick',0:5:25) set(gca,'YTickLabel',{'0','5','10','15','20','25'}) xlabel('Frequency (Hz)'), ylabel('groupdelay '); title('groupdelay '); Elliptic filter

95 Ex.7.4 Elliptic filter Log magnitude in dB Magnitude Group delay

96 Program of Ex.7.4直接用数字滤波器设计指令
Elliptic filter clear all; Fs=1 wp=.5*pi; rp=0.3; ws=.6*pi; rs=43; Fs=1; [n,Wn]=ellipord(wp/pi,ws/pi,rp,rs) % no 's'! [bz,az]=ellip(n,rp,rs,Wn); freqz(bz,az,512, Fs) axis ([0 ws/2 -rs 0]) [z,p,k]=ellip(n,rp,rs,Wn); [z,p,k]=tf2zp(bz,az) figure zplane(z,p,k) zplane(bz,az) 5 order zeros

97 Program of Ex.7.4 by Bilinear Transformation
[Hz,Wz] = freqz(bz,az,512); subplot(311) plot(Wz,20*log10(abs(Hz)),'r');grid on axis ([0 pi ]) set(gca,'XTick',0:0.2*pi:pi) set(gca,'XTickLabel',{'0','0.2π','0.4π','0.6π','0.8π','π'}) set(gca,'YTick',-50:10:10) set(gca,'YTickLabel',{'-50','-40','-30','-20','-10','0','10'}) xlabel('Frequency (Hz)'), ylabel('Magnitude (dB)'); title('Log Magnitude Response '); subplot(312) plot(Wz,(abs(Hz)),'r'); axis ([0 pi ]) set(gca,'YTick',0.94:0.02:1.02) set(gca,'YTickLabel',{'0.94','0.96','0.98','1','1.02'}) xlabel('Frequency (Hz)'), ylabel('Magnitude '); title('Magnitude Response '); subplot(313) plot(Wz,(grpdelay(bz,az,Wz)),'r'); axis ([0 pi 0 22]) set(gca,'YTick',0:5:25) set(gca,'YTickLabel',{'0','5','10','15','20','25'}) xlabel('Frequency (Hz)'), ylabel('groupdelay '); title('groupdelay '); Elliptic filter

98 Ex.7.4 Elliptic filter Log magnitude in dB rs=43 Magnitude Group delay

99 Ex.7.4 Elliptic filter Log magnitude in dB rp=0.019 Magnitude Group delay

100 7.3.1 Examples of IIR Filter Design
Example7.5 Design Example for Comparison with FIR Designs(Section7.8.1 ).design Butterworth, Chebyshev I,II, Elliptic filter. given specification: Rescaling:

101 7.3.1 Examples of IIR Filter Design
Example7.5 Design Example for Comparison with FIR Designs(Section7.8.1 ).design Butterworth, Chebyshev I,II, Elliptic filter. given specification: 编程设计按: Rescaling:

102 Example 7.5 Butterworth Approximation
1.007 CT filter specification

103 Example 7.5 frequency response
Log magnitude in dB Magnitude in passband only Group delay

104 Example 7.5 frequency response
1.007 Magnitude in passband only passband edge frequency 0.99 passband stopband 0.983

105 Program of Ex.7.5 by Bilinear Transformation
clear all; Fs=1; e=0.007 wp=.4*pi; rp=-20*log10(0.99*(1/(1+e))); ws=.6*pi ; rs=-20*log10(0.001*(1/(1+e))); wap=2*Fs*tan(wp/2);was=2*Fs*tan(ws/2); [n,wn]=buttord(wap,was,rp,rs,'s') % Note: 's'! [z,p,k]=buttap(n); [bp,ap]=zp2tf(z,p,k) [bs,as]=lp2lp(bp,ap,wn) % [bs,as] = butter(n,wn,'s'); [bz,az]=bilinear(bs,as,Fs) bz=bz *(1+e); [Hz,Wz] = freqz(bz,az,512); % Hz=Hz*(1+e);

106 Program of Ex.7.5 by Bilinear Transformation
[Hz,Wz] = freqz(bz,az,512); % Hz=Hz*(1+e); subplot(311) plot(Wz,20*log10(abs(Hz)),'r'); axis ([0 pi ]) set(gca,'XTick',0:0.2*pi:pi) set(gca,'XTickLabel',{'0','0.2π','0.4π','0.6π','0.8π','π'}) set(gca,'YTick',-100:20:20) set(gca,'YTickLabel',{'-100','-80','-60','-40','-20','0','20'}) xlabel('Frequency (Hz)'), ylabel('Magnitude (dB)'); title('Log Magnitude Response '); subplot(312) plot(Wz,(abs(Hz)),'r'); axis ([0 pi ]) set(gca,'YTick',0.99:0.005:1.01) set(gca,'YTickLabel',{'0.99','0.995','1.0','1.005','1.01'}) xlabel('Frequency (Hz)'), ylabel('Magnitude '); title('Magnitude Response '); subplot(313) plot(Wz,(grpdelay(bz,az,Wz)),'r'); axis ([0 pi 0 25]) set(gca,'YTick',0:5:25) set(gca,'YTickLabel',{'0','5','10','15','20','25'}) xlabel('Frequency (Hz)'), ylabel('groupdelay '); title('groupdelay ');

107 Program of Ex.7.5 by Bilinear Transformation
Log magnitude in dB Frequency response Magnitude Group delay

108 Program of Ex.7.5直接用数字滤波器设计指令
clear all; Fs=1; e=0.007 wp=.4*pi; rp=-20*log10(0.99*(1/(1+e))); ws=.6*pi ; rs=-20*log10(0.001*(1/(1+e))); [n,Wn]=buttord(.4*pi/pi, .6*pi/pi,rp,rs) % no's'! [z,p,k]=butter(n,Wn); [sos,g] = zp2sos(z,p,k); Hd = dfilt.df2tsos(sos,g); h = fvtool(Hd) figure zplane(z,p,k) [bz,az]=zp2tf (z,p,k)

109 Chebyshev filters Chebyshev filter (type I) Chebyshev filter (type II)
1

110 Example 7.5 Chebyshev Type I , II Approximation

111 Example 7.5 frequency response of Chebyshev
Type I Type II Magnitude in passband only

112 Program of Ex.7.5 by Bilinear Transformation
% Chebyshev I Matlab program: clear all; Fs=1; e=0.007(书图中最大幅值大约值1+e) wp=.4*pi; rp=-20*log10(0.99*(1/(1+e))); ws=.6*pi ; rs=-20*log10(0.001*(1/(1+e))); wap=2*Fs*tan(wp/2);was=2*Fs*tan(ws/2); [n,wn]=cheb1ord(wap,was,rp,rs,'s') % 's'! [z,p,k]=cheb1ap(n,rp); [bp,ap]=zp2tf(z,p,k) [bs,as]=lp2lp(bp,ap,wn) % [bs,as] = cheby1(n,rp,wn,'s'); [bz,az]=bilinear(bs,as,Fs) bz=bz *(1+e);

113 Program of Ex.7.5 by Bilinear Transformation
% Chebyshev II Matlab program clear all; Fs=1; e=0.007 wp=.4*pi; rp=-20*log10(0.99*(1/(1+e))); ws=.6*pi ; rs=-20*log10(0.001*(1/(1+e))); wap=2*Fs*tan(wp/2);was=2*Fs*tan(ws/2); [n,wn]=cheb2ord(wap,was,rp,rs,'s') [z,p,k]=cheb2ap(n,rs); [bp,ap]=zp2tf(z,p,k) [bs,as]=lp2lp(bp,ap,wn) %[bs,as] = cheby2(n,rs,wn,'s'); [bz,az]=bilinear(bs,as,Fs) bz=bz *(1+e); be careful !

114 Program of Ex.7.5 by Bilinear Transformation
[Hz,Wz] = freqz(bz,az,512); %Hz=Hz*(1+e); subplot(311) plot(Wz,20*log10(abs(Hz)),'r'); axis ([0 pi ]) set(gca,'XTick',0:0.2*pi:pi) set(gca,'XTickLabel',{'0','0.2π','0.4π','0.6π','0.8π','π'}) set(gca,'YTick',-100:20:20) set(gca,'YTickLabel',{'-100','-80','-60','-40','-20','0','20'}) xlabel('Frequency (Hz)'), ylabel('Magnitude (dB)'); title('Log Magnitude Response '); subplot(312) plot(Wz,(abs(Hz)),'r'); axis ([0 pi ]) set(gca,'YTick',0.99:0.005:1.01) set(gca,'YTickLabel',{'0.99','0.995','1.0','1.005','1.01'}) xlabel('Frequency (Hz)'), ylabel('Magnitude '); title('Magnitude Response '); subplot(313) plot(Wz,(grpdelay(bz,az,Wz)),'r'); axis ([0 pi 0 25]) set(gca,'YTick',0:5:25) set(gca,'YTickLabel',{'0','5','10','15','20','25'}) xlabel('Frequency (Hz)'), ylabel('groupdelay '); title('groupdelay ');

115 Program of Ex.7.5 by Bilinear Transformation
Frequency response Chebyshev I型

116 Program of Ex.7.5 by Bilinear Transformation
Log magnitude in dB Frequency response Chebyshev II型 Magnitude in passband Group delay

117 Program of Ex.7.5直接用数字滤波器设计指令
% Chebyshev I型M程序如下 clear all; Fs=1; e=0.007 wp=.4*pi; rp=-20*log10(0.99*(1/(1+e))); ws=.6*pi ; rs=-20*log10(0.001*(1/(1+e))); [n,wn]=cheb1ord (.4*pi/pi,0.6*pi/pi,rp,rs) [z,p,k]= cheby1(n,rp,wn); k=k*(1+e); [sos,g] = zp2sos(z,p,k); Hd = dfilt.df2tsos(sos,g); h = fvtool(Hd) figure zplane(z,p,k) [bz,az]=zp2tf (z,p,k) zplane(bz,az)

118 Program of Ex.7.5直接用数字滤波器设计指令
% Chebyshev II型M程序如下 clear all; Fs=1; e=0.007 wp=.4*pi; rp=-20*log10(0.99*(1/(1+e))); ws=.6*pi ; rs=-20*log10(0.001*(1/(1+e))); [n,wn]=cheb2ord (.4*pi/pi,0.6*pi/pi,rp,rs) [z,p,k]= cheby2(n,rs,wn); k=k*(1+e); [sos,g] = zp2sos(z,p,k); Hd = dfilt.df2tsos(sos,g); h = fvtool(Hd) figure zplane(z,p,k) [bz,az]=zp2tf (z,p,k) zplane(bz,az)

119 elliptic filters N阶雅可比(Jacobian)椭圆函数 ε为通带波纹参数,N为阶数。

120 Example 7.5 Elliptic Approximation

121 Example 7.5 frequency response of Elliptic
Log magnitude in dB Magnitude in passband Group delay

122 Program of Ex.7.5 by Bilinear Transformation
% Elliptic filter M程序如下 clear all; Fs=1; e=0.005 wp=.4*pi; rp=-20*log10(0.99*(1/(1+e))); ws=.6*pi ; rs=-20*log10(0.001*(1/(1+e))); wap=2*Fs*tan(wp/2);was=2*Fs*tan(ws/2); [n,wn]=ellipord(wap,was,rp,rs,'s') [z,p,k]=ellipap(n,rp,rs); [bp,ap]=zp2tf(z,p,k) [bs,as]=lp2lp(bp,ap,wn) %[bs,as] =ellip(n,rp,rs,wn,'s'); [bz,az]=bilinear(bs,as,Fs); bz=bz *(1+e);

123 Program of Ex.7.5 by Bilinear Transformation
[Hz,Wz] = freqz(bz,az,512); %Hz=Hz*(1+e); subplot(311) plot(Wz,20*log10(abs(Hz)),'r'); axis ([0 pi ]) set(gca,'XTick',0:0.2*pi:pi) set(gca,'XTickLabel',{'0','0.2π','0.4π','0.6π','0.8π','π'}) set(gca,'YTick',-100:20:20) set(gca,'YTickLabel',{'-100','-80','-60','-40','-20','0','20'}) xlabel('Frequency (Hz)'), ylabel('Magnitude (dB)'); title('Log Magnitude Response '); subplot(312) plot(Wz,(abs(Hz)),'r'); axis ([0 pi ]) set(gca,'YTick',0.99:0.005:1.01) set(gca,'YTickLabel',{'0.99','0.995','1.0','1.005','1.01'}) xlabel('Frequency (Hz)'), ylabel('Magnitude '); title('Magnitude Response '); subplot(313) plot(Wz,(grpdelay(bz,az,Wz)),'r'); axis ([0 pi 0 25]) set(gca,'YTick',0:5:25) set(gca,'YTickLabel',{'0','5','10','15','20','25'}) xlabel('Frequency (Hz)'), ylabel('groupdelay '); title('groupdelay ');

124 Program of Ex.7.5 by Bilinear Transformation
Log magnitude in dB Frequency response Elliptic filter Magnitude in passband Group delay

125 Program of Ex.7.5直接用数字滤波器设计指令
% Elliptic filter M程序如下 clear all; Fs=1; e=0.007 wp=.4*pi; rp=-20*log10(0.99*(1/(1+e))); ws=.6*pi ; rs=-20*log10(0.001*(1/(1+e))); [n,wn]=ellipord (.4*pi/pi,0.6*pi/pi,rp,rs) [z,p,k]= ellip(n,rp,rs,wn); k=k*(1+e); [sos,g] = zp2sos(z,p,k); Hd = dfilt.df2tsos(sos,g); h = fvtool(Hd) figure zplane(z,p,k) [bz,az]=zp2tf (z,p,k) zplane(bz,az)

126 Butterworth Filter : N=14. ( max flat)
*Comparison of Butterworth, Chebyshev, elliptic filters: Example -Given specification -Order Butterworth Filter : N=14. ( max flat) Chebyshev Filter : N= ( Cheby 1, Cheby 2) Elliptic Filter : N= ( equiripple) B C E

127 -Pole-zero plot (analog)
B C1 C2 E -Pole-zero plot (digital) B C1 C2 E (14) (8)

128 7.4 Frequency Transformations of Lowpass IIR Filters
Design other kinds of filters: High-pass filters Band-pass filters Band-stop filters Multiband filters Tolerance scheme for amultiband filter. Using the results of Low-pass filter and Frequency Band Transformation

129 7.4 Frequency Transformations of Lowpass IIR Filters
Let HLP(Z) be the given prototype lowpass digital filter, and let H(z) be the desired frequency-selective digital filter. Define a mapping: Given that HLP(Z) is a stable and causal filter, we also want H(z) to be stable and causal. This imposes the following requirements:

130 Frequency-band Transformation
stable and causal This imposes the following requirements: G(z-1) must be a rational function in z-1 so that H(z) is implementable. The unit circle of the Z-plane must map onto the unit circle of the z-plane. For stable filters, the inside of the unit circle of the Z-plane must also map onto the inside of the unit circle of the z-plane.

131 7.4 Frequency Transformations of Lowpass IIR Filters
Let θ and ω be the frequency variables (angles) in the Z-plane and z-plane, from condition 3 It is clear, That is, the mapping must be all-pass: where ensures that a stable filter is transformed into another stable filter (i.e. satisfies condition 2).

132 7.4 Frequency Transformations of Lowpass IIR Filters
2018年11月16日7时43分 7.4 Frequency Transformations of Lowpass IIR Filters the one that transforms a lowpass filter into another lowpass filter with different passband and stopband edge frequencies:

133 7.4 Frequency Transformations of Lowpass IIR Filters
Warping of the frequency scale in lowpass-to-lowpass transformation ωp: desired cutoff frequency θp

134 7.4 Frequency Transformations of Lowpass IIR Filters
TABLE 7.1 Transformations from a lowpass digital filter prototype of cutoff frequency ωp to highpass, bandpass, and bandstop filter Filter Type Transformations Associated Design Formulas

135 7.4 Frequency Transformations of Lowpass IIR Filters
TABLE 7.1 Transformations from a lowpass digital filter prototype of cutoff frequency ωp to highpass, bandpass, and bandstop filter Filter Type Transformations Associated Design Formulas

136 7.4 Frequency Transformations of Lowpass IIR Filters
Ex.7.6 Transformation of a Lowpass Filter to a Highpass Filter. Type I Chebyshev lowpass filter specifications: transform the filter to a highpass filter with passband cutoff frequency ωp = 0.6π. from TABLE 7.1

137 7.4 Frequency Transformations of Lowpass IIR Filters
Ex.7.6 Type I Chebyshev Lowpass Filter→ Highpass Filter. θp = 0.6π ωp = 0.6π from TABLE 7.1

138 7.4 Frequency Transformations of Lowpass IIR Filters
Ex.7.6 Transformation of a Type I Chebyshev Lowpass Filter to a Highpass Filter.

139 7.4 Frequency Transformations of Lowpass IIR Filters
Ex.7.6 Type I Chebyshev Lowpass filter to Highpass filter.

140 Program of Ex.7.6 by Bilinear Transformation
clear all; wp=.2*pi; rp=-20*log10( ); ws=.3*pi; rs=-20*log10( ); Fs=1; wnh=.6*pi; wanh=2*Fs*tan(wnh/2); 高通截止频率 wap=2*Fs*tan(wp/2);was=2*Fs*tan(ws/2); [n,wn]=cheb1ord(wap,was,rp,rs,'s') % 's'! [z,p,k]=cheb1ap(n,rp); [bp,ap]=zp2tf(z,p,k) % [bs,as]=lp2lp(bp,ap,wn) [bs,as]=lp2hp(bp,ap,wanh); [bz,az]=bilinear(bs,as,Fs) [Hz,Wz] = freqz(bz,az,512); subplot(311);plot(Wz,20*log10(abs(Hz)),'r');

141 Program of Ex.7.3 by Bilinear Transformation
2018年11月16日7时43分 [Hz,Wz] = freqz(bz,az,512); subplot(311) plot(Wz,20*log10(abs(Hz)),'r');grid on axis ([0 pi ]) set(gca,'XTick',0:0.2*pi:pi) set(gca,'XTickLabel',{'0','0.2π','0.4π','0.6π','0.8π','π'}) set(gca,'YTick',-100:20:20) set(gca,'YTickLabel',{'-100','-80','-60','-40','-20','0','20'}) xlabel('Frequency (Hz)'), ylabel('Magnitude (dB)'); title('Log Magnitude Response '); subplot(312) plot(Wz,(abs(Hz)),'r'); axis ([0 pi 0 1.2]) set(gca,'YTick',0:0.2:1.2) set(gca,'YTickLabel',{'0','0.2','0.4','0.6','0.8','1.0','1.2'}) xlabel('Frequency (Hz)'), ylabel('Magnitude '); title('Magnitude Response '); subplot(313) plot(Wz,(grpdelay(bz,az,Wz)),'r'); axis ([0 pi 0 12]) set(gca,'YTick',0:2:12) set(gca,'YTickLabel',{'0','2','4','6','8','10','12'}) xlabel('Frequency (Hz)'), ylabel('groupdelay '); title('groupdelay ');

142 Program of Ex.7.6 by Bilinear Transformation
clear all; wp=.2*pi; rp=-20*log10( ); ws=.3*pi; rs=-20*log10( ); Fs=1; wnh=.6*pi; wanh=2*Fs*tan(wnh/2); 高通截止频率 wap=2*Fs*tan(wp/2);was=2*Fs*tan(ws/2); [n,wn]=cheb1ord(wap,was,rp,rs,'s') % 's'! [z,p,k]=cheb1ap(n,rp); [bp,ap]=zp2tf(z,p,k) [bs,as]=lp2lp(bp,ap,wn) %[bs,as]=lp2hp(bp,ap,wanh); [bz,az]=bilinear(bs,as,Fs) figure zplane(z,p,k)

143 Program of Ex.7.6 by Bilinear Transformation
clear all; wp=.2*pi; rp=-20*log10( ); ws=.3*pi; rs=-20*log10( ); Fs=1; wnh=.6*pi; wanh=2*Fs*tan(wnh/2); 高通截止频率 wap=2*Fs*tan(wp/2);was=2*Fs*tan(ws/2); [n,wn]=cheb1ord(wap,was,rp,rs,'s') % 's'! [z,p,k]=cheb1ap(n,rp); [bp,ap]=zp2tf(z,p,k) % [bs,as]=lp2lp(bp,ap,wn) [bs,as]=lp2hp(bp,ap,wanh); [bz,az]=bilinear(bs,as,Fs) figure zplane(z,p,k)

144 7.5 Design of FIR Filters by Windowing
FIR filters are designed based on directly approximating the desired frequency response of the discrete-time system. Most techniques for approximating the magnitude response of an FIR system assume a linear phase constraint.

145 Window Method An ideal desired frequency response
Many idealized systems have discontinuous piecewise-constant frequency response, and their impulse responses are noncausal and infinitely long.

146 Window Method The most straightforward approach for obtaining a causal FIR approximation is to truncate the ideal impulse response.

147 Windowing in Frequency Domain
Windowed frequency response The windowed version is smeared version of desired response Gibbs phenomenon

148 Window Method If

149 Choice of Window is as short as possible in duration. This minimizes computation in the implementation of the filter. approximates an impulse.

150 Window Method If is chosen so that is concentrated in a narrow band of frequencies around then would look like , except where changes very abruptly.

151 Rectangular Window for the rectangular window has a generalized linear phase. As M increases, the width of the “main lobe” decreases.

152 will oscillate at the discontinuity.
Rectangular Window will oscillate at the discontinuity. The oscillations occur more rapidly, but do not decrease in magnitude as M increases. Gibbs phenomenon

153 Rectangular Window In theory of Fourier series, this nonuniform convergence, the Gibbs phenomenon can be moderated through the use of less abrupt truncation of the Fourier series.

154 Rectangular Window 使窗锥形化减小到0 By tapering the window smoothly to zero at each end, the height of the side lobes can be diminished. The expense is a wider main lobe and thus a wider transition at the discontinuity. 主瓣

155 7.5.1 Properties of Commonly Used Windows
Rectangular Bartlett (triangular) M-1 non zero values

156 7.5.1 Properties of Commonly Used Windows
Hanning Hamming

157 7.5.1 Properties of Commonly Used Windows
Blackman

158 7.5.1 Properties of Commonly Used Windows

159 主瓣 Hamming Blackman Rectangular Bartlett (triangular) Hanning
Frequency Spectrum of Windows (a)-(e) attenuation of sidelobe increases, width of mainlobe increases.

160 7.5.1 Properties of Commonly Used Windows
Table 7.2 等效的Kaiser窗 边瓣幅值 主瓣 宽度 biggest,high oscillations at discontinuity smallest,the sharpest transition 最小,最陡峭的过渡带

161 7.5.2 Incorporation of Generalized Linear Phase
In designing FIR filters, it is desirable to obtain causal systems with a generalized linear phase response. The above five windows are all symmetric about the point ,i.e.,

162 7.5.2 Incorporation of Generalized Linear Phase
Their Fourier transforms are of the form

163 7.5.2 Incorporation of Generalized Linear Phase
2018年11月16日7时43分 7.5.2 Incorporation of Generalized Linear Phase Hilbert filter hd[n]

164 Frequency Domain Representation
Linear Phase

165 Ex. 7.7 design Linear-Phase Lowpass Filter
The desired frequency response (spec.) verification Solution:

166 magnitude frequency response
2018年11月16日7时43分 magnitude frequency response 选窗 1.选窗 2.定M Example:design a FIR filter 定M

167 例7.7 matlab program for FIR Filter disign,specification:
Solution: clc;clear all; close all wp=0.15*pi; ws=0.25*pi; wdelta=ws-wp; N=ceil(8*pi/wdelta); Wn=( )*pi/2; b=fir1(N,Wn/pi,hanning(N+1)); figure % freqz(b,1,512) [H,w]=freqz(b,1,512) ; plot(w,abs(H)) set(gca,'XTick',0:0.2*pi:pi) set(gca,'XTickLabel',{'0','0.2π','0.4π','0.6π','0.8π','π'}) axis([0,pi,0.97,1.03]); (1)选窗 可选Hanning窗 (2)定M

168 7.5 Design of FIR Filters by Windowing Method
Review To design an lowpass FIR Filters

169 7.5.1 Properties of Commonly Used Windows
等效的Kaiser窗 smallest,the sharpest transition biggest,high oscillations at discontinuity

170 7.5.3 The Kaiser ['kaizə] Window Filter Design Method
Caesar[ˈsi:zə] 凯撒 Trade side-lobe amplitude for main-lobe width

171 7.5.3 The Kaiser ['kaizə] Window Filter Design Method
Transition width Peak approximation error:

172 continuous envelopes of Kaiser windows
(b) M=20 As  increases, attenuation of sidelobe increases, width of mainlobe increases.  =6 (c) As M increases, attenuation of sidelobe is preserved, width of mainlobe decreases. (a) Window shape, M=20 (b) Frequency spectrum, M=20, (c) beta=6, M=10, 20, 40 Figure 7.24

173 2018年11月16日7时43分 Comparison 窗两端减小的越多(窗更锥形化) If the window is tapered more, the side lobe of the Fourier transform become smaller, but the main lobe become wider. Increasing M wile holding  constant causes the main lobe to decrease in width, M=20 but does not affect the amplitude of the side lobe.  =6 M=20

174 Relationship of the Kaiser windows to Other Windows
Table 7.2 Transition width of Equivalent Kaiser Window approximate width of mainlobe a much better predictor of the transition width for the other windows than would the main-lobe width.

175 figure 7.33 a lowpass filter (M = 32 and ωc=π/2).
Relationship of the Kaiser windows to Other Windows Approximation error vs. Transition width[*fixed windows,o=Kaiser(β=整数)] M=20 Bartlett, β=1.33 Hanning, β=3.86 Hamming, β=4.86 Blackman, β=7.04 "Kaiser 6" means β=6 figure 7.33 a lowpass filter (M = 32 and ωc=π/2).

176 7.6 Examples of FIR Filters Design by the Kaiser Window Method
Design Lowpass Filter, Highpass Filter, Discrete-Time Differentiators 7.6.1 Lowpass Filter specifications as in Ex.7.5

177 Filter Design by Kaiser Window
2018年11月16日7时43分 Filter Design by Kaiser Window (1) the specifications must be established : (2) (3) To predict the values of M and β Peak approximation error Transition width

178 Filter Design by Kaiser Window
(3) (4) magnitude response validation, (5) linear phase, group delay

179 Kaiser Window Design of a Lowpass Filter
magnitude response validation, peak approximation error is δ= instead of the desired value of h[n]=[ ] In this case it is necessary to increase M to 38 in order to meet the specifications. phase response

180 Kaiser Window Design of a Lowpass Filter
clear all; clc; wp=0.4*pi; ws=0.6*pi; Wn=(wp+ws)/2; b=fir1(37,Wn/pi, kaiser(38,5.653)); fcuts = [wp/pi ws/pi]; mags = [1 0]; devs = [ ]; [n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs); b= fir1(n,Wn,ftype,kaiser(n+1,beta)); [H,w]=freqz(b,1,2048) ; A(1:ceil(0.4*2048))=1-abs(H(1:ceil(0.4*2048))); A(floor(0.6*2048)-1:2048)=-abs(H(floor(0.6*2048)-1:2048)); A(round(0.4*2048)+1:floor(0.6*2048)-1)=nan; subplot(311) stem(b) subplot(312) plot(w,20*log10(abs(H))) axis([0,pi,-100,20]); subplot(313) plot(w,A) set(gca,'XTick',0:0.2*pi:pi) set(gca,'XTickLabel',{'0','0.2π','0.4π','0.6π','0.8π','π'}) axis([0,pi,-0.001,0.001]);

181 The ideal highpass filter with generalized linear phase

182 Example Kaiser Window Design of a Highpass Filter
Specifications: By Kaiser window method

183 Ex. Kaiser Window Design of a highpass Filter
clear all; clc; wp=0.5*pi; ws=0.35*pi; fcuts = [ws/pi wp/pi]; mags = [0 1]; devs = [ ]; [n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs); b=fir1(n,Wn,ftype,kaiser(n+1,beta)); [H,w]=freqz(b,1,2048) ; A(1:ceil(ws/pi*2048))=-abs(H(1:ceil(ws/pi*2048))); A(floor(wp/pi*2048)-1:2048)=1-abs(H(floor(wp/pi*2048)-1:2048)); A(round(ws/pi*2048)+1:floor(wp/pi*2048)-1)=nan; subplot(311) stem(b) subplot(312) plot(w,20*log10(abs(H))) axis([0,pi,-100,20]); subplot(313) plot(w,A) set(gca,'XTick',0:0.2*pi:pi) set(gca,'XTickLabel',{'0','0.2π','0.4π','0.6π','0.8π','π'}) axis([0,pi,-0.025,0.025]); n =24, beta =2.65

184 Ex. Kaiser Window Design of a highpass Filter
n =24, beta =2.65 n =25, beta =2.65 type II filter zero: z=-1 δ= >0.02 n should be n=26

185 7.6.3 Discrete-Time Differentiator
M=10,even Type III M=5,odd Type IV

186 Example 7.10 Kaiser Window Design of a Differentiator
Suppose Ideal Impulse response Kaiser window type III FIR differentiator. Impulse response

187 Example 7.10 Kaiser Window Design of a Differentiator
Suppose Magnitude response Approximation error for A0(ejW ).

188 Example 7.10 Kaiser Window Design of a Differentiator
Suppose Ideal Impulse response Kaiser window type IV FIR differentiator. Impulse response

189 Example 7.10 Kaiser Window Design of a Differentiator
Suppose Magnitude response Approximation error for A0(ejW ).

190 Group Delay Phase: Group Delay: Noninteger delay

191 7.9 Comments on IIR and FIR Discrete-Time Filters
What type of system is best, IIR or FIR? IIR: closed-form design formulas straightforward noniterative computer programs for IIR filter design. FIR设计后需验证指标, 不满足需增加阶数, 再次(迭代)设计. IIR不需再次(迭代)设计. 一次设计,即满足指标要求。 FIR: can have a (generalized) linear phase iteration may be necessary to meet a prescribed spec­ification. 一次设计,未必满足指标要求

192 7.9 Comments on IIR and FIR Discrete-Time Filters
Why give so many different design methods? Which method yields the best result? Closed-Form Formulas Generalized Linear Phase Order IIR Yes No Low FIR High

193 Zhongguo Liu_Biomedical Engineering_Shandong Univ.
Chapter 5 HW 7.2, 7.4, 7.15, Zhongguo Liu_Biomedical Engineering_Shandong Univ. 207 2018/11/16 返 回 上一页 下一页


Download ppt "Biomedical Signal processing Chapter 7 Filter Design Techniques"

Similar presentations


Ads by Google