Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 16 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
16
Dung lượng
215 KB
Nội dung
Laboratory Exercise 4 LINEAR, TIMEINVARIANT DISCRETETIME SYSTEMS: FREQUENCYDOMAIN REPRESENTATIONS 4.1 TRANSFER FUNCTION AND FREQUENCY RESPONSE Project 4.1 Transfer Function Analysis Answers: Q4.1 The modified Program P3_1 to compute and plot the magnitude and phase spectra of a moving average filter of Eq (2.13) for 0 2 is shown below: % Program P3_1 plot(w/pi,abs(h));grid % Evaluation of the DTFT title('Magnitude Spectrum | clf; H(e^{j\omega})|') % Compute the frequency samples xlabel('\omega /\pi'); of the DTFT ylabel('Amplitude'); w = 0:8*pi/511:2*pi; subplot(2,1,2) m = 5; plot(w/pi,angle(h));grid num =ones(1,m)/m; title('Phase Spectrum h = freqz(num, 1, w); arg[H(e^{j\omega})]') % Plot the DTFT xlabel('\omega /\pi'); subplot(2,1,1) ylabel('Phase in radians'); This program was run for the following three different values of the corresponding frequency responses are shown below: Magnitude Spectrum |H(ej )| Amplitude M and the plots of 0.5 0 0.2 0.4 0.6 0.8 1.2 1.4 1.6 1.8 1.6 1.8 / j Phase Spectrum arg[H(e )] Phase in radians 2 4 0.2 0.4 0.6 0.8 1.2 1.4 / The types of symmetries exhibited by the magnitude and phase spectra are due to The type of filter represented by the moving average filter is The results of Question Q2.1 can now be explained as follo Q4.2 The plot of the frequency response of the causal LTI discrete-time system of Question Q4.2 obtained using the modified program is given below : Magnitude Spectrum |H(ej )| Amplitude 0.5 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.8 0.9 / Phase Spectrum arg[H(ej )] Phase in radians 1 2 0.1 0.2 0.3 0.4 0.5 0.6 0.7 / The type of filter represented by this transfer function is Q4.3 The plot of the frequency response of the causal LTI discrete-time system of Question Q4.3 obtained using the modified program is given below : Magnitude Spectrum |H(ej )| Amplitude 0.5 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.8 0.9 / Phase Spectrum arg[H(ej )] Phase in radians 2 4 0.1 0.2 0.3 0.4 0.5 0.6 0.7 / The type of filter represented by this transfer function is The difference between the two filters of Questions 4.2 and 4.3 is – phổ pha khác I shall choose the filter of Question Q4.2 for the following reason Vì đáp ứng pha tốt hơn Q4.4 The group delay of the filter specified in Question Q4.4 and obtained using the function grpdelay is shown below: Magnitude Spectrum |H(ej )| Amplitude 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.8 0.9 / Phase Spectrum arg[H(ej )] Phase in radians 0.5 0.5 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 / From this plot we make the following observations : Q4.5 The plots of the first 100 samples of the impulse responses of the two filters of Questions 4.2 and 4.3 obtained using the program developed in Question Q3.50 are shown below: impule 0.8 0.6 0.4 Amplitude 0.2 0.2 0.4 0.6 0.8 1 1.2 10 20 30 40 50 60 70 80 90 100 / impule x 10 Amplitude 1 2 3 4 10 20 30 40 50 60 70 80 90 100 / From these plots we make the following observations : Q4.6 The pole-zero plots of the two filters of Questions 4.2 and 4.3 developed using zplane are shown below: 1.5 Imaginary Part 0.5 0.5 1 1.5 2 2.5 2 1.5 1 0.5 0.5 Real Part 1.5 2.5 1.5 Imaginary Part 0.5 0.5 1 1.5 2 2.5 2 1.5 1 0.5 0.5 Real Part 1.5 2.5 From these plots we make the following observations : Ta có các cực khác nhau 4.2 TYPES OF TRANSFER FUNCTIONS Project 4.2 Filters A copy of Program P4_1 is given below: % Program P4_1 % Impulse Response of Truncated Ideal Lowpass Filter clf; fc = 0.25; n = [-6.5:1:6.5]; y = 2*fc*sinc(2*fc*n);k = n+6.5; stem(k,y);title('N = 13');axis([0 13 -0.2 0.6]); xlabel('Time index n');ylabel('Amplitude');grid; Answers: Q4.7 The plot of the impulse response of the approximation to the ideal lowpass filter obtained using Program P4_1 is shown below: N = 13 0.6 0.5 0.4 Amplitude 0.3 0.2 0.1 0.1 0.2 Time index n 10 12 The length of the FIR lowpass filter is 13 The statement in Program P4_1 determining the filter length is n = [6.5:1:6.5]; The parameter controlling the cutoff frequency is Q4.8 – Fc = 0.25 The required modifications to Program P4_1 to compute and plot the impulse response of the FIR lowpass filter of Project 4.2 with a length of 20 and a cutoff frequency of c = 0.45 are as indicated below: % Program P4_1 % Impulse Response of Truncated Ideal Lowpass Filter clf; fc = 0.45; n = [-10:1:10]; 0.8 y = 2*fc*sinc(2*fc*n);k = n+10; stem(k,y);title('N = 20');axis([0 20 -0.2 0.6 1]); xlabel('Time index 0.4 n');ylabel('Amplitude');grid; Amplitude N = 20 0.2 0.2 10 12 Time index n 14 16 18 20 The plot generated by running the modified program is given below : Q4.9 The required modifications to Program P4_1 to compute and plot the impulse response of the FIR lowpass filter of Project 4.2 with a length of 15 and a cutoff frequency of c = 0.65 are as indicated below: % Program P4_1 % Impulse Response of Truncated Ideal Lowpass Filter clf; fc = 0.65; n = [-7.5:1:7.5]; y = 2*fc*sinc(2*fc*n);k = n+7.5; stem(k,y);title('N = 15');axis([0 20 -0.2 0.6]); xlabel('Time index n');ylabel('Amplitude');grid; The plot generated by running modified program is given below: N = 15 0.6 0.5 0.4 Amplitude 0.3 0.2 0.1 0.1 0.2 10 15 Time index n the The MATLAB program to compute and plot the amplitude response of the FIR lowpass filter of Project 4.2 is given below: N = 13 0.6 % Program P4_1 % Impulse Response of Truncated Ideal 0.5 Lowpass Filter 0.4 clf; fc = 0.25; 0.3 n = [-6.5:1:6.5]; y = 2*fc*sinc(2*fc*n);k = n+6.5; 0.2 plot(k,y);title('N = 13');axis([0 13 -0.2 0.1 0.6]); xlabel('Time index n');ylabel('Amplitude');grid; Amplitude Q4.10 Plots of the amplitude response of the lowpass filter for several values of N are shown below: N = 15 0.1 0.2 Time index n 10 12 N = 15 0.6 0.5 0.4 Amplitude 0.3 0.2 0.1 0.1 0.2 Time index n 10 12 N= 19 N = 19 0.6 0.5 0.4 Amplitude 0.3 0.2 0.1 0.1 0.2 Time index n 10 12 From these plots we can make the following observations – Không thay đổi theo N A copy of Program P4_2 is given below: % Program P4_2 [g,w] = gain(num,1); % Gain Response of a Moving plot(w/pi,g);grid Average Lowpass Filter axis([0 -50 0.5]) clf; xlabel('\omega M = 2; /\pi');ylabel('Gain in dB'); num = ones(1,M)/M; title(['M = ', num2str(M)]) Answers: Q4.11 A plot of the gain response of a length-2 moving aver age filter obtained using Program P4_2 is shown below: M = 2 5 10 Gain in dB 15 20 25 30 35 40 45 50 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 / From the plot it can be seen that the 3-dB cutoff frequency is at – 0.5 Q4.12 The required modifications to Program P4_2 to compute and plot the gain response of a cascade of K length-2 moving average filters are given below: % Program P4_2 % Gain Response of a Moving Average Lowpass Filter clf; M = 2; num =[1 1]/M; [g,w] = gain(num,1); plot(w/pi,g);grid axis([0 -50 0.5]) xlabel('\omega /\pi');ylabel('Gain in dB'); title(['M = ', num2str(M)]) The plot of the gain response for a cascade of sections obtained using the modified program is shown below: M = 3 5 10 Gain in dB 15 20 25 30 35 40 45 50 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 / From the plot it can be seen that the 3-dB cutoff frequency of the cascade is at Q4.13 0.31 The required modifications to Program P4_2 to compute and plot the gain response of the highpass filter of Eq (4.42) are given below : % Program P4_2 % Gain Response of a Moving Average Lowpass Filter clf; M = 5; num =[1 -1 -1 1]/M; [g,w] = gain(num,1); plot(w/pi,g);grid axis([0 -50 0.5]) xlabel('\omega /\pi');ylabel('Gain in dB'); title(['M = ', num2str(M)]) The plot of the gain response for shown below: M = 5 obtained using the modified program is M = 5 5 10 Gain in dB 15 20 25 30 35 40 45 50 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 / From the plot we can see that the 3-dB cutoff frequency is at – 0.82 Q4.14 From Eq (4.16) for a 3-dB cutoff frequency c at 0.45 we obtain = 0.0787 Substituting this value of in Eqs (4.15) and (4.17) we arrive at the transfer function of the first-order IIR lowpass and highpass filters, respectively, given by HLP(z) = HHP(z) = The plots of their gain responses obtained using MATLAB are shown below : M = 5 M = 5 5 5 10 10 15 15 20 20 Gain in dB Gain in dB 25 30 25 30 35 35 40 40 45 45 50 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 50 0.1 0.2 0.3 0.4 / 0.5 0.6 0.7 0.8 0.9 / From these plots we observe that the designed filters _ meet the specifications A plot of the magnitude response of the sum HLP(z) + HHP(z) obtained using MATLAB is given below: M = 5 0.1 Gain in dB 0.1 From this plot we observe that the two filters are 0.2 0.3 0.4 0.5 0.6 A plot of the sum of the squaremagnitude responses of HLP(z) and HHP(z) obtained using MATLAB is given below: < Insert MATLAB figure(s) here paste > 0.12 0.13 0.14 0.15 0.16 0.17 / 0.18 0.19 0.2 0.21 Copy from figure window(s) and From this plot we observe that the two filters are Q4.15 From Eq (4.24), we get substituting Substituting this value of K = 10, B = 1.86 B and c = 0.3 in Eq (4.23) we obtain = 0.31 Using this value of in Eq (4.22) we arrive at the transfer function of the cascade of 10 IIR lowpass filters as 1 – 1 z 10 1 1 H LP,10 (z) (7.85+7.85z )/(2+13.7z ) – z Substituting c = 0.3 in Eq (4.16) we obtain = 10 Using this value of IIR lowpass filter in Eq (4.15) we arrive at the transfer function of a first-order – z H LP,1(z) (7.7+7.7z1)/(2+13.4z1) – z H LP,10 (z) and H LP,1(z) plotted using MATLAB are shown The gain responses of below: HHP M = 21 5 5 10 10 15 15 20 20 Gain in dB Gain in dB 25 30 25 30 35 35 40 40 45 45 50 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 50 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 / / < Insert From these plots we make the following observation Q4.16 Substituting o = 0.61 in Eq (4.19) we get cos(0.61) 3dB = 0.15 in Eq (4.20) we get (1 )cos(0.15) 2 0, whose solution yields = and = Substituting Substituting the value of and the first value of in Eq (4.18) we arrive at the transfer function of the IIR bandpass transfer function HBP,1(z) = Substituting the value of and the second value of in Eq (4.18) we arrive at the transfer function of the IIR bandpass transfer function HBP,2(z) = zplane command we find the pole locations of HBP,1(z) and HBP,2(z) from which we conclude that the stable transfer function HBP(z) is given Next using the by 11 The plot of the gain response of the stable transfer function HBP(z) obtained using MATLAB is shown below: < Insert MATLAB figure(s) here paste > Copy from figure window(s) and Using the same value of and in Eq (4.21) we next obtain the transfer function of a stable IIR bandstop filter as HBS(z) = The plot of the gain response of the transfer function HBS(z) obtained using MATLAB is shown below: < Insert MATLAB figure(s) here paste > Copy from figure window(s) and From these plots we observe that the designed filters do/do not meet the specifications A plot of the magnitude response of the sum HBP(z) + HBS(z) obtained using MATLAB is given below: < Insert MATLAB figure(s) here paste > From this plot we observe that the two filters are Copy from figure window(s) and A plot of the sum of the square-magnitude responses of HBP(z) and HBS(z) obtained using MATLAB is given below: < Insert MATLAB figure(s) here paste > From this plot we observe that the two filters are Q4.17 Copy from figure window(s) and The transfer function of a comb filter derived from the prototype FIR lowpass filter of Eq (4.38) is given by G(z) = H0(zL) = Plots of the magnitude response of the above comb filter for the following values of L are shown below: < Insert MATLAB figure(s) here paste > 12 Copy from figure window(s) and From these plots we observe that the comb filter has _ notches at k = _ = _and _ peaks at k = _ = _, where k = 0, 1, , _ Q4.18 The transfer function of a comb filter derived from the prototype FIR highpass filter of Eq (4.41) with M = is given by G(z) = H1(zL) = Plots of the magnitude response of the above comb filter for the following values of L are shown below < Insert MATLAB figure(s) here paste > Copy from figure window(s) and From these plots we observe that the comb filter has _ notches at k = _ k = _ Type 1 FIR Filter Time index n Type 3 FIR Filter 50 Time index n 50 Time index n Type 4 FIR Filter 10 Time index n 10 100 50 100 50 100 Amplitude Amplitude 13 Type 2 FIR Filter 100 Amplitude Q4.19 A copy of Program P4_3 is given below: % Program P4_3 % Zero Locations of Linear Phase FIR Filters clf; b = [1 -8.5 30.5 -63]; num1 = [b 81 fliplr(b)]; num2 = [b 81 81 fliplr(b)]; num3 = [b -fliplr(b)]; num4 = [b 81 -81 -fliplr(b)]; n1 = 0:length(num1)-1; n2 = 0:length(num2)-1; subplot(2,2,1); stem(n1,num1); xlabel('Time index n');ylabel('Amplitude'); grid; title('Type FIR Filter'); subplot(2,2,2); stem(n2,num2); xlabel('Time index n');ylabel('Amplitude'); grid; title('Type FIR Filter'); subplot(2,2,3); stem(n1,num3); xlabel('Time index n');ylabel('Amplitude'); grid; title('Type FIR Filter'); subplot(2,2,4); stem(n2,num4); xlabel('Time index n');ylabel('Amplitude'); grid; title('Type FIR Filter'); pause 100 subplot(2,2,1); zplane(num1,1); 50 title('Type FIR Filter'); subplot(2,2,2); zplane(num2,1); title('Type FIR Filter'); 50 subplot(2,2,3); zplane(num3,1); 100 title('Type FIR Filter'); subplot(2,2,4); zplane(num4,1); title('Type FIR Filter'); 100 Amplitude and _ peaks at 50 50 100 disp('Zeros of Type disp(roots(num1)); disp('Zeros of Type disp(roots(num2)); disp('Zeros of Type disp(roots(num3)); disp('Zeros of Type disp(roots(num4)); - FIR Filter are'); FIR Filter are'); FIR Filter are'); FIR Filter are'); - Các tínhiệu cho ta thấy giá trị M tínhiệu khác : tínhiệu giá trị M chẵn tínhiệu giá trị M lẽ Tínhiệu có M=8 a = 1.979 Tínhiệu có M= a = Tínhiệu có M= a = Tínhiệu có M = a = - Filter #1 has zeros at z = - Filter #2 has zeros at z = - Filter #3 has zeros at z = - Filter #4 has zeros at z = The plots of the impulse responses of the four FIR filters generated by running Program P4_3 are given below: < Insert MATLAB figure(s) here paste > Copy from figure window(s) and From the plots we make the following observations : Filter #1 is of length with a impulse response and is therefore a Type linear-phase FIR filter. Filter #2 is of length with a impulse response and is therefore a Type linear-phase FIR filter. Filter #3 is of length with a impulse response and is therefore a Type linear-phase FIR filter. Filter #4 is of length with a impulse response and is therefore a Type linear-phase FIR filter. From the zeros of these filters generated by Program P4_3 we observe that : 14 Filter #1 has zeros at z = Filter #2 has zeros at z = Filter #3 has zeros at z = Filter #4 has zeros at z = Plots of the phase response of each of these filters obtained using MATLAB are shown below: < Insert MATLAB figure(s) here paste > Copy from figure window(s) and From these plots we conclude that each of these filters have phase. The group delay of Filter # is The group delay of Filter # is The group delay of Filter # is The group delay of Filter # is 50 Amplitude Amplitude 15 Amplitude The plots of the impulse responses of the four FIR filters generated by running Program P4_3 are given below: % Program P4_3 % Zero Locations of Linear Phase FIR Filters clf; b = [1 -8.5 30.5 -63]; num1 = [b 81 fliplr(b)]; num2 = [b 81 81 fliplr(b)]; num3 = [b -fliplr(b)]; num4 = [b 81 -81 -fliplr(b)]; n1 = 0:length(num1)-1; n2 = 0:length(num2)-1; subplot(2,2,1); stem(n1,num1); xlabel('Time index n');ylabel('Amplitude'); grid; title('Type FIR Filter'); subplot(2,2,2); stem(n2,num2); xlabel('Time index n');ylabel('Amplitude'); grid; title('Type FIR Filter'); subplot(2,2,3); stem(n1,num3); Type 1 FIR Filter Type 2 FIR Filter xlabel('Time index 100 100 n');ylabel('Amplitude'); grid; 50 50 title('Type FIR Filter'); subplot(2,2,4); stem(n2,num4); 0 xlabel('Time index 50 50 n');ylabel('Amplitude'); grid; 100 100 title('Type FIR Filter'); Time index n Time index n pause Type 3 FIR Filter Type 4 FIR Filter subplot(2,2,1); zplane(num1,1); 100 100 title('Type FIR Filter'); Amplitude Q4.20 50 100 Time index n 10 50 50 100 Time index n 10 subplot(2,2,2); zplane(num2,1); title('Type FIR Filter'); subplot(2,2,3); zplane(num3,1); title('Type FIR Filter'); subplot(2,2,4); zplane(num4,1); title('Type FIR Filter'); disp('Zeros of Type FIR Filter disp(roots(num1)); disp('Zeros of Type FIR Filter disp(roots(num2)); disp('Zeros of Type FIR Filter disp(roots(num3)); disp('Zeros of Type FIR Filter disp(roots(num4)); - are'); are'); are'); are'); Các tínhiệu cho ta thấy giá trị M tínhiệu khác : tínhiệu giá trị M chẵn tínhiệu giá trị M lẽ Tínhiệu có M=8 a = 1.979 Tínhiệu có M= a = Tínhiệu có M= a = Tínhiệu có M = a = 16 ... Filter are'); - Các tín hiệu cho ta thấy giá trị M tín hiệu khác : tín hiệu giá trị M chẵn tín hiệu giá trị M lẽ Tín hiệu có M=8 a = 1.979 Tín hiệu có M= a = Tín hiệu có M= a = Tín hiệu có M = a =... are'); are'); Các tín hiệu cho ta thấy giá trị M tín hiệu khác : tín hiệu giá trị M chẵn tín hiệu giá trị M lẽ Tín hiệu có M=8 a = 1.979 Tín hiệu có M= a = Tín hiệu có M= a = Tín hiệu có M = a =... cutoff frequency is at – 0.82 Q4.14 From Eq (4.16 ) for a 3-dB cutoff frequency c at 0.45 we obtain = 0.0787 Substituting this value of in Eqs (4.15 ) and (4.17 ) we arrive at the transfer