Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 17 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
17
Dung lượng
139 KB
Nội dung
Báo cáo th ực t ập DSP Nguy ễn Kim L ễ - 1050927 Nguy ễn V ăn Đờ Ni – 1050953 Laboratory Exercise DIGITAL FILTER DESIGN 7.1 DESIGN OF IIR FILTERS Project 7.1 Estimation of IIR Filter Order Answers: Q7.1 The normalized passband edge angular frequency Wp in radian is: Wp = FP 2.4.10 = = FT 40.10 The normalized stopband edge angular frequency Ws = Ws in radian is: FS 2.8.10 = = FT 40.10 The desired passband ripple Rp in dB is 0.5 The desired stopband ripple Rs is in dB is (1) Using these values and lowpass filter to be 40 buttord we get the lowest order for a Butterworth N=8 The corresponding normalized passband edge frequency (2) Using these values and Wn is Wn = 0.2469 cheb1ord we get the lowest order for a Type Chebyshev lowpass filter to be N = The corresponding normalized passband edge frequency (3) Using these values and Wn is 0.2000 cheb2ord we get the lowest order for a Type Chebyshev lowpass filter to be N = The corresponding normalized passband edge frequency (4) Using these values and lowpass filter to be Wn is 0.4000 ellipord we get the lowest order for an elliptic N=4 From the above results we observe that the meeting the specifications _ellipord_ filter has the lowest order Báo cáo thực tập DSP Q7.2 Nguyễn Kim Lễ - 1050927 Nguyễn Văn Đờ Ni – 1050953 The normalized passband edge angular frequency Wp = FP 2.1050 = = 0,6 FT 3500 The normalized stopband edge angular frequency Ws = Wp in radian is Ws in radian is FS 2.600 = = 12 / 35 FT 3500 The desired passband ripple Rp in dB is Rp = The desired stopband ripple Rs in dB is (1) Using these values and highpass filter to be Rs = 50 buttord we get the lowest order for a Butterworth N= The corresponding normalized passband edge frequency (2) Using these values and Wn is Wn = 0.5646 cheb1ord we get the lowest order for a Type Chebyshev highpass filter to be N = The corresponding normalized passband edge frequency (3) Using these values and cheb2ord we get the lowest order for a Type Chebyshev highpass filter to be N=5 The corresponding normalized passband edge frequency (4) Using these values and highpass filter to be Wn is Wn = 0.6000 Wn is Wn = 0.3429 ellipord we get the lowest order for an elliptic N=4 From the above results we observe that the _ ellipord _ filter has the lowest order meeting the specifications Q7.3 The normalized passband edge angular frequency Wp is Wp = [0.4 0.6] The normalized stopband edge angular frequency Ws is Ws = [0.3 0.7] The desired passband ripple Rp is Rp = 0.4 The desired stopband ripple Rs is Rs = 50 Báo cáo thực tập DSP Nguyễn Kim Lễ - 1050927 Nguyễn Văn Đờ Ni – 1050953 (1) Using these values and bandpass filter to be buttord we get the lowest order for a Butterworth N=9 The corresponding normalized passband edge frequency Wn is Wn = [0.3835 0.6165] (2) Using these values and cheb1ord we get the lowest order for a Type Chebyshev bandpass filter to be N=6 The corresponding normalized passband edge frequency Wn is Wn = [0.4000 0.6000] (3) Using these values and cheb2ord we get the lowest order for a Type Chebyshev bandpass filter to be N=6 The corresponding normalized passband edge frequency Wn is Wn = [0.3000 0.7000] (4) Using these values and bandpass filter to be ellipord we get the lowest order for an elliptic N=4 From the above results we observe that the _ ellipord filter has the lowest order meeting the specifications Q7.4 The normalized passband edge angular frequency Wp is Wp = [0.35 0.75] The normalized stopband edge angular frequency Ws is Ws = [0.45 The desired passband ripple Rp is Rp = 0.6 The desired stopband ripple Rs is Rs = (1) Using these values and bandstop filter to be 0.65] 45 buttord we get the lowest order for a Butterworth N=9 The corresponding normalized passband edge frequent 0.7123] Wn is Wn = [0.3787 Báo cáo thực tập DSP Nguyễn Kim Lễ - 1050927 Nguyễn Văn Đờ Ni – 1050953 (2) Using these values and cheb1ord we get the lowest order for a Type Chebyshev bandstop filter to be N= The corresponding normalized passband edge frequency Wn is – Wn = [0.3500 0.7500] (3) Using these values and cheb2ord we get the lowest order for a Type Chebyshev bandstop filter to be N= The corresponding normalized passband edge frequency Wn is Wn = [0.4500 0.6500] (4) Using these values and bandstop filter to be ellipord we get the lowest order for an elliptic N= From the above results we observe that the _ ellipord _ filter has the lowest order meeting the specifications Project 7.2 IIR Filter Design A copy of Program P7_1 is given below: % Program P7_1 % Design of a Butterworth Bandstop Digital Filter Ws = [0.4 0.6]; Wp = [0.2 0.8]; Rp = 0.4; Rs = 50; % Estimate the Filter Order [N1, Wn1] = buttord(Wp, Ws, Rp, Rs); % Design the Filter [num,den] = butter(N1,Wn1,'stop'); % Display the transfer function disp('Numerator Coefficients are ');disp(num); disp('Denominator Coefficients are ');disp(den); % Compute the gain response [g, w] = gain(num,den); % Plot the gain response plot(w/pi,g);grid axis([0 -60 5]); xlabel('\omega /\pi'); ylabel('Gain in dB'); title('Gain Response of a Butterworth Bandstop Filter'); %Compute the frequence response hh=freqz([0.0493 0.0000 0.2465 0.0000 0.4930 0.4930 0.0000 0.2465 0.0000 0.0493], [1.0000 -0.0850 0.0000 0.6360 0.0000 -0.0288 0.0000 0.0000 -0.0008],w); h=abs(hh); 0.0000 0.0000 0.0561 Báo cáo thực tập DSP Nguyễn Kim Lễ - 1050927 Nguyễn Văn Đờ Ni – 1050953 n=256; F=10000; f=F/(2*n)*(0:n-1) subplot(2,2,2) plot(f,h); grid; title('Butterworth Bandstop Digital Filter'); xlabel('Tan so, Hz'); ylabel('Bien do'); Answers: The coefficients of the Butterworth bandstop transfer function generated by running Program P7_1 are as follows : The exact expression for the transfer function is H(z) = 0.093 + 0.2465 z −2 + 0.4930 z −4 − 0.4930 z −6 + 0.2465 z −8 − 0.0493 z −10 + 0.6360 z −4 − 0.0288 z −6 + 0.0561z −8 − 0.0008 z −10 The gain response of the filter as designed is given below : Gain Response of a Butterworth Bandstop Filter Butterworth Bandstop Digital Filter 1.5 Bien Gain in dB Q7.5 -20 0.5 -40 -60 0.2 0.4 0.6 0.8 ω /π From the plot we conclude that the design 1000 2000 3000 Tan so, Hz 4000 5000 the specifications The plot of the unwrapped phase response and the group delay response of this filter is given below: Báo cáo thực tập DSP Nguyễn Kim Lễ - 1050927 Nguyễn Văn Đờ Ni – 1050953 Gain Response of a Butterworth Bandstop Filter Dap ung pha 0.8 0.6 -10 Gain in dB 0.4 -20 0.2 -30 -0.2 -40 -0.4 -0.6 -50 -0.8 -60 0.2 0.4 0.6 0.8 -1 0.2 0.4 0.6 Tan so, ω/π ω/π Q7.6 0.8 The coefficients of the Type Chebyshev lowpass transfer function for the parameters given in Question 7.1 and generated by running modified Program P7_1 are as follows: The exact expression for the transfer function is H(z) = 0.0219 + 0.1097 z −1 + 0.2194 z −2 + 0.2194 z −3 + 0.1097 z −4 + 0.0219 z −5 − 0.9853 z −1 + 0.9738 z −2 − 0.3864 z −3 + 0.1112 z −4 − 0.0113 z −5 The gain response of the filter as designed is given below : G ain Response of a Butterw orth Bandstop Filter Butterworth cheb1ord low pass Digital Filter 1.4 1.2 -10 -20 Bien G ain in dB -30 0.8 0.6 -40 Gain in dB 0.4 -50 -60 0.2 0.2 0.4 0.6 0.8 0 ω/π From the plot we conclude that the design 0.5 T an so, H z 1.5 x 10 the specifications The plot of the unwrapped phase response and the group delay response of this filter is given below: Báo cáo thực tập DSP Nguyễn Kim Lễ - 1050927 Nguyễn Văn Đờ Ni – 1050953 Butterw orthcheb1ord low pass D igital Filter D ap ungpha 1.4 0.8 1.2 0.6 Bien 0.4 0.2 0.8 0.6 -0.2 -0.4 0.4 -0.6 0.2 -0.8 0 0.5 T an so, H z 1.5 -1 0.2 0.4 0.6 T anso, ω /π x 10 0.8 Q7.7 The coefficients of the Type Chebyshev highpass transfer function for the parameters given in Question 7.2 and generated by running modified Program P7_1 are as follows: The exact expression for the transfer function is 0.1561 − 0.7803z −1 + 1.5606 z −2 − 1.5606 z −3 + 0.7803z −4 − 0.1561z −5 − 1.5504 z −1 + 1.4796 z −2 − 0.7322 z −3 + 0.2074 z −4 − 0.0242 z −5 The gain response of the filter as designed is given below : G a inR e sp o n seo f aB u tte rw o rthp a ssb a n dF ilte r B u tte rw o rthch e b o rdh ig h p a ss D ig ita lF ilte r -1 -2 B ie nd o G a inind B H(f) = -3 -4 0 -5 -6 0 2 0 ω/π From the plot we conclude that the design T a nso ,H z x1 the specifications The plot of the unwrapped phase response and the group delay response of this filter is given below: Báo cáo thực tập DSP Nguyễn Kim Lễ - 1050927 Nguyễn Văn Đờ Ni – 1050953 Gain Response of a Butterworth Bandstop Filter Dap ung pha 0.8 0.6 -10 Gain in dB 0.4 -20 0.2 -30 -0.2 -40 -0.4 -0.6 -50 -0.8 -60 0.2 0.4 0.6 0.8 -1 0.2 ω/π Q7.8 0.4 0.6 T an so, ω /π 0.8 The coefficients of the elliptic bandpass transfer function for the parameters given in Question 7.3 and generated by running modified Program P7_1 are as follows: The exact expression for the transfer function is H(f) = 0.0048 z − 0.0193 z −2 + 0.0289 z −4 − 0.0193 z −6 + 0.048 z −8 + 2.3695 z −2 + 2.3140 z −4 +1.0547 z −6 + 0.1874 z −8 The gain response of the filter as designed is given below : Gain Response of a Butterworth Bandstop Filter Butterworth Bandstop Digital Filter 0.9 0.8 -10 -20 Bien Gain in dB 0.7 -30 0.6 0.5 0.4 -40 0.3 0.2 -50 0.1 -60 0.2 0.4 0.6 0.8 0 ω/π From the plot we conclude that the design 500 1000 1500 2000 Tan so, Hz 2500 3000 3500 the specifications The plot of the unwrapped phase response and the group delay response of this filter is given below: Báo cáo thực tập DSP Nguyễn Kim Lễ - 1050927 Nguyễn Văn Đờ Ni – 1050953 Bien Butterworth Bandstop Digital Filter 0.9 0.8 0.8 0.6 0.7 0.4 0.6 0.2 0.5 0.4 -0.2 0.3 -0.4 0.2 -0.6 0.1 -0.8 0 7.2 Dap ung pha 500 1000 1500 2000 Tan so, Hz 2500 3000 -1 3500 0.2 0.4 0.6 Tan so, ω/π 0.8 DESIGN OF FIR FILTERS Project 7.3 Gibb's Phenomenon Answers: Q7.9 The MATLAB program generating the impulse response, truncated to 81 samples, of a zero-phase ideal lowpass filter with a cutoff at ωc = 0.4π and plotting its magnitude response is given below: < Insert program code here Copy from m-file(s) and paste > The plot of the magnitude response generated by running this program is as shown below: < Insert MATLAB figure(s) here Copy from figure window(s) and paste > The program was modified as indicated below to extract the coefficients of a shorter length filter using the colon operator : < Insert program code here Copy from m-file(s) and paste > The magnitude response plots generated by running the modified program for the following lengths, 61, 41, and 21, are given below : < Insert MATLAB figure(s) here paste > Copy from figure window(s) and Báo cáo thực tập DSP Nguyễn Kim Lễ - 1050927 Nguyễn Văn Đờ Ni – 1050953 From these plots we observe the oscillatory behavior of the magnitude responses in each case due to the Gibb's phenomenon The relation between the number of ripples and the length of the filter is - The relation between the heights of the largest ripples and the length of the filter is - The modified program to generate impulse response coefficients for an evenlength filter is given below - < Insert program code here Copy from m-file(s) and paste > Q7.10 The MATLAB program generating the impulse response, truncated to 45 samples, of a zero-phase ideal highpass filter with a cutoff at ωc = 0.4π and plotting its magnitude response is given below: < Insert program code here Copy from m-file(s) and paste > The plot of the magnitude response generated by running this program is as shown below: < Insert MATLAB figure(s) here Copy from figure window(s) and paste > From these plots we observe the oscillatory behavior of the magnitude responses due to the Gibb's phenomenon The modified program to generate impulse response coefficients for an evenlength filter is given below - < Insert program code here Copy from m-file(s) and paste > Q7.11 The MATLAB program generating the impulse response samples of a zero-phase differentiator of length 2M +1 and plotting its magnitude response is given below: < Insert program code here Copy from m-file(s) and paste > 10 Báo cáo thực tập DSP Nguyễn Kim Lễ - 1050927 Nguyễn Văn Đờ Ni – 1050953 The program was run for the following different values of length 81, 61, 41, and 21 From the plots generated we observe the oscillatory behavior of the magnitude responses in each case due to the Gibb's phenomenon < Insert MATLAB figure(s) here Copy from figure window(s) and paste > The relation between the number of ripples and the length of the filter is - The relation between the heights of the largest ripples and the length of the filter is Q7.12 - The MATLAB program generating the impulse response samples of a zero-phase Hilbert transformer of length 2M +1 and plotting its magnitude response is given below: < Insert program code here Copy from m-file(s) and paste > The program was run for the following different values of length 81, 61, 41, and 21 From the plots generated we observe the oscillatory behavior of the magnitude responses in each case due to the Gibb's phenomenon < Insert MATLAB figure(s) here Copy from figure window(s) and paste > The relation between the number of ripples and the length of the filter is - The relation between the heights of the largest ripples and the length of the filter is - Project 7.4 Estimation of FIR Filter Order Answers: Q7.13 The estimated order of a linear-phase lowpass FIR filter with the following specifications: ωp = kHz, ωs = 2.5 kHz, δp = 0.005, δs = 0.005, and FT = 10 kHz obtained using kaiord is - 11 Báo cáo thực tập DSP Q7.14 Nguyễn Kim Lễ - 1050927 Nguyễn Văn Đờ Ni – 1050953 The purpose of the command ceil is - The purpose of the command nargin is - (a) The estimated order of the linear-phase FIR filter with sampling frequency changed to FT = 20 kHz is - (b) The estimated order of the linear-phase FIR filter with ripples changed to δp = 0.002 and δs = 0.002 is - (c) The estimated order of the linear-phase FIR filter with stopband edge changed to ωs = 2.3 kHz is - From the above results and that obtained in Question Q7.13 we observe that: The relation between the filter order and sampling frequency is as follows The relation between the filter order and ripples is as follows - The relation between the filter order and the transition band is as follows Q7.15 - - The estimated order of a linear-phase lowpass FIR filter with the specifications as given in Question Q7.13 and obtained using kaiserord is - Comparing the above value of the order with that obtained in Question Q7.13 we observe Q7.16 - The estimated order of a linear-phase lowpass FIR filter with the specifications as given in Question Q7.13 and obtained using remezord is - Comparing the above value of the order with that obtained in Questions Q7.13 and Q7.15 we observe Q7.17 - The estimated order of a linear-phase bandpass FIR filter with the following specifications: passband edges at 1.8 and 3.6 kHz, stopband edges at 1.2 and 4.2 kHz, δp = 0.01, δs = 0.02, and FT = 12 kHz, obtained using 12 kaiord is - Báo cáo thực tập DSP Q7.18 Nguyễn Kim Lễ - 1050927 Nguyễn Văn Đờ Ni – 1050953 The estimated order of a linear-phase bandpass FIR filter with the specifications as given in Question Q7.17 and obtained using kaiserord is - Comparing the above value of the order with that obtained in Question Q7.17 we observe Q7.19 - The estimated order of a linear-phase bandpass FIR filter with the specifications as given in Question Q7.17 and obtained using remezord is - Comparing the above value of the order with that obtained in Questions Q7.17 and Q7.18 we observe - Project 7.5 FIR Filter Design Answers: Q7.20 The MATLAB program to design and plot the gain and phase responses of a linear-phase FIR filter using using fir1 is shown below The filter order is estimated kaiserord The output data are the filter coefficients < Insert program code here Copy from m-file(s) and paste > The coefficients of the lowpass filter corresponding to the specifications given in Question 7.20 are as shown below - The generated gain and phase responses are given below : < Insert MATLAB figure(s) here Copy from figure window(s) and paste > From the gain plot we observe that the filter as designed meet the specifications The filter order that meets the specifications is Q7.21 - The MATLAB program of Question Q7.20 was modified as indicated below for using different windows other than default Hamming window < Insert program code here Copy from m-file(s) and paste > 13 Báo cáo thực tập DSP Nguyễn Kim Lễ - 1050927 Nguyễn Văn Đờ Ni – 1050953 (a) Use of Hanning window – The generated gain and phase responses are given below: < Insert MATLAB figure(s) here Copy from figure window(s) and paste > From the gain plot we observe that the filter as designed meet the specifications The filter order that meets the specifications is - (b) Use of Blackman window – The generated gain and phase responses are given below: < Insert MATLAB figure(s) here Copy from figure window(s) and paste > From the gain plot we observe that the filter as designed meet the specifications The filter order that meets the specifications is - (c) Use of Dolph-Chebyshev window – The generated gain and phase responses are given below: < Insert MATLAB figure(s) here Copy from figure window(s) and paste > The parameters γ and β used in the design are - From the gain plot we observe that the filter as designed meet the specifications The filter order that meets the specifications is Q7.22 - The MATLAB program to design and plot the gain and phase responses of a linear-phase FIR filter using using remez is shown below The filter order is estimated remezord The output data are the filter coefficients 14 Báo cáo thực tập DSP Nguyễn Kim Lễ - 1050927 Nguyễn Văn Đờ Ni – 1050953 < Insert program code here Copy from m-file(s) and paste > The coefficients of the lowpass filter corresponding to the specifications given in Question 7.20 are as shown below - The generated gain and phase responses are given below : < Insert MATLAB figure(s) here Copy from figure window(s) and paste > From the gain plot we observe that the filter as designed meet the specifications The filter order that meets the specifications is Q7.23 - The MATLAB program to design and plot the gain and phase responses of a linear-phase FIR filter using fir1 and kaiser is shown below The filter order N is estimated using Eq (7.37) and the parameter β is computed using Eq (7.36) The output data are the filter coefficients < Insert program code here Copy from m-file(s) and paste > The coefficients of the lowpass filter corresponding to the specifications given in Question 7.23 are as shown below - The generated gain and phase responses are given below : < Insert MATLAB figure(s) here Copy from figure window(s) and paste > From the gain plot we observe that the filter as designed meet the specifications The filter order that meets the specifications is Q7.24 - The MATLAB program to design and plot the gain and phase responses of a linear-phase FIR filter using N and the parameter fir1 and kaiser is shown below The filter order β are evaluated using kaiserord The output data are the filter coefficients 15 Báo cáo thực tập DSP Nguyễn Kim Lễ - 1050927 Nguyễn Văn Đờ Ni – 1050953 < Insert program code here Copy from m-file(s) and paste > The coefficients of the lowpass filter corresponding to the specifications given in Question 7.23 are as shown below - The generated gain and phase responses are given below : < Insert MATLAB figure(s) here Copy from figure window(s) and paste > From the gain plot we observe that the filter as designed meet the specifications The filter order that meets the specifications is Q7.25 - The MATLAB program to design and plot the magnitude response of a linearphase multiband FIR filter using fir2 is shown below: < Insert program code here Copy from m-file(s) and paste > The magnitude response of the filter designed for the specifications given in Question Q7.25 is shown below: < Insert MATLAB figure(s) here Copy from figure window(s) and paste > From the magnitude response plot we observe that the filter as designed meet the specifications Q7.26 The MATLAB program to design and plot the gain response of a linear-phase bandpass FIR filter using remez and kaiserord is shown below: < Insert program code here Copy from m-file(s) and paste > The gain response of the filter designed for the specifications given in Question Q7.17 is shown below: < Insert MATLAB figure(s) here Copy from figure window(s) and paste > From the gain response plot we observe that the filter as designed meet the specifications 16 Báo cáo thực tập DSP Nguyễn Kim Lễ - 1050927 Nguyễn Văn Đờ Ni – 1050953 The filter order that meets the specifications is Q7.27 - Using the MATLAB program developed in Question Q7.26 the linear-phase FIR bandpass filter for the specifications of Question Q7.27 is designed The gain response of the filter is shown below: < Insert MATLAB figure(s) here Copy from figure window(s) and paste > From the gain response plot we observe that the filter as designed meet the specifications The filter order that meets the specifications is – The new specifications for smooth roll-off in the transition bands are Date : Signature : 17 ... for the transfer function is 0.1561 − 0 .78 03z −1 + 1.5606 z −2 − 1.5606 z −3 + 0 .78 03z −4 − 0.1561z −5 − 1.5504 z −1 + 1. 479 6 z −2 − 0 .73 22 z −3 + 0.2 074 z −4 − 0.0242 z −5 The gain response... with that obtained in Question Q7. 17 we observe Q7.19 - The estimated order of a linear-phase bandpass FIR filter with the specifications as given in Question Q7. 17 and obtained using remezord... the above value of the order with that obtained in Questions Q7. 17 and Q7.18 we observe - Project 7. 5 FIR Filter Design Answers: Q7.20 The MATLAB program to design and plot the gain and phase