收藏 分享(赏)

数字信号处理米特拉第四版实验二答案.pdf

上传人:精品资料 文档编号:10725525 上传时间:2020-01-02 格式:PDF 页数:50 大小:559.98KB
下载 相关 举报
数字信号处理米特拉第四版实验二答案.pdf_第1页
第1页 / 共50页
数字信号处理米特拉第四版实验二答案.pdf_第2页
第2页 / 共50页
数字信号处理米特拉第四版实验二答案.pdf_第3页
第3页 / 共50页
数字信号处理米特拉第四版实验二答案.pdf_第4页
第4页 / 共50页
数字信号处理米特拉第四版实验二答案.pdf_第5页
第5页 / 共50页
点击查看更多>>
资源描述

1、1 Name: SOLUTION Section: Laboratory Exercise 2 DISCRETE-TIME SYSTEMS: TIME-DOMAIN REPRESENTATION 2.1 SIMULATION OF DISCRETE-TIME SYSTEMS Project 2.1 The Moving Average System A copy of Program P2_1 is given below: % Program P2_1 % Simulation of an M-point Moving Average Filter % Generate the input

2、signal n = 0:100; s1 = cos(2*pi*0.05*n); % A low-frequency sinusoid s2 = cos(2*pi*0.47*n); % A high frequency sinusoid x = s1+s2; % Implementation of the moving average filter M = input(Desired length of the filter = ); num = ones(1,M); y = filter(num,1,x)/M; % Display the input and output signals c

3、lf; subplot(2,2,1); plot(n, s1); axis(0, 100, -2, 2); xlabel(Time index n); ylabel(Amplitude); title(Signal #1); subplot(2,2,2); plot(n, s2); axis(0, 100, -2, 2); xlabel(Time index n); ylabel(Amplitude); title(Signal #2); subplot(2,2,3); plot(n, x); axis(0, 100, -2, 2); xlabel(Time index n); ylabel(

4、Amplitude); title(Input Signal); subplot(2,2,4); plot(n, y); axis(0, 100, -2, 2); xlabel(Time index n); ylabel(Amplitude); title(Output Signal); axis; 2 Answers: Q2.1 The output sequence generated by running the above program for M = 2 with xn = s1n+s2n as the input is shown below. 0 50 100-2-1012Ti

5、me index nAmplitudeSignal #10 50 100-2-1012Time index nAmplitudeSignal #20 50 100-2-1012Time index nAmplitudeInput Signal0 50 100-2-1012Time index nAmplitudeOutput SignalThe component of the input xn suppressed by the discrete-time system simulated by this program is Signal #2, the high frequency on

6、e (it is a low pass filter). Q2.2 Program P2_1 is modified to simulate the LTI system yn = 0.5(xnxn1) and process the input xn = s1n+s2n resulting in the output sequence shown below: Note: the code is not required; however, it is included here to demonstrate a tricky way of making the modification t

7、o P2_1. % Program Q2_2 % Modification of P1_1 to convert it to a high pass filter % Generate the input signal n = 0:100; s1 = cos(2*pi*0.05*n); % A low-frequency sinusoid s2 = cos(2*pi*0.47*n); % A high frequency sinusoid x = s1+s2; % Implementation of high pass filter M = input(Desired length of th

8、e filter = ); % By comparing eq. (2.13) to (2.3), you can see that “num“ % actually contains the impulse response (times the constant % M). What we are actually doing in Q2.2 is multiplying the % impulse response of the low pass filter in P2_1 by the % sequency (-1)n. This shifts the low pass freque

9、ncy 3 % response up to be centered at f=0.25, making it a high % pass filter. num = (-1).0:M-1; y = filter(num,1,x)/M; % Display the input and output signals clf; subplot(2,2,1); plot(n, s1); axis(0, 100, -2, 2); xlabel(Time index n); ylabel(Amplitude); title(Signal #1); subplot(2,2,2); plot(n, s2);

10、 axis(0, 100, -2, 2); xlabel(Time index n); ylabel(Amplitude); title(Signal #2); subplot(2,2,3); plot(n, x); axis(0, 100, -2, 2); xlabel(Time index n); ylabel(Amplitude); title(Input Signal); subplot(2,2,4); plot(n, y); axis(0, 100, -2, 2); xlabel(Time index n); ylabel(Amplitude); title(Output Signa

11、l); axis; 0 50 100-2-1012Time index nAmplitudeSignal #10 50 100-2-1012Time index nAmplitudeSignal #20 50 100-2-1012Time index nAmplitudeInput Signal0 50 100-2-1012Time index nAmplitudeOutput SignalThe effect of changing the LTI system on the input is The system is now a high pass filter. It passes t

12、he high-frequency input component s2 instead of the low frequency input component s1. 4 Q2.3 Program P2_1 is run for the following values of filter length M and following values of the fre-quencies of the sinusoidal signals s1n and s2n. The output generated for these different values of M and the fr

13、equencies are shown below. f1=0.05; f2=0.47; M=15 0 50 100-2-1012Time index nAmplitudeSignal #10 50 100-2-1012Time index nAmplitudeSignal #20 50 100-2-1012Time index nAmplitudeInput Signal0 50 100-2-1012Time index nAmplitudeOutput SignalFrom these plots we make the following observations with M=15,

14、the low pass characteristic is much more pronounced (the passband is now very narrow). s2 is still nearly eliminated in the output signal. s1 is still passed, but at an attenuated level. 5 f1=0.30; f2=0.47; M=4 0 50 100-2-1012Time index nAmplitudeSignal #10 50 100-2-1012Time index nAmplitudeSignal #

15、20 50 100-2-1012Time index nAmplitudeInput Signal0 50 100-2-1012Time index nAmplitudeOutput SignalFrom these plots we make the following observations with M=4, this filter performs more smoothing than in the case M=2. Both s1 and s2 are high frequency in this case, and they are both substantially at

16、tenuated in the output. f1=0.05; f2=0.10; M=3 0 50 100-2-1012Time index nAmplitudeSignal #10 50 100-2-1012Time index nAmplitudeSignal #20 50 100-2-1012Time index nAmplitudeInput Signal0 50 100-2-1012Time index nAmplitudeOutput Signal6 From these plots we make the following observations here s1 and s

17、2 are both low pass and they are both visible in the filter output. However, s2, the higher frequency input, is attenuated slightly more than s1 in the system output. Q2.4 The required modifications to Program P2_1 by changing the input sequence to a swept-frequency sinusoidal signal (length 101, mi

18、nimum frequency 0, and a maximum frequency 0.5) as the input signal (see Program P1_7) are listed below: % Program Q2_4 % Modify P2_1 to use a swept frequency chirp input % Generate the input signal n = 0:100; a = pi/200; b = 0; arg = a*n.*n + b*n; x = cos(arg); % Implementation of the moving averag

19、e filter M = input(Desired length of the filter = ); num = ones(1,M); y = filter(num,1,x)/M; % Display the input and output signals clf; subplot(2,1,1); plot(n, x); axis(0, 100, -1.5, 1.5); xlabel(Time index n); ylabel(Amplitude); title(Input Signal); subplot(2,1,2); plot(n, y); axis(0, 100, -1.5, 1

20、.5); xlabel(Time index n); ylabel(Amplitude); title(Output Signal); axis; 7 The output signal generated by running this program is plotted below. 0 10 20 30 40 50 60 70 80 90 100-101Time index nAmplitudeInput Signal0 10 20 30 40 50 60 70 80 90 100-101Time index nAmplitudeOutput SignalThe results of

21、Questions Q2.1 and Q2.2 from the response of this system to the swept-frequency signal can be explained as follows: we see again that this system is a low pass filter. At the left of the graphs, the input signal is a low frequency sinusoid that is passed to the output without attenuation. As n incre

22、ases, the frequency of the input rises, and increasing attenuation is seen at the output. In Q2.1, the input was a sum of two sinusoids s1 and s2 with f1=0.05 and f2=0.47. The swept frequency input of Q2.4 reaches a frequency of 0.05 at n=10, where there is virtually no attenuation in the output sho

23、wn above. This “explains” why s1 was passed by the system in Q2.1. The swept frequency input of Q2.4 reaches a frequency of 0.47 at approximately n=94, where the attenuation of the system is substantial. This “explains” why s2 was almost completely suppressed in the output in Q2.1. There is no direc

24、t relationship between the result shown above for Q2.4 and the result obtained in Q2.2. However, using frequency domain concepts (Chapter 3) we can reason that, if the swept frequency signal was input to the system yn = 0.5(xn xn-1), we would see a result opposite to what is shown above. Since the s

25、ystem would then be a high pass filter, there would be substantial attenuation of the output at the left side of the graph and virtually no attenuation at the right side of the graph. This “explains” why in Q2.2 the low frequency component s1 was suppressed in the system output, whereas the high fre

26、quency component s2 was passed. 8 Project 2.2 (Optional) A Simple Nonlinear Discrete-Time System A copy of Program P2_2 is given below: % Program P2_2 % Generate a sinusoidal input signal clf; n = 0:200; x = cos(2*pi*0.05*n); % Compute the output signal x1 = x 0 0; % x1n = xn+1 x2 = 0 x 0; % x2n = x

27、n x3 = 0 0 x; % x3n = xn-1 y = x2.*x2-x1.*x3; y = y(2:202); % Plot the input and output signals subplot(2,1,1) plot(n, x) xlabel(Time index n);ylabel(Amplitude); title(Input Signal) subplot(2,1,2) plot(n,y) xlabel(Time index n);ylabel(Amplitude); title(Output signal); Answers: Q2.5 The sinusoidal si

28、gnals with the following frequencies as the input signals were used to generate the output signals: f=0.05, f=0.1, f=0.25 The output signals generated for each of the above input signals are displayed below: 9 0 20 40 60 80 100 120 140 160 180 20000.10.20.30.40.50.60.70.80.91Time index nAmplitudeOut

29、put Signal0 20 40 60 80 100 120 140 160 180 2000.40.50.60.70.80.91Time index nAmplitudeOutput Signal10 0 20 40 60 80 100 120 140 160 180 20000.20.40.60.811.21.41.61.82Time index nAmplitudeOutput SignalThe output signals depend on the frequencies of the input signal according to the following rules:

30、up to “edge effects” visible at the very left and right sides of the first graph, the output is given by yn = sin2(2f). This observation can be explained mathematically as follows: Let 2 f= . Then cos( )x nn= and 22 cos( )x nn= (1.1) Now, 1 cos ( 1) cos( )xnnn+= + = + and 1 cos ( 1)xn n = cos( )n, s

31、o 1 1 cos( )cos( )xn xn n n+=+. Applying the trigonometric identity1122cos( )cos( ) cos(2 ) cos(2 )AB AB A B+= + , this becomes 11 1 1 cos(2 ) cos(2 ).22xn xn n+ = + (1.2) Applying the trigonometric identity 2cos(2 ) 2cos ( ) 1AA= to the first term of (1.2), we obtain 11 21111cos() cos(2).22xn xn n+

32、=+ (1.3) Applying the identity 2cos(2 ) 1 2sin ( )AA= to the second term of (1.3) gives us 2211cos()sin().xn xn n+ = (1.4) It follows immediately from (1.1) and (1.4) that 222 1 1sin ( )sin (2 ).yn x n xn xnf= + =12 Q2.6 The output signal generated by using sinusoidal signals of the form xn = sin(on

33、) + K as the input signal is shown below for the following values of o and K - o = 0.1; K = 0.5 0 20 40 60 80 100 120 140 160 180 20000.511.522.5Time index nAmplitudeOutput SignalThe dependence of the output signal yn on the DC value K can be explained as Again let 2.f= Then cos( )x nnK= + and 22 2

34、cos( ) 2 cos( ) .x nnKnK=+ + (1.5) We have 1 cos ( 1) cos( )x nnKn+= += +and 1 cos ( 1) cos( ) .x nnKnK= += + So 2 1 1 cos( )cos( ) cos( ) cos( ) .x nxn n nKnKnK+ = + + + + (1.6) From (1.4), we have that 22cos( )cos( ) cos ( ) sin ( ),nn nn + = so (1.6) may be written as 22 2 1 1 cos ( ) sin ( ) cos

35、( ) cos( ) .x nxn n nK n n K+=+ +(1.7) Applying the trigonometric identity cos( ) cos( ) 2cos( )cos( )AB AB A B+ += to the term in square brackets in (1.7), we have that 2211cos()sin()2cos()cos()2.x nxn K n K+=+ + 13 Combining the this result with (1.5), it follows immediately that 2 sin(2 ) 2 1 cos

36、(2 )cos(2 ).y nfKffn=+ So addition of the constant K to the input cosine signal has the effect of adding a ripple onto the result that was obtained before in Q2.5. This ripple is a cosine wave of frequency f and amplitude 2 1 cos(2 ),Kf as can be seen plainly in the graph above. Project 2.3 Linear a

37、nd Nonlinear Systems A copy of Program P2_3 is given below: % Program P2_3 % Generate the input sequences clf; n = 0:40; a = 2;b = -3; x1 = cos(2*pi*0.1*n); x2 = cos(2*pi*0.4*n); x = a*x1 + b*x2; num = 2.2403 2.4908 2.2403; den = 1 -0.4 0.75; ic = 0 0; % Set zero initial conditions y1 = filter(num,d

38、en,x1,ic); % Compute the output y1n y2 = filter(num,den,x2,ic); % Compute the output y2n y = filter(num,den,x,ic); % Compute the output yn yt = a*y1 + b*y2; d = y - yt; % Compute the difference output dn % Plot the outputs and the difference signal subplot(3,1,1) stem(n,y); ylabel(Amplitude); title(

39、Output Due to Weighted Input: a cdot x_1n + b cdot x_2n); subplot(3,1,2) stem(n,yt); ylabel(Amplitude); title(Weighted Output: a cdot y_1n + b cdot y_2n); subplot(3,1,3) stem(n,d); xlabel(Time index n);ylabel(Amplitude); title(Difference Signal); 14 Answers: Q2.7 The outputs yn, obtained with weight

40、ed input, and ytn, obtained by combining the two outputs y1n and y2n with the same weights, are shown below along with the difference between the two signals: 0 5 10 15 20 25 30 35 40-50050AmplitudeOutput Due to Weighted Input: a x1n + b x2n0 5 10 15 20 25 30 35 40-50050AmplitudeWeighted Output: a y

41、1n + b y2n0 5 10 15 20 25 30 35 40-505x 10-15Time index nAmplitudeDifference SignalThe two sequences are the same up to numerical roundoff. The system is Linear. Q2.8 Program P2_3 was run for the following three different sets of values of the weighting constants, a and b, and the following three di

42、fferent sets of input frequencies: 1. a=1; b=-1; f1=0.05; f2=0.4; 2. a=10; b=2; f1=0.10; f2=0.25; 3. a=2; b=10; f1=0.15; f2=0.20; The plots generated for each of the above three cases are shown below: 15 0 5 10 15 20 25 30 35 40-20020AmplitudeOutput Due to Weighted Input: a x1n + b x2n0 5 10 15 20 2

43、5 30 35 40-20020AmplitudeWeighted Output: a y1n + b y2n0 5 10 15 20 25 30 35 40-505x 10-15Time index nAmplitudeDifference Signal0 5 10 15 20 25 30 35 40-1000100AmplitudeOutput Due to Weighted Input: a x1n + b x2n0 5 10 15 20 25 30 35 40-1000100AmplitudeWeighted Output: a y1n + b y2n0 5 10 15 20 25 3

44、0 35 40-202x 10-14Time index nAmplitudeDifference Signal16 0 5 10 15 20 25 30 35 40-2000200AmplitudeOutput Due to Weighted Input: a x1n + b x2n0 5 10 15 20 25 30 35 40-2000200AmplitudeWeighted Output: a y1n + b y2n0 5 10 15 20 25 30 35 40-505x 10-14Time index nAmplitudeDifference SignalBased on thes

45、e plots we can conclude that the system with different weights is Linear. Q2.9 Program 2_3 was run with the following non-zero initial conditions ic = 5 10; The plots generated are shown below - 0 5 10 15 20 25 30 35 40-20020AmplitudeOutput Due to Weighted Input: a x1n + b x2n0 5 10 15 20 25 30 35 4

46、0-50050AmplitudeWeighted Output: a y1n + b y2n0 5 10 15 20 25 30 35 40-50050Time index nAmplitudeDifference Signal17 Based on these plots we can conclude that the system with nonzero initial conditions is Nonlinear. Q2.10 Program P2_3 was run with nonzero initial conditions and for the following thr

47、ee different sets of values of the weighting constants, a and b, and the following three different sets of input frequencies: 1. a=1; b=-1; f1=0.05; f2=0.4; 2. a=10; b=2; f1=0.10; f2=0.25; 3. a=2; b=10; f1=0.15; f2=0.20; The plots generated for each of the above three cases are shown below: 0 5 10 1

48、5 20 25 30 35 40-20020AmplitudeOutput Due to Weighted Input: a x1n + b x2n0 5 10 15 20 25 30 35 40-10010AmplitudeWeighted Output: a y1n + b y2n0 5 10 15 20 25 30 35 40-20020Time index nAmplitudeDifference Signal18 0 5 10 15 20 25 30 35 40-1000100AmplitudeOutput Due to Weighted Input: a x1n + b x2n0 5 10 15 20 25 30 35 40-5000500AmplitudeWeighted Output: a y1n + b

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报