Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 19 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
19
Dung lượng
346,67 KB
Nội dung
Laboratory Exercise LINEAR, TIME-INVARIANT DISCRETE-TIME SYSTEMS: FREQUENCY-DOMAIN 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 ≤ ω ≤ 2π is shown below: % Program P3_1 % Evaluation of the DTFT clf; % Compute the frequency samples of the DTFT M = input('Desired length of the filter = '); w = 0:pi/(M^2):2*pi; num = (1/M).*ones(1,M); h = freqz(num,1, w); % Plot the DTFT subplot(2,1,1) plot(w/pi,abs(h));grid title('Magnitude Spectrum |H(e^{j\omega})|') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,1,2) plot(w/pi,angle(h));grid title('Phase Spectrum arg[H(e^{j\omega})]') xlabel('\omega /\pi'); ylabel('Phase in radians'); This program was run for the following three different values of M and the plots of the corresponding frequency responses are shown below: M=4 jω)| M agnitudeS pectrum|H (e Amplitude 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 in radians P haseS pectrumarg[H (e -2 -4 0.2 0.4 0.6 0.8 ω/ π 1.2 1.4 jω)| M agnitudeS pectrum|H (e Amplitude 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 in radians P haseS pectrumarg[H (e -2 -4 0.2 0.4 0.6 0.8 1.2 1.4 ω/ π M=6 jω) | M a g n itu d e S p e c tr u m |H ( e Am plitude Phase in radians 0 1 8 ω/ π jω) ] P h a s e S p e c tr u m a rg [H ( e 2 0 1 ω/ π M=3 The types of symmetries exhibited by the magnitude and phase spectra are even and odd , respectively The type of filter represented by the moving average filter is low pass filter The results of Question Q2.1 can now be explained as follows the moving average filter is the low pass filter so the signal s2 is suppressed because s2 is the high frequency signal 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: jω ) | A m p litu d e M a g n i t u d e S p e c t r u m | H ( e P h a s einr a d ia n s 0 /π ω jω ) ] P h a s e S p e c t r u m a r g [ H ( e 1 0 /π ω The type of filter represented by this transfer function is band pass filter A m p l i t u d e P h a s e i n r a d i a n s 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: j ω ) | M a g n i t u d e S p e c t r u m | H ( e 0 /π ω j ω ) ] P h a s e S p e c t r u m a r g [ H ( e 2 0 /π ω The type of filter represented by this transfer function is band pass filter The difference between the two filters of Questions 4.2 and 4.3 is that the attenuation of the phase spectrum of the filter of the Question 4.3 is faster than the filter of the Question 4.2 I shall choose the filter of Question Q4.2 for the following reason The attenuation of the phase spectrum of the filter of the Question 4.3 is faster so the amount of the signal distortion is more significant Q4.4 The group delay of the filter specified in Question Q4.4 and obtained using the function grpdelay is shown below: j ω ) | G r o u p d e l a y o f | H ( e S e c o n d s 0 /π ω From this plot we make the following observations : the difference phase is the largest at the frequency of 0.3 that means the amount of the signal distortion is the largest at the frequency of 0.3 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: t h e i n v e r s e o f a r a t i o n a l z t r a n s f o r m The transfer function in the question 4_2 0 x 2 7 0 0 t h e i n v e r s e o fa r a t i o n a lz t r a n s f o r m 0 1 From these plots we make the following observations: that the filter of the question 4.2 is stable and the one of the question 4.3 is not stable Q4.6 The pole-zero plots of the two filters of Questions 4.2 and 4.3 developed using zplane are shown below: 1 0.8 0.6 0.5 Imaginary Part Imaginary Part 0.4 0.2 -0.2 -0.4 -0.5 -0.6 -0.8 -1 -1 -1 -0.5 Real Part 0.5 -1.5 -1 -0.5 Real Part 0.5 1.5 The pole – zero plot of the filter of question 4_3 The pole – zero plot of the filter of question 4_2 From these plots we make the following observations : that the filter of the question 4.2 is casual and stable and the filter of the question 4.3 is not stable 4.2 TYPES OF TRANSFER FUNCTIONS Project 4.2 Filters % 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 = A m p l i t u d e 0 2 T i m e i n d e x n The length of the FIR lowpass filter is 13 1 The statement in Program P4_1 determining the filter length is n = [-6.5:1:6.5]; The parameter controlling the cutoff frequency is fc Q4.8 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/(2*pi); n = [-10:1:10]; y = 2*fc*sinc(2*fc*n);k = n+10; stem(k,y);title('N = 21');axis([0 20 -0.2 1]); xlabel('Time index n');ylabel('Amplitude');grid; The plot generated by running the modified program is given below A m p l i t u d e N = 0 2 T i m e i n d e x n 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/(2*pi); n = [-7.5:1:7.5]; y = 2*fc*sinc(2*fc*n);k = n+7.5; stem(k,y);title('N = 21');axis([0 20 -0.2 1]); xlabel('Time index n');ylabel('Amplitude');grid; The plot generated by running the modified program is given below: N = A m p lit u d e 0 2 T i m e i n d e x n Q4.10 The MATLAB program to compute and plot the amplitude response of the FIR lowpass filter of Project 4.2 is given below: % Program P4_1 % Impulse Response of Truncated Ideal Lowpass Filter clf; fc = 0.25; n = [-6.5:13/511:6.5]; y = 2*fc*sinc(2*fc*n); Y=fft(y); Plot(abs(Y)); Xlable(‘w/pi’); Ylable(‘amplitude’); Plots of the amplitude response of the lowpass filter for several values of below: N are shown 5 5 0 0 0 0 0 0 From these plots we can make the following observations 0 that the transition of the filter is approximately immediate A copy of Program P4_2 is given below: % Program P4_2 % Gain Response of a Moving Average Lowpass Filter clf; M = 2; num = ones(1,M)/M; [g,w] = gain(num,1); plot(w/pi,g);grid axis([0 -45 0]) xlabel('\omega /\pi');ylabel('Gain in dB'); title(['M = ', num2str(M)]) Answers: Q4.11 A plot of the gain response of a length-2 moving average filter obtained using Program P4_2 is shown below: M = G a i n i n d B 1 2 3 4 0 /π ω From the plot it can be seen that the 3-dB cutoff frequency is at Q4.12 0.5pi 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: G a i n i n d B % Gain Response of a cascade of K length -2 moving Average %Lowpass Filter clf; k=input('the number of sections of a cascade system:'); M = 2; num = ones(1,M)/M; w = 0:pi/255:pi; h = freqz(num,1,w); ha=h.^k; g = 20*log10(abs(ha)); plot(w/pi,g);grid axis([0 -45 0]) 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 = 1 2 3 4 0 / ω π From the plot it can be seen that the 3-dB cutoff frequency of the cascade is at Q4.13 0.3pi 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=input('length of the highpass filter:'); num = zeros(1,M); for k=0:M-1, num(k+1)=num(k+1)+(-1)^k; end num=num/M; [g,w] = gain(num,1); plot(w/pi,g);grid axis([0 -14 0]) xlabel('\omega /\pi');ylabel('Gain in dB'); title(['M = ', num2str(M)]) The plot of the gain response for M = is shown below: obtained using the modified program M = G a in in d B 1 0 /π ω From the plot we can see that the 3-dB cutoff frequency is at Q4.14 From Eq (4.16) for a 3-dB cutoff frequency 0.82pi ω c at 0.45π we obtain α = 0.08 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 −1 HLP(z) = 0.46 (1 + z −1 ) − 0.08 z −1 HHP(z) = 0.54 (1 − z −1 ) − 0.08 z The plots of their gain responses obtained using MATLAB are shown below: l o w p a s s f i l t e r w c = p i G a i n i n d B 1 0 /π ω h i g h p a s s f i l t e r w c = p i G a i n i n d B 1 0 /π ω From these plots we observe that the designed filters A plot of the magnitude response of the sum meet the specifications HLP(z) + HHP(z) obtained using MATLAB is given below: l o w p a s s f i l t e r w c = p i G a i n i n d B 1 0 /π ω From this plot we observe that the two filters are allpass-complementary A plot of the sum of the square-magnitude responses of HLP(z) and HHP(z) obtained using MATLAB is given below: s q u a r e a m p l i t u d e r e s p o n s e o f h i g h p a s s f i l t e r w c = p i s q u a r ea m p litu d e 0 /π ω s q u a r e a m p l i t u d e r e s p o n s e o f h i g h p a s s f i l t e r w c = p i s q u a r ea m p litu d e 0 /π ω From this plot we observe that the two filters are power-complementary Q4.15 From Eq (4.24), we get substituting Substituting this value of K = 10, B = 1.866 B and ω c = 0.3π in Eq (4.23) we obtain α = -0.311 Using this value of α in Eq (4.22) we arrive at the transfer function of the cascade of 10 IIR lowpass filters as – α 1+ z −1 10 0.6555 (1 + z −1 ) 10 H LP,10 (z) = ⋅ = −1 – α z −1 + 0.311 z Substituting ω c = 0.3π in Eq (4.16) we obtain α = 0.325 Using this value of IIR lowpass filter H LP,1(z) = – α + z −1 0.3375 (1 + z −1 ) ⋅ = – α z −1 − 0.325 z −1 H LP,10 (z) and H LP,1(z) plotted using MATLAB are shown below: The gain responses of s q u a r e a m p l i t u d e α in Eq (4.15) we arrive at the transfer function of a first-order g a i n r e s p o n s e o f l o w p a s s f i l t e r w c = p i 1 2 3 4 5 0 /π ω g a i n r e s p o n s e o f t h o r d e r l o w p a s s f i l t e r w c = p i s q u a r e a m p litu d e 0 0 /π ω From these plots we make the following observation the transition of the 10 -order lowpass filter is more immediate than the first-order lowpass filter th Q4.16 Substituting ω o = 0.61π in Eq (4.19) we get β = cos(0.61π) = -0.339 ∆ω3dB = 0.15π in Eq (4.20) we get (1 + α )cos(0.15π) − 2α = 0, whose solution yields α =0.6128 and α = 1.6319 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) = 0.1936 (1 − z −2 ) + 0.547 z −1 + 0.6128 z −2 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) = − 0.316 (1 − z −2 ) + 0.892 z −1 + 1.6319 z −2 Next using the 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 by HBP,1(z) = 0.1936 (1 − z −2 ) + 0.547 z −1 + 0.6128 z −2 The plot of the gain response of the stable transfer function HBP(z) obtained using MATLAB is shown below: b a n d p a s s f i l t e r B W = p i G a i n i n d B 1 2 0 /π ω Using the same value of α and β in Eq (4.21) we next obtain the transfer function of a stable IIR bandstop filter as −1 −2 HBS(z) = 0.8064 (1 + 0.678 z + z ) + 0.547 z −1 + 0.6128 z −2 The plot of the gain response of the transfer function MATLAB is shown below: HBS(z) obtained using b a n d s t o p f i l t e r B W = p i G a i n i n d B 1 2 3 0 /π ω From these plots we observe that the designed filters meet the specifications A plot of the magnitude response of the sum HBP(z) + HBS(z) obtained using MATLAB a m p l i t u d e is given below: 0 / ω π From this plot we observe that the two filters are allpass-complementary A plot of the sum of the square-magnitude responses of HBP(z) and HBS(z) obtained s q u a r e a m p l i t u d e using MATLAB is given below: π b a n d p a s s f i l t e r B W = 0 s q u a r e a m p l i t u d e / ω π π b a n d s t o p f i l t e r B W = 0 /π ω From this plot we observe that the two filters are power-complementary Q4.17 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) = 0.5(1+z-L) Plots of the magnitude response of the above comb filter for the following values of L are shown below: m a g n i t u d e r e s p o n s e o f t h e a b o v e c o m b f i l t e r L = a m p lit u d e 0 1 / ω π a m p l i t u d e m a g n i t u d e r e s p o n s e o f t h e a b o v e c o m b f i l t e r L = 0 1 / ω π From these plots we observe that the comb filter has mutilpe notches at (2k+1)pi/L and L peaks at Q4.18 ω k = ω k= 2k*pi/L, where k = 0, 1, , L-1 The transfer function of a comb filter derived from the prototype FIR highpass filter of Eq (4.42) with M = is given by G(z) = H1(zL) =0.5(1-z-L) Plots of the magnitude response of the above comb filter for the following values of L are shown below m a g n i t u d e r e s p o n s e o f t h e a b o v e c o m b f i l t e r L = a m p l i t u d e 0 / ω π a m p l i t u d e m a g n i t u d e r e s p o n s e o f t h e a b o v e c o m b f i l t e r L = 0 1 / ω π From these plots we observe that the comb filter has multiple notches at k2pi/L and multiple peaks at Q4.19 ω k = pi(2k+1)/L 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 subplot(2,2,1); zplane(num1,1); title('Type FIR Filter'); 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 are'); disp(roots(num1)); disp('Zeros of Type FIR Filter are'); disp(roots(num2)); disp('Zeros of Type FIR Filter are'); disp(roots(num3)); ω k = disp('Zeros of Type FIR Filter are'); disp(roots(num4)); A m p l i t u d e 0 A m p l i t u d e 0 T i m e i n d e x n T y p e F I R F i l t e r 0 0 Im a g in a r yP a r t T i m e i n d e x n 1 R e a lP a r t T y p e F I R F i l t e r 2 0 0 5 T i m e i n d e x n T y p e F I R F i l t e r 0 0 0 T i m e i n d e x n T y p e F I R F i l t e r 0 Im a g in a r yP a r t Im a g in a r yP a r t 0 T y p e F I R F i l t e r 0 0 A m p l i t u d e T y p e F I R F i l t e r 0 Im a g in a r yP a r t A m p l i t u d e The plots of the impulse responses of the four FIR filters generated by running Program P4_3 are given below: T y p e F I R F i l t e r 2 R e a lP a r t T y p e F I R F i l t e r R e a lP a r t 1 R e a lP a r t From the plots we make the following observations: Filter #1 is of length with a symmetry impulse response and is therefore a Type 1st linear-phase FIR filter Filter #2 is of length nd 10 with a symmetry impulse response and is therefore a Type linear-phase FIR filter Filter #3 is of length Type rd with an anti-symmetric impulse response and is therefore a linear-phase FIR filter Filter #4 is of length Type 10 with an anti-symmetric impulse response and is therefore a 4th linear-phase FIR filter From the zeros of these filters generated by Program P4_3 we observe that: Filter #1 has no restriction of zeros Filter #2 has zeros at z = -1 Filter #3 has zeros at z = and -1 Filter #4 has zeros at z = Plots of the phase response of each of these filters obtained using MATLAB are shown below: T y p e F I R F i l t e r r a d i a n s r a d i a n s T y p e F I R F i l t e r 0 0 / ω π T y p e F I R F i l t e r r a d i a n s r a d i a n s 0 / ω π T y p e F I R F i l t e r 0 / ω π / ω π From these plots we conclude that each of these filters have linear phase The group delay of Filter # is The group delay of Filter # is 4.5 The group delay of Filter # is The group delay of Filter # is 4.5 Answers: Q4.21 A plot of the magnitude response of H1(z) obtained using MATLAB is shown below: m a g n i t u d e r e s p o n s e o f H ( Z ) a m p l i t u d e 0 / ω π From this plot we observe that the magnitude response has a maximum at =0.7020 pi with a value = 0.3289 Using ω zplane we observe that the poles of H1(z) are outside the unit circle and hence the transfer function is not stable Since the maximum value of the magnitude response of H1(z) is =0.3289, we scale H1(z) by 0.3289 and arrive at a bounded-real transfer function H2(z) = 1.5(1 + z −1 ) 0.3289 (1 + z −1 + z −2 ) Q4.22 A plot of the magnitude response of G1(z) obtained using MATLAB is shown below: m a g n i t u d e r e s p o n s e o f t r a n s f e r f u n c t i o n G ( Z ) a m p l i t u d e 0 / ω π From this plot we observe that the magnitude response has a maximum at ω = 0.64pi with a value = 1.7843 Using zplane we observe that the poles of G1(z) are inside the unit circle and hence the transfer function is stable Since the maximum value of the magnitude response of G1(z) is = 1.7843 , we scale G1(z) by 1.7843 and arrive at a bounded-real transfer function G2(z) = − z −1 1.7843 ( + z −1 + z −2 ) 4.3 STABILITY TEST clf; dens =input('Denominator coefficients = ','s'); denn=sscanf(dens,'%f'); ki = poly2rc(denn'); disp('Stability test parameters are'); disp(ki); Answers: Q4.23 The pole-zero plots of H1(z) and H2(z) obtained using zplane are shown below: Im aginary P art p o le z e r o p lo to fH ( z ) 0 Im aginary Part R e a lP a r t p o le z e r o p lo to fH ( z ) 2 0 R e a lP a r t From the above pole-zero plots we observe that all poles of two transfer functions are inside of the unit circle Q4.24 Using Program P4_4 we tested the stability of H 1(z) and arrive at the following stability test parameters {ki}: -0.9989, 0.8500 From these parameters we conclude that H1(z) is stable Using Program P4_4 we tested the stability of H2(z) and arrive at the following stability test parameters {ki}:-1.0005, 0.8500 From these parameters we conclude that H2(z) is Q4.25 stable Using Program P4_4 we tested the root locations of D(z) and arrive at the following stability test parameters {ki}: 0.7604, 0.9672, 2.6057, -0.5195, 0.3125 From these parameters we conclude that all roots of D(z) are not inside the unit circle Q4.26 Using Program P4_4 we tested the root locations of D(z) and arrive at the following stability test parameters {ki}: -0.6087, 0.7958, 0.6742, 0.5938, 0.6000 From these parameters we conclude that all roots of D(z) are Ngày: 10/10/2009 inside the unit circle ... question 4. 3 is not stable Q4.6 The pole-zero plots of the two filters of Questions 4. 2 and 4. 3 developed using zplane are shown below: 1 0.8 0.6 0.5 Imaginary Part Imaginary Part 0 .4 0.2 -0.2 -0 .4. .. 3-dB cutoff frequency is at Q4. 14 From Eq (4. 16) for a 3-dB cutoff frequency 0.82pi ω c at 0 .45 π we obtain α = 0.08 Substituting this value of α in Eqs (4. 15) and (4. 17) we arrive at the transfer... of the filter of the Question 4. 3 is faster so the amount of the signal distortion is more significant Q4 .4 The group delay of the filter specified in Question Q4 .4 and obtained using the function