数字信号处理实验报告材料2.doc

上传人:夺命阿水 文档编号:7544 上传时间:2022-06-21 格式:DOC 页数:16 大小:763KB
返回 下载 相关 举报
数字信号处理实验报告材料2.doc_第1页
第1页 / 共16页
数字信号处理实验报告材料2.doc_第2页
第2页 / 共16页
数字信号处理实验报告材料2.doc_第3页
第3页 / 共16页
数字信号处理实验报告材料2.doc_第4页
第4页 / 共16页
数字信号处理实验报告材料2.doc_第5页
第5页 / 共16页
点击查看更多>>
资源描述

《数字信号处理实验报告材料2.doc》由会员分享,可在线阅读,更多相关《数字信号处理实验报告材料2.doc(16页珍藏版)》请在课桌文档上搜索。

1、wordName:Section:Laboratory Exercise 2DISCRETE-TIME SYSTEMS: TIME-DOMAIN REPRESENTATIONSIMULATION OF DISCRETE-TIME SYSTEMSTheMoving 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 signaln = 0:100;s1 = cos(2*pi*0.

2、05*n); % A low-frequency sinusoids2 = cos(2*pi*0.47*n); % A high frequency sinusoidx = s1+s2;% Implementation of the moving average filterM = input(Desired length of the filter = );num = ones(1,M);y = filter(num,1,x)/M;% Display the input and output signalsclf;subplot(2,2,1);plot(n, s1);axis(0, 100,

3、 -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(Amplitude);title(Input Signal);subplot(2,2,4);plot(n, y)

4、;axis(0, 100, -2, 2);xlabel(Time index n); ylabel(Amplitude);title(Output Signal); axis;Answers:Q2.1 The output sequence generated by running the above program for M = 2 withxn = s1n+s2nas the input is shown below. The ponent of the input xn suppressed by the discrete-time system simulated by this p

5、rogram is s2 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:s3=cos(2*pi*0.05*(n-1);s4= cos(2*pi*0.47*(n-1);z=s3+s4;y = 0.5*(x-z);The effect of changing the LTI system on the input is - (Optional) A S

6、imple Nonlinear Discrete-Time SystemA copy of Program P2_2 is given below:% Program P2_2% Generate a sinusoidal input signalclf;n = 0:200;x = cos(2*pi*0.05*n);% pute the output signalx1 = x 0 0; % x1n = xn+1 x2 = 0 x 0; % x2n = xnx3 = 0 0 x; % x3n = xn-1y = x2.*x2-x1.*x3;y = y(2:202);% Plot the inpu

7、t and output signalssubplot(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: The sinusoidal signals with the following frequencies as the input signals were used to generate the outpu

8、t signals:The output signals generated for each of the above input signals are displayed below:The output signals depend on the frequencies of the input signal according to the following rules:This observation can be explained mathematically as follows:Linear and Nonlinear SystemsA copy of Program P

9、2_3 is given below:% Program P2_3% Generate the input sequencesclf;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 conditionsy1 = filter(num,den,x1,ic); % pute the output y1ny2 = filter(num,den,

10、x2,ic); % pute the output y2ny = filter(num,den,x,ic); % pute the output ynyt = a*y1 + b*y2; d = y - yt; % pute the difference output dn% Plot the outputs and the difference signalsubplot(3,1,1)stem(n,y);ylabel(Amplitude);title(Output Due to Weighted Input: a cdot x_1n + b cdot x_2n);subplot(3,1,2)s

11、tem(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);Answers:The outputs yn, obtained with weighted input, and ytn, obtained by bining the two outputs y1n and y2n with the same weights, a

12、re shown below along with the difference between the two signals:The two sequences are same ;we can regard 10(-15) as 0 The system is a liner system Program 2_3 was run with the following non-zero initial conditions -ic = 2 2;The plots generated are shown below -Based on these plots we can conclude

13、that the system with nonzero initial conditions is as same as the zero initial condition with the time goneTime-invariant and Time-varying SystemsA copy of Program P2_4 is given below:% Program P2_4% Generate the input sequencesclf;n = 0:40; D = 10;a = 3.0;b = -2;x = a*cos(2*pi*0.1*n) + b*cos(2*pi*0

14、.4*n);xd = zeros(1,D) x;num = 2.2403 2.4908 2.2403;den = 1 -0.4 0.75;ic = 0 0; % Set initial conditions% pute the output yny = filter(num,den,x,ic);% pute the output ydnyd = filter(num,den,xd,ic);% pute the difference output dnd = y - yd(1+D:41+D);% Plot the outputssubplot(3,1,1)stem(n,y);ylabel(Amp

15、litude); title(Output yn); grid;subplot(3,1,2)stem(n,yd(1:41);ylabel(Amplitude);title(Output due to Delayed Input xn ?, num2str(D),); grid;subplot(3,1,3)stem(n,d);xlabel(Time index n); ylabel(Amplitude);title(Difference Signal); grid; Answers: The output sequences ynandydn-10 generated by running Pr

16、ogram P2_4 are shown below - These two sequences are related as follows same, the output dont change with the timeThe system is -Time invariant system The output sequences ynandydn-10 generated by running Program P2_4 for non-zero initial conditions are shown below - ic = 5 2;These two sequences are

17、 related as follows just as the sequences aboveThe system is not related to the initial conditionsLINEAR TIME-INVARIANT DISCRETE-TIME SYSTEMSputation of Impulse Responses of LTI SystemsA copy of Program P2_5 is shown below:% Program P2_5% pute the impulse response yclf;N = 40;num = 2.2403 2.4908 2.2

18、403;den = 1 -0.4 0.75;y = impz(num,den,N);% Plot the impulse responsestem(y);xlabel(Time index n); ylabel(Amplitude);title(Impulse Response); grid; Answers:Q2.19 The first 41 samples of the impulse response of the discrete-time system of Project 2.3 generated by running Program P2_5 is given below:C

19、ascade of LTI SystemsA copy of Program P2_6 is given below:% Program P2_6% Cascade Realizationclf;x = 1 zeros(1,40); % Generate the inputn = 0:40;% Coefficients of 4th order systemden = 1 1.6 2.28 1.325 0.68;num = 0.06 -0.19 0.27 -0.26 0.12;% pute the output of 4th order systemy = filter(num,den,x);

20、% Coefficients of the two 2nd order systemsnum1 = 0.3 -0.2 0.4;den1 = 1 0.9 0.8;num2 = 0.2 -0.5 0.3;den2 = 1 0.7 0.85;% Output y1n of the first stage in the cascadey1 = filter(num1,den1,x);% Output y2n of the second stage in the cascadey2 = filter(num2,den2,y1);% Difference between yn and y2nd = y -

21、 y2;% Plot output and difference signalssubplot(3,1,1);stem(n,y);ylabel(Amplitude);title(Output of 4th order Realization); grid;subplot(3,1,2);stem(n,y2)ylabel(Amplitude);title(Output of Cascade Realization); grid;subplot(3,1,3);stem(n,d)xlabel(Time index n);ylabel(Amplitude);title(Difference Signal

22、); grid; Answers: The output sequencesyn, y2n, and the difference signal dngenerated by running Program P2_6 are indicated below:The relation between yn andy2nis yn is the Convolution of y2n and y1nThe 4th order system can do the same job as the cascade system The sequences generated by running Prog

23、ram P2_6 with the input changed to a sinusoidal sequence are as follows:x = sin(2*pi*0.05*n);The relation between yn andy2nin this case is same as the relation aboveConvolutionA copy of Program P2_7 is reproduced below:% Program P2_7clf;h = 3 2 1 -2 1 0 -4 0 3; % impulse responsex = 1 -2 3 -4 3 2 1;

24、 % input sequencey = conv(h,x);n = 0:14;subplot(2,1,1);stem(n,y);xlabel(Time index n); ylabel(Amplitude);title(Output Obtained by Convolution); grid;x1 = x zeros(1,8);y1 = filter(h,1,x1);subplot(2,1,2);stem(n,y1);xlabel(Time index n); ylabel(Amplitude);title(Output Generated by Filtering); grid; Ans

25、wers:Q2.28 The sequences yn andy1n generated by running Program P2_7 are shown below:The difference between ynandy1nis - sameThe reason for using x1n as the input, obtained by zero-paddingxn, for generatingy1nis the length of x is 7,but the length of the Convolution is 14,and n=14,we need the length

26、 of filter to be 14Stability of LTI SystemsA copy of Program P2_8 is given below:% Program P2_8% Stability test based on the sum of the absolute % values of the impulse response samplesclf;num = 1 -0.8; den = 1 1.5 0.9;N = 200;h = impz(num,den,N+1);parsum = 0;for k = 1:N+1; parsum = parsum + abs(h(k

27、);if abs(h(k) 10(-6), break, endend% Plot the impulse responsen = 0:N;stem(n,h)xlabel(Time index n); ylabel(Amplitude);% Print the value of abs(h(k) disp(Value =);disp(abs(h(k); Answers: The discrete-time system of Program P2_8 is - h,t = impz(hd) putes the instantaneous impulse response of the disc

28、rete-time filter hd choosing the number of samples for you, and returns the response in column vector h and a vector of times or sample intervals in t where (t = 0 1 2.). impz returns a matrix h if hd is a vector. Each column of the matrix corresponds to one filter in the vector. When hd is a vector

29、 of discrete-time filters, impz returns the matrix h. Each column of h corresponds to one filter in the vector hd. impz(hd) uses FVTool to plot the impulse response of the discrete-time filter hd. If hd is a vector of filters, impz plots the response and for each filter in the vector.The impulse res

30、ponse generated by running Program P2_8 is shown below:The value of |h(K)| here is - From this value and the shape of the impulse response we can conclude that the system is - ?By running Program P2_8 with a larger value of N the new value of |h(K)| is - N = 400;From this value we can conclude that

31、the system is - ?Illustration of the Filtering ConceptA copy of Program P2_9 is given below:% Program P2_9% Generate the input sequenceclf;n = 0:299;x1 = cos(2*pi*10*n/256);x2 = cos(2*pi*100*n/256);x = x1+x2;% pute the output sequencesnum1 = 0.5 0.27 0.77;y1 = filter(num1,1,x); % Output of System #1

32、den2 = 1 -0.53 0.46;num2 = 0.45 0.5 0.45;y2 = filter(num2,den2,x); % Output of System #2% Plot the output sequencessubplot(2,1,1);plot(n,y1);axis(0 300 -2 2);ylabel(Amplitude);title(Output of System #1); grid;subplot(2,1,2);plot(n,y2);axis(0 300 -2 2);xlabel(Time index n); ylabel(Amplitude);title(Output of System #2); grid;Answers: The output sequences generated by this program are shown below:The filter with better characteristics for the suppression of the high frequency ponent of the input signal xnis system#2Date:Signature:16 / 16

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

当前位置:首页 > 在线阅读 > 生活休闲


备案号:宁ICP备20000045号-1

经营许可证:宁B2-20210002

宁公网安备 64010402000986号