信號與系統(tǒng)MATLAB仿真_第1頁
信號與系統(tǒng)MATLAB仿真_第2頁
信號與系統(tǒng)MATLAB仿真_第3頁
信號與系統(tǒng)MATLAB仿真_第4頁
信號與系統(tǒng)MATLAB仿真_第5頁
已閱讀5頁,還剩84頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

《信號與系統(tǒng)的MATLAB仿真》東南大學(xué)成賢學(xué)院

2011級范夢恒2012.7.1[4-1]單位沖激信號的產(chǎn)生2t=-5:0.01:5;y=(t==0);subplot(121);plot(t,y,"r");n=-5:5;x=(n==0);subplot(122);stem(n,x);3[4-2]比較不同的實(shí)指數(shù)信號4clear;n=0:1:10;a1=0.5;a2=-0.5;a3=1.2;a4=-1.2;x1=a1.^n;x2=a2.^n;x3=a3.^n;x4=a4.^n;subplot(2,2,1),stem(n,x1);title(‘實(shí)指數(shù)序列(0<a1<1)");xlabel("n");ylabel("x1(n)");subplot(2,2,2),stem(n,x2);title("實(shí)指數(shù)序列(-1<a2<0)");line([0,10],[0,0]);xlabel("n");ylabel("x2(n)");subplot(2,2,3),stem(n,x3);title("實(shí)指數(shù)序列(1<a3)");xlabel("n");ylabel("x3(n)");subplot(2,2,4),stem(n,x4);line([0,10],[0,0]);title("實(shí)指數(shù)序列(a4<-1)");xlabel("n");ylabel("x4(n)");5[4-3]生成負(fù)指數(shù)信號6clear;n=1:10;delta=-0.2;w0=0.7;x=exp((delta+j*w0)*n);subplot(211),stem(n,real(x));line([0,10],[0,0]);title(‘負(fù)指數(shù)序列");ylabel(‘負(fù)指數(shù)序列實(shí)部");subplot(212),stem(n,imag(x));line([0,10],[0,0]);ylabel(‘負(fù)指數(shù)序列虛部");xlabel("n");7[4-4]生成正弦信號8clear;n=0:10;w0=pi/5;w1=pi/4;x=sin(w0*n+w1);stem(n,x);title(‘正弦型序列");line([0,10],[0,0]);xlabel("n");ylabel("x(n)");9[4-5]產(chǎn)生周期為0.2的三角波,

width取值分別為0,1,0.5。10td=1/100000;t=0:td:1;x1=sawtooth(2*pi*5*t,0);x2=sawtooth(2*pi*5*t,1);x3=sawtooth(2*pi*5*t,0.5);subplot(311);plot(t,x1);subplot(312);plot(t,x2);subplot(313);plot(t,x3);11[4-6]仔細(xì)觀察由下面代碼產(chǎn)生的3個三角波信號之間的區(qū)別12t=-3:0.001:3;x1=tripuls(t,4,0);subplot(131);plot(t,x1);axis([-4

4

0

1]);gridt=-6:0.001:6;x2=tripuls(t,4,0.5);subplot(132);plot(t,x2);axis([-4

4

0

1]);gridx3=tripuls(t+2,4,0.5);subplot(133);plot(t,x3);axis([-4

4

0

1]);grid13[4-7]產(chǎn)生頻率為40HZ,占空比分別為25%,50%,75%的周期

性方波14clear;td=1/100000;t=0:td:1;x1=square(2*pi*40*t,25);x2=square(2*pi*40*t,50);x3=square(2*pi*40*t,75);subplot(311);plot(t,x1);title(‘占空比25%");axis([0

0.2-1.5

1.5]);subplot(312);plot(t,x2);title("占空比50%");axis([0

0.2-1.5

1.5]);subplot(313);plot(t,x3);title(‘占空比75%");axis([0

0.2-1.5

1.5]);15[4-8]生成幅度為2,寬度T=4,中心在t=0的矩形波x(t)以及x(t-T/2).16t=-4:0.0001:4;T=4;x1=2*rectpuls(t,T);subplot(121);plot(t,x1);title("x(t)");axis([-4

6

0

2.2]);x2=2*rectpuls(t-T/2,T);subplot(122);plot(t,x2);title("t-T/2");axis([-4

6

0

2.2]);17[4-9]生成抽樣信號Sa(at)(a=2π

)18clear;t=-1:0.001:1;y=sinc(2*pi*t);plot(t,y);xlabel(‘時間t");ylabel(‘幅值(y)");title(‘信號抽樣");19[4-10]已知兩個序列:

[0.5,1.5,1,-0.5]與[2,2,2,2,2,2分別計(jì)算兩個序列的和與乘積20clear;x=[0.5,1.5,1,-0.5];n0=-1:2;x1=2*ones(1,6);n1=0:5;[y1,n2]=sigmult(x1,n1,x,n0);[y2,n3]=sigadd(x1,n1,x,n0);subplot(411);

stem(n0,x);ylabel("x");axis([-1

6

-2

3]);subplot(412);stem(n1,x1);ylabel("x1");axis([-1

6

-2

3]);subplot(413);stem(n2,y1);ylabel("y1=x*x1");axis([-1

6

-2

3]);subplot(414);stem(n3,y2);ylabel("y2=x+x1");axis([-1

6

0

5]);21,[4-11]已知指數(shù)序列分別繪出

, 的波形圖22k=0:5;f=(0.5).^k;[f1,k1]=sigshift(f,k,2);subplot(211);stem(k,f,"fill");xlabel("k");title("f(k)");axis([0

8

0

1]);subplot(212);stem(k1,f1,"fill");xlabel("k");title("f(k-2)");axis([0

8

0

1]);23[4-12]比較序列位移與循環(huán)位移的不同24N=24;M=8;m=3;n=0:N-1;25■x1=(0.8).^n;x2=[(n>=0)&(n<=M)];x=x1.*x2;xm=zeros(1,N);for

k=m+1:m+Mxm(k)=x(k-m);endxc=x(mod(n,M)+1);xcm=x(mod(n-m,M)+1);subplot(411);stem(n,x);xlabel("x(n)");subplot(412);stem(n,xm);xlabel("x(n-3)");subplot(413);stem(n,xc);xlabel("x((n))_8");subplot(414);stem(n,xcm);xlabel("x((n-3))_8");[4-13]將信號翻褶26clear;t=0:0.02:1;x=3*t;f=fliplr(x);t1=-1:0.02:0;grid

onplot(t,x,t1,f,"r");title(‘信號的翻褶");27Nx=20;Nh=10;n=0:Nx-1;x=(0.9).^n;nh=0:Nh-1;h=(nh==3);ny=0:28;y=conv(x,h);subplot(311);stem(n,x);xlabel("n");ylabel("x(n)");subplot(312);stem(nh,h);xlabel("n");ylabel("h(n)");subplot(313);stem(ny,y);xlabel("n");ylabel("y(n)");29[4-15]已知,編制一個M文件,繪出的波形圖30clear;Nx=20;Nh=10;n=0:Nx-1;x=(0.9).^n;nh=0:Nh-1;h=ones(1,Nh);ny=-19:19;y=xcorr(x,h);subplot(311);stem(n,x);xlabel("n");ylabel("x(n)");subplot(312);stem(nh,h);xlabel("n");ylabel("h(n)");subplot(313);stem(ny,y);xlabel("n");ylabel("y(n)");33[4-17]試求余弦信號的平均功率34dt=0.001;t=0:dt:2*pi;x=cos(t);p=sum(abs(x).^2*dt)./(2*pi);35[4-18]求離散時間系統(tǒng)的零、極點(diǎn)向量和增益系數(shù)36num=[2,3];den=[1,0.4,1];[num,den]=eqtflength(num,den);[z,p,k]=tf2zp(num,den);37[4-19]程:已知二階系統(tǒng)微分方,求系統(tǒng)的單位沖激響應(yīng)38a=[1,5,6];b=[3,2];impulse(b,a);39[4-20]已知二階系統(tǒng):,;

,求系統(tǒng)的單位階躍響應(yīng)、零輸入響應(yīng)及全響應(yīng)40clear;b=[1];a=[1

0

1];[A

B

C

D]=tf2ss(b,a);sys=ss(A,B,C,D);t=0:0.1:30;f=cos(t);zi=[-1;0];y1=step(sys,t);y2=initial(sys,zi,t);y3=lsim(sys,f,t);y4=lsim(sys,f,t,zi);subplot(141);plot(t,y1);xlabel(‘時間

t’);title(‘系統(tǒng)的單位躍遷響應(yīng)");line([0,30],[0,0]);subplot(142);plot(t,y2);xlabel(‘時間

t’);title(‘系統(tǒng)的零輸入響應(yīng)");line([0,30],[0,0]);subplot(143);plot(t,y3);xlabel(’時間

t‘);title(’系統(tǒng)的零狀態(tài)響應(yīng)");line([0,30],[0,0]);subplot(144);plot(t,y4);xlabel(‘時間

t’);title(‘系統(tǒng)的全響應(yīng)");line([0,30],[0,0]);41[4-21]已知差分方程y(n)-y(n-1)+0.8y(n-2)=f(n)當(dāng)當(dāng)時,求零狀態(tài)響應(yīng)y(n)。時,求單位響應(yīng)h(n)。42b=[1];a=[1

-1

0.8];n=0:15;fn=0.5.^n;y1=filter(b,a,fn);y2=impz(b,a,16);

subplot(121),stem(n,y1,"filled");title(零狀態(tài)響應(yīng)");grid

on;

subplot(122),stem(n,y2,‘filled’);title(‘單位響應(yīng)");grid

on;43[4-22]設(shè)系統(tǒng)差分方程為y(n)-0.8y(n-1)=x(n),求該系統(tǒng)對信號的響應(yīng)44B=[1];A=[1

-0.8];n=0:31;x=0.8.^n;y=filter(B,A,x);subplot(121),stem(x);subplot(122),stem(y);45[4-23]

求單邊指數(shù)函數(shù) 的傅里葉變換,畫出其幅頻特性和相頻特征圖46syms

t

w

ff=exp(-2*t)*sym("Heaviside(t)");F=fourier(f);subplot(311),ezplot(f,[0:2,0:1.2]);subplot(312),ezplot(abs(F),[-10:10]);

subplot(313),ezplot(angle(F),[-10:10]);47[4-24]求的傅里葉逆變換f(t).48syms

t

wF=1/(1+w^2);f=ifourier(F,w,t);ezplot(f);line([0,0],[-1,1]);49[4-25]已知非周期連續(xù)信號50T=0.01;

dw=0.1;t=-10:T:10;w=-4*pi:dw:4*pi;x=rectpuls(t-0.5-T,1);X=x*exp(-j*t"*w)*T;X1=abs(X);phai=angle(X);plot(w,X1);51[4-26]給定一個周期為T1=2s的連續(xù)時間周期方波信號,其一個周期內(nèi)的數(shù)學(xué)表達(dá)式為52clc;dt=0.001;T=2;t=-4:dt:4;

w0=2*pi/T;x1=rectpuls(t-0.5-T,1);x=0;for

m=-1:1x=x+rectpuls((t-0.5-m*T-dt),1);endsubplot(211),plot(t,x);%line([0,0],[-0.1,1.1]);axis([-4

4

0

1.1]);title("x(t)");xlabel("Time

index

t");N=10;%L=2*N+1;for

k=-N:N;ak(N+1+k)=x1*exp(-j*k*w0*t")*dt/T;endk=-N:N;subplot(212),stem(k,abs(ak),"k.");title("The

Fourierseries

coefficients");xlabel("Frequency

index

k");53的離散時間傅里,設(shè)√[4-27]求矩陣序列葉變換原理:

N=754N=7;n=0:N-1;x=[ones(1,N)];k=0:199;w=(pi/100)*k;X=x*(exp(-j*pi/100).^(n"*k));MagX=abs(X);angX=angle(X);subplot(311);stem(n,x);subplot(312);plot(w/pi,MagX);subplot(313);plot(w/pi,angX/pi);55[4-28]當(dāng),時,確定并畫出x(n)的離散傅里葉變換。56N=10;n=0:N-1;x=2*cos(0.35*pi*n)+cos(0.5*pi*n);y=dft(x,N);k=0:N-1;w=2*pi/N*k;

subplot(211);stem(n,x);title(‘離散信號時間");

subplot(212);stem(w/pi,abs(y));title(‘信號的頻譜");57[4-29]用快速傅里葉變換FFT計(jì)算下面兩個序列的卷積58%線性卷積xn=sin(0.4*[1:15]);hn=0.9.^(1:20);yn=conv(xn,hn);%圓周卷積L=pow2(nextpow2(M+N-1));Xk=fft(xn,L);Hk=fft(hn,L);Yk=Xk.*Hk;yn=ifft(Yk,L);59[4-30]求以下函數(shù)的拉普拉斯變換。(1)

(2)60syms

tf1=sym("exp(-2*t)*Heaviside(t)");F1=laplace(f1);f2=sym("t*exp(-t)*Heaviside(t)");F2=laplace(f2);61,[4-31]若系統(tǒng)的系統(tǒng)函數(shù)為

Re[s]>-1。求沖激響應(yīng)h(t)。62H=sym("1/(s^2+3*s+2)");h=ilaplace(H);63[4-32]已知一個因果系統(tǒng)的函數(shù)為 。畫出H(s)的零極點(diǎn)分布圖,并判斷系統(tǒng)的穩(wěn)定性64。[4-33]已知一個因果系統(tǒng)的函數(shù)為試分析其頻率特性66a=[1

2

3

2

1];b=[1

0

-4];p=roots(a);pxm=max(real(p));if

pxm>=0‘系統(tǒng)不穩(wěn)定"elsefreqs(b,a)end67[4-34]求Z變換。68syms

n

z

OMEGAfn=cos(n*OMEGA);fz=ztrans(fn,n,z);69,計(jì)算[4-35]求反變換到n=40,畫出f(n)曲線70b=[0

1

0.6];a=[1

-1.2

0.4];[fn

n]=impz(b,a,40);stem(n,fn,"filled");71[4-36]已知一個離散系統(tǒng)的系統(tǒng)函數(shù) ,試?yán)L制其零極點(diǎn)圖72a=[1

3

2];b=[1

-0.7

0.1];zplane(b,a)73[4-37]設(shè),①畫出零極點(diǎn)圖。試求:②求系統(tǒng)響應(yīng)h(n);③求系統(tǒng)的幅頻特性和相頻特性。74b=[0

1

2

1];a=[1

-0.5

-0.005

0.3];subplot(221);zplane(b,a);title(‘系統(tǒng)的零極點(diǎn)圖");[hn

n]=impz(b,a,16);subplot(222);stem(n,hn,"filled");title(‘單位響應(yīng)h(n)");grid

on;axis

tight;[h

w]=freqz(b,a,16);subplot(223);plot(w,abs(h));title(‘幅頻特性曲線");grid

on;subplot(224);plot(w,angle(h));title(‘相頻特性曲線");grid

on;75號[4-38]對給定的一個連續(xù)時間信,對它分別左移2s和右移兩秒2s得到信號和

。76t=-5:0.01:5;x=exp(-0.5*t).*u(t);x=exp(-0.5*(t+2)).*u(t+2);x=exp(-0.5*(t-2)).*u(t-2);subplot(311);plot(t,x);grid

on;title("Originalsignal

x(t)");subplot(312);plot(t,x1);grid

on;title("Leftshifted

version

of

x(t)");subplot(313);plot(t,x2);grid

on;title("Rightshifted

version

of

x(t)");xlabel("Time

t

(sec)");77[4-39]設(shè)

,

,試用MATLAB畫出f(t)、f(t1)的時域波形及其頻譜,并觀察傅里葉變換的頻移特性78R=0.005;t=-2:R:2;f=(t+1>=0)-(t-1>=0);f1=f.*cos(10*pi*t);subplot(221);plot(t,f);xlabel("t");ylabel("f(t)");subplot(222);plot(t,f1);xlabel("t");ylabel("f1=f(t)*cos(10*pi*t);");W1=40;N=1000;k=-N:N;W=k*W1/N;F=f*exp(-j*t"*W)*R;F=real(F);F1=f1*exp(-j*t"*W)*R;F1=real(F1);subplot(223);plot(W,F);xlabel("w");ylabel("F(jw)");subplot(224);plot(W,F1);xlabel("w");ylabel("F1(jw)");79[4-40]已知序列

,試求:時,確定并畫出x(n)的離散傅里葉變時,確定并畫出x(n)的離散傅里時,確定并畫出x(n)的離散傅里葉變

當(dāng)換當(dāng)葉變換

當(dāng)換8081N1=10;N2=40;n1=0:N1-1;n2=0:N2-1;x=2*cos(0.35*pi*n2)+cos(0.5*pi*n2);x1=x(1:N1);Y1=dft(x1,N1);magY1=abs(Y1);k1=0:N1-1;w1=2*pi/N1*k1;x2=[x1

zeros(1,N2-N1)];Y2=dft(x2,N2);magY2=abs(Y2);k2=0:N2-1;w2=2*pi/N2*k2;Y3=dft(x,N2);magY3=abs(Y3);k3=0:N2-1;w3=2*pi/N2*k2;subplot(231);stem(n1,x1);title("沒有足夠點(diǎn)的采樣信號");subplot(234);stem(w1/pi,magY1);title("信號的頻譜");subplot(232);stem(n2,x2);title("添零信號");subplot(235);stem(w2/pi,magY2);title("高密度頻譜");subplot(233);stem(n2,x);title("有足夠點(diǎn)的采樣信號");subplot(236);stem(w3/pi,magY3);title("高分辨率頻譜");82[4-41]一個被噪聲污染的信號很難看出它所包含的頻率分量,如一個由50HZ和120HZ正弦信號構(gòu)成的信號,受到均值隨機(jī)噪聲的干擾,數(shù)據(jù)采樣率為1000HZ,試通過FFT來分析其信號頻率成分8384t=0:0.001:0.6;x=sin(2*pi*50*t)+sin(2*pi*120*t);y=x+randn(1,length(t));Y=fft(y,512);

subplot(311);plot(x);title(‘原噪聲信號");

subplot(312);plot(y);title(‘受噪聲污染的信號");n=0:511;f=1000*n/512;subplot(313);plot(f,abs(Y));title("FFT");85,[4-42]已知系統(tǒng)函數(shù)為試求:①

畫出零極點(diǎn)圖;86②

系統(tǒng)響應(yīng)h(t);num=[1];den=[1,2,2,1];sys=tf(num,den);p=roots(den);subplot(221);pzmap(sys);t=0:0.01:10;h=impulse(num,den,t);subplot(222);plot(t,h);xlabel("t");ylabel("h(t)");title(‘系統(tǒng)的沖激響應(yīng)");[H,w]=freqs(num,den);subplot(223);plot(w,abs(H));xlabel("\omega");ylabel("abs(H(j\Omega))");title(‘系統(tǒng)的幅頻響應(yīng)");subplot(224

溫馨提示

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

評論

0/150

提交評論