信號(hào)系統(tǒng)MATLAB實(shí)驗(yàn)報(bào)告材料_第1頁(yè)
信號(hào)系統(tǒng)MATLAB實(shí)驗(yàn)報(bào)告材料_第2頁(yè)
信號(hào)系統(tǒng)MATLAB實(shí)驗(yàn)報(bào)告材料_第3頁(yè)
信號(hào)系統(tǒng)MATLAB實(shí)驗(yàn)報(bào)告材料_第4頁(yè)
信號(hào)系統(tǒng)MATLAB實(shí)驗(yàn)報(bào)告材料_第5頁(yè)
已閱讀5頁(yè),還剩26頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、實(shí)用文檔信號(hào)與系統(tǒng)實(shí)驗(yàn)報(bào)告桂林理工大學(xué) 信息科學(xué)與工程學(xué)院 電子信息工程實(shí)驗(yàn)二 信號(hào)及其表示【實(shí)驗(yàn)?zāi)康摹苛私飧鞣N常用信號(hào)的表達(dá)方式掌握部分繪圖函數(shù)【實(shí)驗(yàn)內(nèi)容】 一、繪出連續(xù)時(shí)間信號(hào)x(t)=sint關(guān)于t的曲線,t 的范圍為 030s,并以0.1s遞增。MATLAB源程序?yàn)椋簍=0:0.1:30; %對(duì)時(shí)間變量賦值x=exp(-0.707*t).*sin(2/3.*t); %計(jì)算變量所對(duì)應(yīng)得函數(shù)值plot(t,x);grid; %繪制函數(shù)曲線ylabel(x(t);xlabel(Time(sec)二、產(chǎn)生周期為0.02的方波。MATLAB源程序?yàn)椋?Fs=100000;t=0:1/Fs:1;

2、x1=square(2*pi*50*t,20); x2=square(2*pi*50*t,80); subplot(2,1,1),plot(t,x1),axis(0,0.2,-1.5,1.5); subplot(2,1,2),plot(t,x2),axis(0,0.2,-1.5,1.5);三、產(chǎn)生sinc(x)函數(shù)波形。MATLAB源程序?yàn)椋簒=linspace(-4,4);y=sinc(x);plot(x,y) 四、繪制離散時(shí)間信號(hào)的棒狀圖。其中x(-1)=-1,x(0)=1,x(1)=2,x(2)=1,x(3)=0,x(4)=-1,其他時(shí)間x(n)=0。MATLAB源程序?yàn)椋簄=-3:5;

3、 %定位時(shí)間變量x=0,0,-1,1,2,1,-1,0,0;stem(n,x);grid; %繪制棒狀圖line(-3,5,0,0); %畫X軸線xlabel(n);ylabel(xn)五、單位脈沖序列 (n-)=直接實(shí)現(xiàn):x=zeros(1,N);x(1,n0)=1;函數(shù)實(shí)現(xiàn):利用單位脈沖序列的生成函數(shù)impseq,即functionx,n=impseq(n0,ns,nf)n=ns:nf;x=(n-n0)=0;plot(n,x);stem(n,x);輸入?yún)?shù):impseq(0,0,9)連續(xù)圖形輸入?yún)?shù):impseq(0,0,9)離散圖形六、單位階躍序列 (n-)= 直接實(shí)現(xiàn):n=ns:nf;

4、x=(n-n0)=0;函數(shù)實(shí)現(xiàn):利用單位階躍序列的生成函數(shù)stepseq,即Functionx,n=stepseq(n0,ns,nf)n=ns:nf;x=(n-n0)=0;plot(n,x);七、實(shí)指數(shù)序列 直接實(shí)現(xiàn):n=ns:nf:x=a.n;函數(shù)實(shí)現(xiàn):利用實(shí)指數(shù)序列的生成函數(shù)rexpseq,即Functionx,n=rexpseq(a,ns,nf)n=ns:nf;x=a,n:八、復(fù)指數(shù)序列 直接實(shí)現(xiàn):n=ns:nf;x=exp(sigema+jw)*n);函數(shù)實(shí)現(xiàn):利用復(fù)指數(shù)序列的生成函數(shù)cexpseq,即Functionx,n=cexpseq(sigema,w,ns,nf)n=ns:nf

5、;x=exp(sigema+j*w)*n);九、正(余)弦序列 直接實(shí)現(xiàn):n=ns:nf;x=cos(w*n+sita);函數(shù)實(shí)現(xiàn):利用正(余)弦序列x(n)=cos(wn+)的生成函數(shù)cosswq,即Functionx,n=cosseq(w,ns,nf,sita)n=ns:nf;x=cos(w*n+sita);輸入?yún)?shù):cosseq(3.14,0,9,30)連續(xù)信號(hào)輸入?yún)?shù):cosseq(3.14,0,9,30)離散信號(hào)實(shí)驗(yàn)三 信號(hào)的運(yùn)算【實(shí)驗(yàn)?zāi)康摹苛私庑盘?hào)處理的基本操作。熟悉一些常用的序列及其應(yīng)用。掌握編寫MATLAB函數(shù)進(jìn)行一些常用運(yùn)算?!緦?shí)驗(yàn)內(nèi)容】一、 信號(hào)的相加與相乘 MATLAB源

6、程序?yàn)椋?n1=5:4; %序列x1(n)的時(shí)間起始及終止位置n1s=-5;n1f=4;x1=2,3,1,-1,3,4,2,1,-5,-3; %序列x1(n)不同時(shí)間的幅度n2=0:9; %序列x2(n)的時(shí)間起始及終止位置n2s=0;n2f=9;x2=1,1,1,1,1,1,1,1,1,1; %序列x2(n)不同時(shí)間的幅度ns=min(n1s,n2s);nf=max(n1f,n2f); %求取新信號(hào)的時(shí)間起始及終止位置n=ns:nf; y1=zeros(1,length(n); %延拓序列初始化y2=zeros(1,length(n); y1(find(n=n1s)&(n=n2s)&(n=0

7、)&(nM); %形成矩形序列x=x1.*x2; %截取操作形成新序列x(n)xm=zeros(1,N);for k=m+1:m+M xm(k)=x(k-m); %產(chǎn)生序列移位x(n-3)endxc=x(mod(n,M)+1); %產(chǎn)生x(n)的周期延拓xcm=x(mod(n-m,M)+1); %產(chǎn)生移位序列x(n-3)的周期延拓subplot(4,1,1),stem(n,x,.);ylabel(x(n);subplot(4,1,2),stem(n,xm,.);ylabel(x(n-3);subplot(4,1,3),stem(n,xc,.);ylabel(x(n)_8);subplot(4,

8、1,4),stem(n,xcm,.);ylabel(x(n-3)_8);三、 序列反轉(zhuǎn)與序列累加運(yùn)算 序列反轉(zhuǎn)的數(shù)學(xué)描述為:y(n)=x(-n)。序列反轉(zhuǎn)的METLAB可由函數(shù)fliplr來實(shí)現(xiàn)。該函數(shù)的功能將行向量左右翻轉(zhuǎn),其調(diào)用格式:y=fliplr(x)。序列累加的數(shù)學(xué)描述為:y(n)=。序列累加的MATLAB實(shí)現(xiàn)可由函數(shù)cumsum來實(shí)現(xiàn),調(diào)用格式為:y=cumsum(x)。例、求序列x(n)=3的反轉(zhuǎn)序列y(n)=x(-n),MATLAB源程序?yàn)椋簄=0:10; %x(n)序列的時(shí)間序列x=3*exp(-0.2*n); %x(n)序列大小y=fliplr(x); %x(n)序列反轉(zhuǎn)n

9、1=-fliplr(n); %時(shí)間序列的反轉(zhuǎn)(反轉(zhuǎn)點(diǎn)為原點(diǎn))n2=fliplr(-(n-3); %在指定位置m=3處的時(shí)間序列的反轉(zhuǎn)subplot(2,1,1);stem(n,x); %繪制x(n)序列xlabel(n),ylabel(x(n);subplot(2,1,2);stem(n1,y); %繪制反轉(zhuǎn)y(n)=x(-n)序列xlabel(n),ylabel(y(n)=x(-n);s=cumsum(x); %求累加序列s(n)figure(2);subplot(2,1,1);stem(n2,y); %繪制點(diǎn)為3處的反轉(zhuǎn)序列y(n)=x(-n+3)xlabel(n),ylabel(y(n)

10、=x(-n+3);subplot(2,1,2);stem(n,s); %繪制s(n)序列xlabel(n),ylabel(s(n);四、 兩序列的卷積運(yùn)算 兩序列的卷積運(yùn)算的數(shù)學(xué)描述為:y(n)=(n)*(n)=兩序列的卷積運(yùn)算的MATLAB實(shí)現(xiàn):y=conv(x1,x2)。序列x1(n)和x2(n)必須長(zhǎng)度有限。例、計(jì)算下列卷積,并圖示各序列及卷積結(jié)果。;MATLAB源程序如下:Nx=20;Nh=10;m=5; %設(shè)定Nx,Nh和位移值mn=0:Nx-1;x1=(0.9).n; %產(chǎn)生x1(n)x2=zeros(1,Nx+m);for k=m+1:m+Nx %產(chǎn)生x2(n)=x1(n-m)

11、x2(k)=x1(k-m) %完成位移endnh=0:Nh-1;h1=ones(1,Nh); %產(chǎn)生h1(n)h2=h1;y1=conv(x1,h1); %計(jì)算y1(n)=x1(n)*h1(n) y2=conv(x2,h2); %計(jì)算y2(n)=x2(n)*h2(n)x2 = Columns 1 through 14 0 0 0 0 0 1 0 0 0 0 0 0 0 0 Columns 15 through 25 0 0 0 0 0 0 0 0 0 0 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0 Columns 9 through

12、16 0 0 0 0 0 0 0 0 Columns 17 through 24 0 0 0 0 0 0 0 0 Column 25 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Columns 9 through 16 0 0 0 0 0 0 0 0 Columns 17 through 24 0 0 0 0 0 0 0 0 Column 25 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Columns 9 through 16 0.7290 0 0 0

13、0 0 0 0 Columns 17 through 24 0 0 0 0 0 0 0 0 Column 25 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Columns 9 through 16 0.7290 0.6561 0 0 0 0 0 0 Columns 17 through 24 0 0 0 0 0 0 0 0 Column 25 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Columns 9 through 16 0.7290 0.6561

14、0.5905 0 0 0 0 0 Columns 17 through 24 0 0 0 0 0 0 0 0 Column 25 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Columns 9 through 16 0.7290 0.6561 0.5905 0.5314 0 0 0 0 Columns 17 through 24 0 0 0 0 0 0 0 0 Column 25 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Columns 9 throug

15、h 16 0.7290 0.6561 0.5905 0.5314 0.4783 0 0 0 Columns 17 through 24 0 0 0 0 0 0 0 0 Column 25 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Columns 9 through 16 0.7290 0.6561 0.5905 0.5314 0.4783 0.4305 0 0 Columns 17 through 24 0 0 0 0 0 0 0 0 Column 25 0x2 = Columns 1 through 8 0 0 0 0

16、0 1.0000 0.9000 0.8100 Columns 9 through 16 0.7290 0.6561 0.5905 0.5314 0.4783 0.4305 0.3874 0 Columns 17 through 24 0 0 0 0 0 0 0 0 Column 25 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Columns 9 through 16 0.7290 0.6561 0.5905 0.5314 0.4783 0.4305 0.3874 0.3487 Columns 17 through 24 0

17、 0 0 0 0 0 0 0 Column 25 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Columns 9 through 16 0.7290 0.6561 0.5905 0.5314 0.4783 0.4305 0.3874 0.3487 Columns 17 through 24 0.3138 0 0 0 0 0 0 0 Column 25 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Columns 9 through 16 0.7290 0.6

18、561 0.5905 0.5314 0.4783 0.4305 0.3874 0.3487 Columns 17 through 24 0.3138 0.2824 0 0 0 0 0 0 Column 25 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Columns 9 through 16 0.7290 0.6561 0.5905 0.5314 0.4783 0.4305 0.3874 0.3487 Columns 17 through 24 0.3138 0.2824 0.2542 0 0 0 0 0 Column 25

19、 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Columns 9 through 16 0.7290 0.6561 0.5905 0.5314 0.4783 0.4305 0.3874 0.3487 Columns 17 through 24 0.3138 0.2824 0.2542 0.2288 0 0 0 0 Column 25 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Columns 9 through 16 0.7290 0.6561 0.590

20、5 0.5314 0.4783 0.4305 0.3874 0.3487 Columns 17 through 24 0.3138 0.2824 0.2542 0.2288 0.2059 0 0 0 Column 25 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Columns 9 through 16 0.7290 0.6561 0.5905 0.5314 0.4783 0.4305 0.3874 0.3487 Columns 17 through 24 0.3138 0.2824 0.2542 0.2288 0.2059

21、 0.1853 0 0 Column 25 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Columns 9 through 16 0.7290 0.6561 0.5905 0.5314 0.4783 0.4305 0.3874 0.3487 Columns 17 through 24 0.3138 0.2824 0.2542 0.2288 0.2059 0.1853 0.1668 0 Column 25 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Colu

22、mns 9 through 16 0.7290 0.6561 0.5905 0.5314 0.4783 0.4305 0.3874 0.3487 Columns 17 through 24 0.3138 0.2824 0.2542 0.2288 0.2059 0.1853 0.1668 0.1501 Column 25 0x2 = Columns 1 through 8 0 0 0 0 0 1.0000 0.9000 0.8100 Columns 9 through 16 0.7290 0.6561 0.5905 0.5314 0.4783 0.4305 0.3874 0.3487 Colum

23、ns 17 through 24 0.3138 0.2824 0.2542 0.2288 0.2059 0.1853 0.1668 0.1501 Column 25 0.1351實(shí)驗(yàn)四 連續(xù)系統(tǒng)的時(shí)域分析【實(shí)驗(yàn)?zāi)康摹窟M(jìn)一步熟悉系統(tǒng)在MATLAB中的表示掌握利用卷積求系統(tǒng)的響應(yīng)【實(shí)驗(yàn)內(nèi)容】一、 連續(xù)LTI系統(tǒng)的響應(yīng)在連續(xù)時(shí)間情況下,系統(tǒng)對(duì)任意輸入信號(hào)x(t)的響應(yīng)(即系統(tǒng)的輸出)為y(t)=Tx(t),則y(t)為系統(tǒng)輸入與系統(tǒng)單位沖激響應(yīng)的卷積積分,即y(t)= Tx(t)=x(t)*h(t)=例:某LTI系統(tǒng)的單位沖激響應(yīng),輸入x(t)=,初始條件為零,求系統(tǒng)的響應(yīng)y(t)。MATLAB源程

24、序如下:dt=input(輸入離散時(shí)間間隔dt); %輸入離散時(shí)間間隔dt=0.5x=ones(1,fix(10/dt); %輸入信號(hào)x(t)h=exp(-0.1*0:fix(10/dt)*dt); %系統(tǒng)的單位沖激響應(yīng)h(t),取持續(xù)時(shí)間與x(t)相同y=conv(x,h); %調(diào)用卷積函數(shù)convt=dt*(1:length(y)-1); %求卷積后輸入y的時(shí)間范圍plot(t,y),grid二、 離散LTI系統(tǒng)的響應(yīng)在離散時(shí)間情況下,系統(tǒng)對(duì)任意輸入信號(hào)xn的響應(yīng)(即系統(tǒng)的輸出)為yn=T xn,則yn為系統(tǒng)輸入與系統(tǒng)單位沖激響應(yīng)的卷積和,即 例:已知LTI離散系統(tǒng)的單位沖激響應(yīng)為:,求輸

25、入信號(hào)序列的系統(tǒng)響應(yīng)。MATLAB的源程序如下:x=ones(1,10); %信號(hào)序列xnn=0 :14;h=0.5.n; %系統(tǒng)的單位沖激響應(yīng)hny=conv(x,h); %調(diào)用卷積函數(shù)convstem(y);xlabel(n);ylabel(yn); 三、運(yùn)用MATLAB提供的專用時(shí)域響應(yīng)函數(shù)求解系統(tǒng)的時(shí)域響應(yīng)。 1、對(duì)任意輸入的連續(xù)LTI系統(tǒng)的響應(yīng)函數(shù)lsim 格式:y,x=lsim(num,den,u,t) 功能:給出傳遞函數(shù)h(s)=num(s)/den(s)形式下的系統(tǒng)輸出響應(yīng)。 說明:當(dāng)lsim函數(shù)不帶輸出變量時(shí),可在當(dāng)前圖形窗口中直接給出系統(tǒng)的輸出響應(yīng)曲線:當(dāng)帶輸出變量調(diào)用函數(shù)

26、時(shí),可得到系統(tǒng)輸出響應(yīng)曲線的數(shù)據(jù),而不直接繪制出曲線。 例:有二階系統(tǒng):,求當(dāng)輸入是周期為4s的方波時(shí)的輸出響應(yīng)。 MATLAB源程序如下: num=2,5,1;den=1,2,3; %系統(tǒng)傳遞函數(shù)t=0:0.1:10;peiod=4; %設(shè)置時(shí)間和周期u=exp(-t); %生成方波lsim(num,den,u,t); %系統(tǒng)時(shí)域響應(yīng)title(方波響應(yīng)) 2、對(duì)任意輸入的離散LTI系統(tǒng)的響應(yīng)函數(shù)dlsim 格式:y,x=dlsim(num,den,u) 功能:給出傳遞函數(shù)h(z)=num(z)/den(z)形式下的系統(tǒng)輸出響應(yīng)。 說明:當(dāng)dlsim函數(shù)不帶輸出變量時(shí),可在當(dāng)前圖形窗口中直接

27、給出系統(tǒng)的輸出響應(yīng)曲線,當(dāng)帶輸出變量調(diào)用函數(shù)時(shí),可得到系統(tǒng)輸出響應(yīng)曲線的數(shù)據(jù),而不直接繪制出曲線。 例:有二階系統(tǒng):,求系統(tǒng)對(duì)100點(diǎn)隨機(jī)噪聲的響應(yīng)曲線。 MATLAB源程序如下: num=2,-3.4,1.5;den=1,-1.2,0.8; %系統(tǒng)傳遞函數(shù)u=randn(1,100); %產(chǎn)生隨機(jī)信號(hào)dlsim(num,den,u);title(隨機(jī)噪聲響應(yīng))實(shí)驗(yàn)五 信號(hào)的譜分析【實(shí)驗(yàn)?zāi)康摹?熟悉信號(hào)的頻譜曲線繪制的方法 離散時(shí)間系統(tǒng)的頻譜分析及繪圖 了解信號(hào)頻譜的數(shù)值計(jì)算【實(shí)驗(yàn)內(nèi)容】一、 周期信號(hào)的傅里葉級(jí)數(shù)MATLAB的源程序如下:f0=2*pi;for i=1:2:50 W(i)=(i

28、-1)*f0; W(i+1)=i*f0; A(i)=0; A(i+1)=4/i*pi; fi(i)=0; fi(i+1)=-pi/2; c(i)=0; c(i+1)=-2*1j/i*pi;endsubplot(1,2,1);stem(W,A);xlabel(W);ylabel(An);title(單邊幅度頻譜);gridsubplot(1,2,2);stem(W,fi);xlabel(W);ylabel(fn);title(單邊相位頻譜);grid;pausesubplot(1,2,1);stem(W,abs(c);xlabel(W);ylabel(fn);title(雙邊幅度頻譜);grid

29、subplot(1,2,2);stem(W,angle(c);xlabel(W);ylabel(fn);title(雙邊相位頻譜);grid二、 傅里葉變換 for i=1:200 w(i)=(i-1)/10; if w(i)=0 G(i)=1; else G(i)=sin(w(i)/2)/(w(i)/2)*exp(-0.5j*w(i); endendplot(w,abs(G);xlabel(w);ylabel(G);title(幅度頻譜);pauseplot(w,angle(G);xlabel(w);ylabel(f);title(相位頻譜);三、傅里葉變換syms w t;ut=Heaviside(t);disp(正變換);ft=fourier(ut,w)disp(反變換)ift=ifourier(ft,t)結(jié)果為:正變換 ft =pi*dirac(w)-i/w 反變換 ift =heaviside(t)四、拉普拉斯變換syms w t;ut=Heaviside(t);di

溫馨提示

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

評(píng)論

0/150

提交評(píng)論