第二章實(shí)驗(yàn)離散時(shí)間系統(tǒng)的時(shí)域_第1頁
第二章實(shí)驗(yàn)離散時(shí)間系統(tǒng)的時(shí)域_第2頁
第二章實(shí)驗(yàn)離散時(shí)間系統(tǒng)的時(shí)域_第3頁
第二章實(shí)驗(yàn)離散時(shí)間系統(tǒng)的時(shí)域_第4頁
第二章實(shí)驗(yàn)離散時(shí)間系統(tǒng)的時(shí)域_第5頁
已閱讀5頁,還剩20頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、 南昌大學(xué)實(shí)驗(yàn)報(bào)告學(xué)生姓名:* 學(xué) 號(hào): 6103413001 專業(yè)班級(jí): * 實(shí)驗(yàn)類型: 驗(yàn)證 綜合 設(shè)計(jì) 創(chuàng)新 實(shí)驗(yàn)日期: 實(shí)驗(yàn)成績: 第二章:離散時(shí)間信號(hào)的時(shí)域分析一、實(shí)驗(yàn)?zāi)康模?、學(xué)會(huì)用MATLAB在時(shí)域中產(chǎn)生一些基本的離散時(shí)間信號(hào),并對這些信號(hào)進(jìn)行一些基本的運(yùn)算。2、學(xué)會(huì)使用基本的MATLAB命令,并將它們應(yīng)用到簡單的數(shù)字信號(hào)處理問題中。二、實(shí)驗(yàn)要求:1、學(xué)習(xí)并調(diào)試本章所給的例子。2、回答書后給出的問題。3、實(shí)驗(yàn)報(bào)告僅回答奇數(shù)信號(hào)的例子。三、實(shí)驗(yàn)程序及結(jié)果Q2.1 對M=2,運(yùn)行上述程序,生成輸入xn=s1n+s2n的輸出信號(hào)。輸入xn的哪個(gè)分量被該離散時(shí)間系統(tǒng)抑制?Project

2、2.1滑動(dòng)平均系統(tǒng) % 程序 P2_1% 一個(gè)M點(diǎn)滑動(dòng)平均濾波器的仿真% 產(chǎn)生輸入信號(hào)n = 0:100;s1 = cos(2*pi*0.05*n); % 一個(gè)低頻正弦s2 = cos(2*pi*0.47*n); % 一個(gè)高頻正弦x = s1+s2;% M點(diǎn)滑動(dòng)平均濾波器的實(shí)現(xiàn)M = input('濾波器所需的長度 = ');num = ones(1,M);y = filter(num,1,x)/M;clf;subplot(2,2,1);plot(n, s1);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅

3、');title('低頻正弦');subplot(2,2,2);plot(n, s2);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅');title('高頻正弦');subplot(2,2,3);plot(n, x);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅');title('輸入信號(hào)');subplot(2,2,4);plot(n, y);axis(0, 100, -2,

4、 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅');title('輸出信號(hào)'); axis;仿真結(jié)果如圖所示:輸入部分高頻分量被抑制了。Q2.3對濾波器長度M和正弦信號(hào)s1n和s2n的頻率取其他值,運(yùn)行程序P2.1,算出結(jié)果。n = 0:100;s1=cos(2*pi*0.02*n);s2=cos(2*pi*0.46*n);x = s1+s2;% M點(diǎn)滑動(dòng)平均濾波器的實(shí)現(xiàn)M = input('濾波器所需的長度 = ');num = ones(1,M);y = filter(num,1,x)/M;clf;figure

5、,subplot(2,2,1);plot(n, s1);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅');title('低頻正弦');subplot(2,2,2);plot(n, s2);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅');title('高頻正弦');subplot(2,2,3);plot(n, x);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n')

6、; ylabel('振幅');title('輸入信號(hào)');subplot(2,2,4);plot(n, y);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅');title('輸出信號(hào)'); axis;num =1,-ones(1,M-1);y = filter(num,1,x)/M;figure,subplot(2,2,1);plot(n, s1);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅

7、');title('低頻正弦');subplot(2,2,2);plot(n, s2);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅');title('高頻正弦');subplot(2,2,3);plot(n, x);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅');title('輸入信號(hào)');subplot(2,2,4);plot(n, y);axis(0, 100, -2,

8、 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅');title('輸出信號(hào)'); axis;輸入部分的高頻成分成分被抑制了。close all n = 0:100;s1=cos(2*pi*0.02*n);s2=cos(2*pi*0.46*n);x = s1+s2;% M點(diǎn)滑動(dòng)平均濾波器的實(shí)現(xiàn)M = input('濾波器所需的長度 = ');num = ones(1,M);y = filter(num,1,x)/M;clf;figure,subplot(2,2,1);plot(n, s1);axis(0, 100,

9、-2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅');title('低頻正弦');subplot(2,2,2);plot(n, s2);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅');title('高頻正弦');subplot(2,2,3);plot(n, x);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅');title('輸入信號(hào)

10、9;);subplot(2,2,4);plot(n, y);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅');title('輸出信號(hào)'); axis;num =1,-ones(1,M-1);y = filter(num,1,x)/M;figure,subplot(2,2,1);plot(n, s1);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅');title('低頻正弦');subplot(2,2,

11、2);plot(n, s2);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅');title('高頻正弦');subplot(2,2,3);plot(n, x);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('振幅');title('輸入信號(hào)');subplot(2,2,4);plot(n, y);axis(0, 100, -2, 2);xlabel('時(shí)間序號(hào)n'); ylabel('

12、振幅');title('輸出信號(hào)'); axis;仿真結(jié)果如下圖所示:修改程序中的num=ones(1,M)為num=1,-ones(1,M-1)。  運(yùn)行結(jié)果如下圖,可以看出輸出信號(hào)保留了輸入信號(hào)xn的高頻分量,即保留了s2n分量,低頻部分s1n被抑制了。Q2.5 用不同頻率的正弦信號(hào)作為輸入信號(hào),計(jì)算每個(gè)輸入信號(hào)的輸出信號(hào)。輸出信號(hào)是如何受到輸入信號(hào)頻率的影響的?從數(shù)學(xué)上對你的結(jié)論加以證明。% 程序P2_2% 產(chǎn)生一個(gè)正弦輸入信號(hào)clf;n = 0:200;f=input('Please input the value of f:'

13、;)x = cos(2*pi*f*n);% 計(jì)算輸出信號(hào)x1 = 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);% 畫出輸入和輸出信號(hào)subplot(2,1,1)plot(n, x)xlabel('時(shí)間序列n');ylabel('振幅');title('輸入信號(hào)')subplot(2,1,2)plot(n,y)xlabel('時(shí)間信號(hào)n');ylabel('振幅');t

14、itle('輸出信號(hào)');分別取F=0.05,F(xiàn)=0.47,F(xiàn)=0.5以及F=0,仿真結(jié)果如下所示:F=0.05F=0.47F=0.5F=0證明:設(shè)輸入信號(hào)為,則以及。則Q2.7 運(yùn)行程序P2.3,對由加權(quán)輸入得到的yn在與相同權(quán)系數(shù)下輸出y1n和y2n相加得到的ytn進(jìn)行比較,這兩個(gè)序列是否相等?該系統(tǒng)是線性系統(tǒng)么?程序P2.3clf;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

15、;ic = 0 0;y1 = filter(num,den,x1,ic);y2 = filter(num,den,x2,ic); y = filter(num,den,x,ic);yt = a*y1 + b*y2; d = y - yt; subplot(3,1,1)stem(n,y);ylabel('振幅');title('加權(quán)輸入: a cdot x_1n + b cdot x_2n的輸出');subplot(3,1,2)stem(n,yt);ylabel('這幅');title('加權(quán)輸出: a cdot y_1n + b cdot

16、 y_2n');subplot(3,1,3)stem(n,d);xlabel('時(shí)間序號(hào) n');ylabel('振幅');title('差信號(hào)');仿真結(jié)果如下圖所示:該仿真結(jié)果說明這兩個(gè)序列相等,該系統(tǒng)是線性系統(tǒng)。Q2.9 當(dāng)初始條件非零時(shí)重做習(xí)題Q2.7。解:令ic = 10 20;則仿真結(jié)論如下所示:這兩個(gè)序列相等,該系統(tǒng)為線性系統(tǒng)。Q2.11 假定另一個(gè)系統(tǒng)為yn=xnxn-1,修改程序P2.3,計(jì)算這個(gè)系統(tǒng)的輸出序列y1n,y2n和yn。比較yn和ytn。這兩個(gè)序列是否相等?該系統(tǒng)是線性系統(tǒng)嗎?解:這兩個(gè)序列不相等。該系統(tǒng)是非

17、線性系統(tǒng)。n=0:40;a=2;b=-3;x11=0 cos(2*pi*f1*n) 0;x12=0 0 cos(2*pi*f1*n);x21=0 cos(2*pi*f2*n) 0; x22=0 0 cos(2*pi*f2*n);y1=x11.*x12;y2=x21.*x22;yt=a*y1+b*y2;y=(a*x11+b*x21).*(a*x12+b*x22);d=y-yt;subplot(3,1,1)stem(0 n 0,y);ylabel('振幅');title('加權(quán)輸入: a cdot x_1n + b cdot x_2n的輸出');subplot(3,

18、1,2)stem(0 n 0,yt);ylabel('振幅');title('加權(quán)輸出: a cdot y_1n + b cdot y_2n');subplot(3,1,3)stem(0 n 0,d);xlabel('時(shí)間序號(hào) n');ylabel('振幅');title('差信號(hào)');仿真結(jié)果如下所示:這兩個(gè)序列不相等,該系統(tǒng)不是線性系統(tǒng)。Q2.13 采用三個(gè)不同的延時(shí)變量D的值重做習(xí)題Q2.12。解:三個(gè)不同的延時(shí)D分別為2 6 12,圖形分別見下圖:D=2;D=6;D=12;該系統(tǒng)是時(shí)不變系統(tǒng),滿足yn-D=

19、ydn。Q2.15 在非零的初始條件下重做習(xí)題Q2.12,該系統(tǒng)是時(shí)不變系統(tǒng)嗎?解:設(shè)ic = 5 10; 仿真結(jié)果如下所示:該仿真結(jié)果說明該系統(tǒng)是時(shí)變系統(tǒng)。Q2.17 考慮另一個(gè)系統(tǒng):yn=nxn+xn-1,修改程序P2.4,以仿真上面的系統(tǒng)并確定該系統(tǒng)是否為時(shí)不變系統(tǒng)。解:% 程序 P2_4clf;n = 0:40; D = 10;a = 3.0;b = -2;x = a*cos(2*pi*0.1*n) + b*cos(2*pi*0.4*n);xd = zeros(1,D) x;nd=0:length(xd)-1;y=(n.*x)+0 x(1:40);yd=(nd.*xd)+0 xd(1:

20、length(xd)-1);d = y - yd(1+D:41+D);subplot(3,1,1)stem(n,y);ylabel('振幅'); title('輸出 yn'); grid;subplot(3,1,2)stem(n,yd(1:41);ylabel('振幅');title('由于延時(shí)輸入 xn-10的輸出'); grid;subplot(3,1,3)stem(n,d);xlabel('時(shí)間序號(hào) n'); ylabel('振幅');title('差值信號(hào)');grid;仿真

21、結(jié)果如下所示:從仿真結(jié)果看,該系統(tǒng)是時(shí)變系統(tǒng)。Q2.19 運(yùn)行程序P2.5,生成式(2.15)所給的離散系統(tǒng)的沖激響應(yīng)。解:clf;N=40;num=2.2403 2.4908 2.2403;den=1 -0.4 0.75;y=impz(num,den,N);%畫出沖激相應(yīng)stem(y);xlabel('時(shí)間序號(hào)n');ylabel('振幅');>> title('沖激響應(yīng)');grid;仿真結(jié)果如下所示:Q2.21 利用filter命令編寫一個(gè)MATLB程序,生成式(2.17)給出的因果線性時(shí)不變系統(tǒng)的沖激響應(yīng),計(jì)算并畫出前40個(gè)的

22、樣本。把你的結(jié)果和習(xí)題Q2.20中得到的結(jié)果相比較。% Program Q2_21% Compute the impulse response yclf;N = 40;num = 0.9 -0.45 0.35 0.002;den = 1.0 0.71 -0.46 -0.62;% input: unit pulsex = 1 zeros(1,N-1);% outputy = filter(num,den,x);% Plot the impulse response% NOTE: the time axis will be WRONG; h0 will% be plotted at n=1; bu

23、t this will agree with% the INCORRECT plotting that was also done% by program P2_5.stem(y);xlabel('Time index n'); ylabel('Amplitude');title('Impulse Response'); grid;仿真結(jié)果如下所示:Q2.23 運(yùn)行程序P2.6,計(jì)算輸出序列yn和y2n以及差值信號(hào)dn。yn和y2n相等嗎?% Program P2_6% Cascade Realizationclf;x = 1 zeros(1,4

24、0); % 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;% Compute the output of 4th order systemy = filter(num,den,x);% 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

25、.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 - y2;% Plot output and difference signalssubplot(3,1,1);stem(n,y);ylabel('Amplitude');title('Output

26、 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'); grid;仿真結(jié)果如下所示:y(n)和y2(n)相等。Q2.25 用任意的

27、非零初始向量ic,ic1和ic2來重做習(xí)題Q2.23。clf;x=sin(2*pi*0.2*n); % 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;xi=1 2 3 4;% Compute the output of 4th order systemy = filter(num,den,x,xi);% Coefficients of the two 2nd order systemsnum1 =

28、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;xi1=1 2;% Output y1n of the first stage in the cascadey1 = filter(num1,den1,x,xi1);xi2=3 4;% Output y2n of the second stage in the cascadey2 = filter(num2,den2,y1,xi2);% Difference between yn and y2nd = y - y2;% Plot output and diff

29、erence 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('Ampli

30、tude');title('Difference Signal'); grid;仿真結(jié)果如下圖所示:Q2.27 用任意非零初始向量ic,ic1和ic2來重做習(xí)題Q2.26。% Program P2.27% 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;ic=4 10 2 12% Compu

31、te the output of 4th order systemy = filter(num,den,x,ic);% 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(num2,den2,x,ic(1:2);% Output y2n of the second stage in the cascad

32、ey2 = filter(num1,den1,y1,ic(3:4);% Difference between yn and y2nd = y - 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 Cascad

33、e Realization'); grid;subplot(3,1,3);stem(n,d)xlabel('Time index n');ylabel('Amplitude');title('Difference Signal'); grid;仿真結(jié)果如下所示:Q2.29 修改程序P2.7,計(jì)算長度為15的序列hn和長度為10的序列xn的卷積,重做問題Q2.28。hn和xn的樣本值你自己給定。% Program P2.29clf;h = 3 2 1 -2 1 0 -4 0 3 1 5 4 0 3 5; % impulse response

34、x = 1 -2 3 -4 3 2 1 5 6 1; % input sequencey = conv(h,x);n = 0:23;subplot(2,1,1);stem(n,y);xlabel('Time index n'); ylabel('Amplitude');title('Output Obtained by Convolution'); grid;x1 = x zeros(1,14);y1 = filter(h,1,x1);subplot(2,1,2);stem(n,y1);xlabel('Time index n'); ylabel('Amplitude');title('Output Generated by Filtering'); grid;仿真結(jié)果如下所示:xn后面補(bǔ)零數(shù)應(yīng)為x(n)和hn序列的長度之和減一,為14.Q2.31 使用命令break的目的是什么?使用命令break是使當(dāng)在k未到最后一個(gè)數(shù)值是此時(shí)的值已經(jīng)小于時(shí),跳出for循環(huán)。Q2.33 考慮用差分方程描述的離散時(shí)間系統(tǒng)

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論