[信息与通信]数字信号实验代码.doc

上传人:音乐台 文档编号:1969378 上传时间:2019-01-27 格式:DOC 页数:33 大小:105KB
返回 下载 相关 举报
[信息与通信]数字信号实验代码.doc_第1页
第1页 / 共33页
[信息与通信]数字信号实验代码.doc_第2页
第2页 / 共33页
[信息与通信]数字信号实验代码.doc_第3页
第3页 / 共33页
亲,该文档总共33页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《[信息与通信]数字信号实验代码.doc》由会员分享,可在线阅读,更多相关《[信息与通信]数字信号实验代码.doc(33页珍藏版)》请在三一文库上搜索。

1、%时域采样与频域采样实验figure(1)A=444.18;a=50*pi*sqrt(2);omega=50*pi*sqrt(2);%模拟信号Tp=64/1000;Fs=1000;%抽样频率n=0:Tp*Fs-1;y=A*exp(-a*n*1/Fs).*sin(omega*n*1/Fs);subplot(2,2,1);stem(n,y,.);xlabel(抽样频率为1000HZ时信号Y的抽样图形);y1=fft(y,64);%频域抽样用fft计算DFT。subplot(2,2,2);n=0:length(y1)-1;stem(n,y1,.);xlabel(抽样频率为1000HZ时信号y的64点

2、得FFT);subplot(2,2,3);n1=0:length(angle(y)-1;plot(n1,angle(y);xlabel(抽样频率为1000HZ时信号Y的相频特性图);figure(2)A=444.18;a=50*pi*sqrt(2);omega=50*pi*sqrt(2);%模拟信号Tp=64/1000;Fs=300;%抽样频率n=0:Tp*Fs-1;y=A*exp(-a*n*1/Fs).*sin(omega*n*1/Fs);/两向量相乘用点乘y2=y,zeros(1,46);subplot(2,2,1);n2=0:length(y2)-1;stem(n2,y2,.);xlab

3、el(抽样频率为300HZ时信号Y的抽样图形);y1=fft(y2,64);%频域抽样subplot(2,2,2);n3=0:length(y1)-1;stem(n3,y1,.);xlabel(抽样频率为300HZ时信号y的64点得FFT);subplot(2,2,3);n1=0:length(angle(y2)-1;plot(n1,angle(y2);%相位xlabel(抽样频率为300HZ时信号Y的相频特性图);figure(3)A=444.18;a=50*pi*sqrt(2);omega=50*pi*sqrt(2);Tp=64/1000;抽样的实现Fs=200;%抽样频率n=0:Tp*F

4、s-1;%信号长度y=A*exp(-a*n*1/Fs).*sin(omega*n*1/Fs);/t换成nTy2=y,zeros(1,52);subplot(2,2,1);n2=0:length(y2)-1;stem(n2,y2,.);xlabel(抽样频率为200HZ时信号Y的抽样图形);y1=fft(y2,64);%频域抽样subplot(2,2,2);n3=0:length(y1)-1;stem(n3,y1,.);xlabel(抽样频率为200HZ时信号y的64点得FFT);subplot(2,2,3);n1=0:length(angle(y2)-1;plot(n1,angle(y2);%

5、相位xlabel(抽样频率为200HZ时信号Y的相频特性图);figure(4)n1=0:13;n2=14:26;x1=n1+1;x2=27-n2;x0=x1,x2,zeros(1,5);%信号xnx00=x1,x2;xk=fft(x0,32);%信号xn的32点频域抽样n3=0:length(xk)-1;subplot(2,2,1);stem(n3,abs(xk),.);%信号幅频特性xlabel(信号XN的32点FFT);xk1=fft(x00,16);%16点得频域抽样n4=0:length(xk1)-1;subplot(2,2,2);stem(n4,abs(xk1),.);xlabel

6、(信号XN的16点FFT);n5=0:length(x0)-1;subplot(2,2,3)stem(n5,x0,.);%原始信号xnxlabel(信号X0的波形);figure(5)y5=ifft(xk,32);n5=0:length(xk)-1;subplot(2,2,1);stem(n5,y5,.);xlabel(32点IFFT);y51=ifft(xk1,16);n51=0:length(y51)-1;subplot(2,2,2);stem(n51,y51,.);xlabel(16点IFFT);%实验二figure(6)x1n=ones(1,4);%信号X1Nn1=0:3;n2=4:7

7、;x1=n1+1;x2=8-n2;x2n=x1,x2;%信号X2Nn3=0:3;n4=4:7;x3=4-n;x4=n4-3;x3n=x3,x4;%信号X3N即分段信号的表示方法,用向量表示的。y1n=fft(x1n,8);%信号X1N的8点ffty11n=fft(x1n,16);/离散傅立叶变换求频谱即求信号的频谱。你懂的注意点数要满足的条件,不然就有失真啦就不接近DTFT的波形啦。subplot(2,2,1);n1n=0:length(y1n)-1;/长度要匹配,才能显示出来!这个必须懂。stem(n1n,abs(y1n),.);%幅频图xlabel(信号X1N的8点幅频图);subplot

8、(2,2,2);n11n=0:length(y11n)-1;stem(n11n,abs(y11n),.);xlabel(信号x1n的16点幅频图);y2n=fft(x2n,8);%信号x2n的频域8点抽样subplot(2,2,3);n2n=0:length(y2n)-1;stem(n2n,abs(y2n),.);xlabel(信号x2n的8点幅频图);y2n=fft(x2n,16);%信号x2n的频域16点抽样subplot(2,2,4);n2n=0:length(y2n)-1;stem(n2n,abs(y2n),.);%信号x2n的16点幅频图xlabel(信号x2n的16点幅频图);fi

9、gure(7)y3n=fft(x3n,8);subplot(2,2,1);n3n=0:length(y3n)-1;stem(n3n,abs(y3n),.);%信号x3n的8点幅频图xlabel(信号x3n的8点幅频图);y3n=fft(x3n,16);subplot(2,2,2);n3n=0:length(y3n)-1;stem(n3n,abs(y3n),.);%信号x3n的16点幅频图xlabel(信号x3n的16点幅频图);figure(8)n1=0:7;n2=0:15;y1=cos(1/4*pi*n1);y2=cos(1/4*pi*n2);y11=fft(y1);%信号x4n的8点FFT

10、y22=fft(y2);%信号x4n的16点FFTn11=0:length(y11)-1;n22=0:length(y22)-1;subplot(2,2,1);stem(n11,abs(y11),.);xlabel(信号x4n的8点幅频图);subplot(2,2,2);stem(n22,abs(y22),.);xlabel(信号x4n的16点得幅频图);n3=0:7;n4=0:15;x11=cos(1/4*pi*n3)+cos(1/8*pi*n3);%信号x5n长度为8x22=cos(1/4*pi*n4)+cos(1/8*pi*n4);%信号x5n长度为16y1=fft(x11);y2=ff

11、t(x22);subplot(2,2,3);n33=0:length(y1)-1;n44=0:length(y2)-1;stem(n33,abs(y1),.);xlabel(信号x5n的8点幅频图);subplot(2,2,4);stem(n44,abs(y2),.);xlabel(信号x5n的16点幅频图);figure(9)Fs=64;T=1/Fs;n1=0:15;t=n1*T;x1=cos(8*pi*t)+cos(16*pi*t)+cos(20*pi*t);%模拟信号的16点抽样y1=fft(x1);n11=0:length(y1)-1;subplot(2,2,1);stem(n11,a

12、bs(y1),.);xlabel(抽样信号的16点幅频图);Fs=64;T=1/Fs;n2=0:31;t1=n2*T;x2=cos(8*pi*t1)+cos(16*pi*t1)+cos(20*pi*t1);%模拟信号的32点抽样y2=fft(x2);n22=0:length(y2)-1;subplot(2,2,2);stem(n22,abs(y2),.);xlabel(抽样信号的32点幅频图);Fs=64;T=1/Fs;n3=0:63;t2=n3*T;x3=cos(8*pi*t2)+cos(16*pi*t2)+cos(20*pi*t2);%模拟信号的64点抽样y3=fft(x3,64);n33

13、=0:length(y3)-1;subplot(2,2,3);stem(n33,abs(y3),.);xlabel(抽样信号的64点幅频图);滤波器的设计T=1;Fs=1/T;wp=0.25*pi,0.45*pi;%转换成模拟角频率ws=0.15*pi,0.55*pi;rp=3;rs=40;n,wc=buttord(wp,ws,rp,rs,s);b,a=butter(n,wc,s);bz,az=impinvar(b,a,Fs);%脉冲响应法h,w=freqz(bz,az,whole);/数字系统的频谱求法用freqz(),模拟系统的频谱用freqs();在数字频谱中,whole将显示0到2*p

14、i内的频谱图,没写则是0到pi。实验频谱图可以说明。subplot(2,2,1);plot(w/pi,abs(h);xlabel(w/pi);ylabel(|H(w)|);T=1;Fs=1/T;wpz=0.25,0.45;wsz=0.15,0.55;wp=2*tan(wpz*pi/2);%双线性法中的预畸变ws=2*tan(wsz*pi/2);rp=3;rs=40;n,wc=buttord(wp,ws,rp,rs,s);/间接法,里面的角频率都是模拟量b,a=butter(n,wc,s);bz,az=bilinear(b,a,Fs);%双线性法h,w=freqz(bz,az,whole);su

15、bplot(2,2,2);plot(w/pi,abs(h);xlabel(w/pi);ylabel(|H(w)|);Fs=8000;T=1/Fs;fp=4000;fs=20000;wp=2*pi*fp;ws=2*pi*fs;rp=0.5;rs=45;n,wc=buttord(wp,ws,rp,rs,s);b,a=butter(n,wc,s);bz,az=impinvar(b,a,Fs);/抽样频率不能省h,w=freqz(bz,az,whole);subplot(2,2,3);plot(w/pi,h);subplot(2,2,4);plot(w/pi,20*log10(abs(h);/损耗图%

16、低通figure(1)fcp=275;fcs=350;Fs=10000;T=1/Fs;wp=2*fcp*T;ws=2*fcs*T;/直接将模拟指标转化成数字指标要对pi做归一化!直接设计数字滤波器,这个必须懂rp=0.1;rs=60;n,wpo=ellipord(wp,ws,rp,rs);b,a=ellip(n,rp,rs,wpo);h,w=freqz(b,a);subplot(2,1,1);plot(w/pi,abs(h);xlabel(w/pi);ylabel(|H(w)|);subplot(2,1,2);plot(w/pi,20*log10(abs(h);xlabel(w/pi);yla

17、bel(20*log10(|(h)|);%带通figure(2)fcp=400,600;fcs=350,700;Fs=10000;T=1/Fs;wp=2*fcp*T;ws=2*fcs*T;rp=0.1;rs=60;n,wpo=ellipord(wp,ws,rp,rs);b,a=ellip(n,rp,rs,wpo);h,w=freqz(b,a);subplot(2,1,1);plot(w/pi,abs(h);xlabel(w/pi);ylabel(|H(w)|);subplot(2,1,2);plot(w/pi,20*log10(abs(h);xlabel(w/pi);ylabel(20*log

18、10(|(h)|);%高通figure(3)fcp=850;fcs=750;Fs=10000;T=1/Fs;wp=2*fcp*T;ws=2*fcs*T;rp=0.1;rs=60;n,wpo=ellipord(wp,ws,rp,rs);b,a=ellip(n,rp,rs,wpo,high);h,w=freqz(b,a);subplot(2,1,1);plot(w/pi,abs(h);xlabel(w/pi);ylabel(|H(w)|);subplot(2,1,2);plot(w/pi,20*log10(abs(h);xlabel(w/pi);ylabel(20*log10(|(h)|);fig

19、ure(4)%混合信号N=800;Fs=10000;T=1/Fs;Tp=N*T;t=0:T:(N-1)*T;k=0:N-1;f=k/Tp;fc1=Fs/10;fm1=fc1/10;fc2=Fs/20;fm2=fc2/10;fc3=Fs/40;fm3=fc3/10;xt1=cos(2*pi*fm1*t).*cos(2*pi*fc1*t);xt2=cos(2*pi*fm2*t).*cos(2*pi*fc2*t);xt3=cos(2*pi*fm3*t).*cos(2*pi*fc3*t);st=xt1+xt2+xt3;fxt=fft(st,N);subplot(3,1,1);plot(t,st);gr

20、id;xlabel(t/s);ylabel(s(t);axis(0,Tp/8,min(st),max(st);title(a) s(t);subplot(3,1,2);stem(f,abs(fxt)/max(abs(fxt),.);grid;title(b) s(t)的频谱);axis(0,Fs/5,0,1.2);xlabel(f/Hz);ylabel(幅度);figure(5)%得到低频信号fcp=300;fcs=350;Fs=10000;T=1/Fs;wp=2*fcp*T;ws=2*fcs*T;rp=0.1;rs=60;n,wpo=ellipord(wp,ws,rp,rs);b,a=ell

21、ip(n,rp,rs,wpo);h,w=freqz(b,a);subplot(2,2,1);plot(w/pi,abs(h);xlabel(w/pi);ylabel(|H(w)|);subplot(2,2,2);plot(w/pi,20*log10(abs(h);xlabel(w/pi);ylabel(20*log10(|(h)|);N=800;Fs=10000;T=1/Fs;Tp=N*T;t=0:T:(N-1)*T;k=0:N-1;f=k/Tp;fc1=Fs/10;fm1=fc1/10;fc2=Fs/20;fm2=fc2/10;fc3=Fs/40;fm3=fc3/10;xt1=cos(2*p

22、i*fm1*t).*cos(2*pi*fc1*t);xt2=cos(2*pi*fm2*t).*cos(2*pi*fc2*t);xt3=cos(2*pi*fm3*t).*cos(2*pi*fc3*t);st=xt1+xt2+xt3;y1=filter(b,a,st);/b,a是系统的系数向量,b/a。即是前面求的滤波器的系统系数向量。这个完全懂n1=0:length(y1)-1;subplot(2,2,3);plot(n1,y1);xlabel(中心频率为250Hz的时域图);ylabel(y1(n);figure(6)%得到中间段的频率信号的时域图形fcp=400,600;fcs=350,70

23、0;Fs=10000;T=1/Fs;wp=2*fcp*T;ws=2*fcs*T;rp=0.1;rs=60;n,wpo=ellipord(wp,ws,rp,rs);b,a=ellip(n,rp,rs,wpo);h,w=freqz(b,a);subplot(2,2,1);plot(w/pi,abs(h);xlabel(w/pi);ylabel(|H(w)|);subplot(2,2,2);plot(w/pi,20*log10(abs(h);xlabel(w/pi);ylabel(20*log10(|(h)|);N=800;Fs=10000;T=1/Fs;Tp=N*T;t=0:T:(N-1)*T;k

24、=0:N-1;f=k/Tp;fc1=Fs/10;fm1=fc1/10;fc2=Fs/20;fm2=fc2/10;fc3=Fs/40;fm3=fc3/10;xt1=cos(2*pi*fm1*t).*cos(2*pi*fc1*t);xt2=cos(2*pi*fm2*t).*cos(2*pi*fc2*t);xt3=cos(2*pi*fm3*t).*cos(2*pi*fc3*t);st=xt1+xt2+xt3;y1=filter(b,a,st);n1=0:length(y1)-1;subplot(2,2,3);plot(n1,y1);xlabel(中心频率为500Hz的时域图);ylabel(y2(n

25、);figure(7)%得到以1khz为中心频率的时域图形fcp=850;fcs=750;Fs=10000;T=1/Fs;wp=2*fcp*T;ws=2*fcs*T;rp=0.1;rs=60;n,wpo=ellipord(wp,ws,rp,rs);b,a=ellip(n,rp,rs,wpo,high);h,w=freqz(b,a);subplot(2,2,1);plot(w/pi,abs(h);xlabel(w/pi);ylabel(|H(w)|);subplot(2,2,2);plot(w/pi,20*log10(abs(h);xlabel(w/pi);ylabel(20*log10(|(h

26、)|);N=800;Fs=10000;T=1/Fs;Tp=N*T;t=0:T:(N-1)*T;k=0:N-1;f=k/Tp;fc1=Fs/10;fm1=fc1/10;fc2=Fs/20;fm2=fc2/10;fc3=Fs/40;fm3=fc3/10;xt1=cos(2*pi*fm1*t).*cos(2*pi*fc1*t);xt2=cos(2*pi*fm2*t).*cos(2*pi*fc2*t);xt3=cos(2*pi*fm3*t).*cos(2*pi*fc3*t);st=xt1+xt2+xt3;y1=filter(b,a,st);n1=0:length(y1)-1;subplot(2,2,3

27、);plot(n1,y1);xlabel(中心频率为1KHz的时域图);ylabel(y3(n);figure(10)%思考题N=800;Fs=10000;T=1/Fs;Tp=N*T;t=0:T:(N-1)*T;k=0:N-1;f=k/Tp;fc1=Fs/10;fm1=fc1/10;fc2=Fs/20;fm2=fc2/10;fc3=Fs/40;fm3=fc3/10;xt1=(cos(2*pi*fc1*t)+cos(2*pi*fm1*t).*cos(2*pi*fc1*t);xt2=(cos(2*pi*fc2*t)+cos(2*pi*fm2*t).*cos(2*pi*fc2*t);xt3=(cos

28、(2*pi*fc3*t)+cos(2*pi*fm3*t).*cos(2*pi*fc3*t);st=xt1+xt2+xt3;fxt=fft(st,N);subplot(3,1,1);plot(t,st);grid;xlabel(t/s);ylabel(s(t);axis(0,Tp/8,min(st),max(st);title(a) s(t);subplot(3,1,2);stem(f,abs(fxt)/max(abs(fxt),.);grid;title(b) s(t)的频谱);axis(0,Fs/5,0,1.2);xlabel(f/Hz);ylabel(幅度);figure(11)%低通滤波

29、N=800;Fs=10000;T=1/Fs;Tp=N*T;t=0:T:(N-1)*T;k=0:N-1;f=k/Tp;fc1=Fs/10;fm1=fc1/10;fc2=Fs/20;fm2=fc2/10;fc3=Fs/40;fm3=fc3/10;xt1=(cos(2*pi*fc1*t)+cos(2*pi*fm1*t).*cos(2*pi*fc1*t);xt2=(cos(2*pi*fc2*t)+cos(2*pi*fm2*t).*cos(2*pi*fc2*t);xt3=(cos(2*pi*fc3*t)+cos(2*pi*fm3*t).*cos(2*pi*fc3*t);st=xt1+xt2+xt3;fc

30、p=300;fcs=350;Fs=10000;T=1/Fs;wp=2*fcp*T;ws=2*fcs*T;rp=0.1;rs=60;n,wpo=ellipord(wp,ws,rp,rs);b,a=ellip(n,rp,rs,wpo);h,w=freqz(b,a);subplot(2,2,1);plot(w/pi,abs(h);xlabel(w/pi);ylabel(|H(w)|);subplot(2,2,2);plot(w/pi,20*log10(abs(h);xlabel(w/pi);ylabel(20*log10(|(h)|);y1=filter(b,a,st);n1=0:length(y1

31、)-1;subplot(2,2,3);plot(n1,y1);xlabel(中心频率为Hz的时域图);ylabel(y1(n);figure(12)%带通滤波N=800;Fs=10000;T=1/Fs;Tp=N*T;t=0:T:(N-1)*T;k=0:N-1;f=k/Tp;fc1=Fs/10;fm1=fc1/10;fc2=Fs/20;fm2=fc2/10;fc3=Fs/40;fm3=fc3/10;xt1=(cos(2*pi*fc1*t)+cos(2*pi*fm1*t).*cos(2*pi*fc1*t);xt2=(cos(2*pi*fc2*t)+cos(2*pi*fm2*t).*cos(2*pi

32、*fc2*t);xt3=(cos(2*pi*fc3*t)+cos(2*pi*fm3*t).*cos(2*pi*fc3*t);st=xt1+xt2+xt3;fcp=400,600;fcs=350,700;Fs=10000;T=1/Fs;wp=2*fcp*T;ws=2*fcs*T;rp=0.1;rs=60;n,wpo=ellipord(wp,ws,rp,rs);b,a=ellip(n,rp,rs,wpo);h,w=freqz(b,a);subplot(2,2,1);plot(w/pi,abs(h);xlabel(w/pi);ylabel(|H(w)|);subplot(2,2,2);plot(w/

33、pi,20*log10(abs(h);xlabel(w/pi);ylabel(20*log10(|(h)|);y1=filter(b,a,st);n1=0:length(y1)-1;subplot(2,2,3);plot(n1,y1);xlabel(中心频率为Hz的时域图);ylabel(y2(n);figure(13)%高通滤波fcp=850;fcs=750;Fs=10000;T=1/Fs;wp=2*fcp*T;ws=2*fcs*T;rp=0.1;rs=60;n,wpo=ellipord(wp,ws,rp,rs);b,a=ellip(n,rp,rs,wpo,high);h,w=freqz(b

34、,a);subplot(2,2,1);plot(w/pi,abs(h);xlabel(w/pi);ylabel(|H(w)|);subplot(2,2,2);plot(w/pi,20*log10(abs(h);xlabel(w/pi);ylabel(20*log10(|(h)|);N=800;Fs=10000;T=1/Fs;Tp=N*T;t=0:T:(N-1)*T;k=0:N-1;f=k/Tp;fc1=Fs/10;fm1=fc1/10;fc2=Fs/20;fm2=fc2/10;fc3=Fs/40;fm3=fc3/10;xt1=(cos(2*pi*fc1*t)+cos(2*pi*fm1*t).*

35、cos(2*pi*fc1*t);xt2=(cos(2*pi*fc2*t)+cos(2*pi*fm2*t).*cos(2*pi*fc2*t);xt3=(cos(2*pi*fc3*t)+cos(2*pi*fm3*t).*cos(2*pi*fc3*t);st=xt1+xt2+xt3;y1=filter(b,a,st);n1=0:length(y1)-1;subplot(2,2,3);plot(n1,y1);xlabel(中心频率为Hz的时域图);ylabel(y3(n);%低通figure(1)Fs=1000;T=1/Fs;fp=150;fs=200;rs=60;wp=2*pi*fp*T;ws=2*

36、pi*fs*T;%数字指标很显然对pi做归一化啦啊!bt=ws-wp;alph=0.112*(rs-8.7);%计算系数m=ceil(rs-8)/(2.285*bt);%阶数wc=(wp+ws)/2/pi;b=fir1(m,wc,kaiser(m+1,alph);%低通hnh,w=freqz(b,1);plot(w/pi,abs(h);figure(2)%信号N=1000;Fs=1000;T=1/Fs;Tp=N*T;t=0:T:(N-1)*T;fc=Fs/10;f0=fc/10;mt=cos(2*pi*f0*t);ct=cos(2*pi*fc*t);xt=mt.*ct;nt=2*rand(1,

37、N)-1;fp=150;fs=200;Rp=0.1;As=70;fb=fp,fs;m=0,1;dev=10(-As/20),(10(Rp/20)-1)/(10(Rp/20)+1);n,fo,mo,W=remezord(fb,m,dev,Fs);hn=remez(n,fo,mo,W);yt=filter(hn,1,10*nt);xt=xt+yt;fst=fft(xt,N);k=0:N-1;f=k/Tp;subplot(3,1,1);plot(t,xt);grid;xlabel(t/s);ylabel(x(t);axis(0,Tp/5,min(xt),max(xt);title(a)信号加噪声波形

38、);subplot(3,1,2);plot(f,abs(fst)/max(abs(fst);grid;title(b)信号加噪声的频谱);axis(0,Fs/2,0,1.2);xlabel(f/Hz);ylabel(幅度);figure(3)Fs=1000;T=1/Fs;fp=150;fs=200;rs=60;wp=2*pi*fp*T;ws=2*pi*fs*T;%数字指标bt=ws-wp;alph=0.112*(rs-8.7);%计算系数m=ceil(rs-8)/(2.285*bt);%阶数wc=(wp+ws)/2/pi;b=fir1(m,wc,kaiser(m+1,alph);%低通hnh,

39、w=freqz(b,1);/仔细观察,你会发现的。很神奇的呢,期待你的发现subplot(2,1,1);plot(w/pi,abs(h);N=1000;Fs=1000;T=1/Fs;Tp=N*T;t=0:T:(N-1)*T;fc=Fs/10;f0=fc/10;mt=cos(2*pi*f0*t);ct=cos(2*pi*fc*t);xt=mt.*ct;nt=2*rand(1,N)-1;fp=150;fs=200;Rp=0.1;As=70;fb=fp,fs;m=0,1;dev=10(-As/20),(10(Rp/20)-1)/(10(Rp/20)+1);n,fo,mo,W=remezord(fb,

40、m,dev,Fs);hn=remez(n,fo,mo,W);yt=filter(hn,1,10*nt);xt=xt+yt;yt1=fftfilt(b,xt);subplot(2,1,2);n1=0:length(yt1)-1;plot(n1,yt1);xlabe(信号yt1的时域图);%循环卷积计算线性卷积。DFT只能算循环卷积的。你懂得例 利用FFT实现线性卷积。已知序列x(n)= R4(n),求:(1)用conv函数求x(n)与x(n)的线性卷积y(n),并绘出图形;(2)用FFT求x(n)与x(n)的4点循环卷积y1(n),并绘出图形;(3)用FFT求x(n)与x(n)的8点循环卷积y2

41、(n),并将结果与(1)比较,说明线性卷积与循环卷积之间的关系。 N1= 4; N2= 8;n1= 0:1:N1-1;n2= 0:1:N2-1;x= 1,1,1,1; % 构造序列x(n)x1= 1,1,1,1,0,0,0,0; % 在序列x(n)后补4个零figure(1)subplot(2,2,1) stem(n1,x),grid on;title(序列x(n) y1= conv(x,x); % y1为x(n)与x(n)的线性卷积subplot(2,2,2) stem(0:1:length(y1)-1,y1),grid on; title(x(n)与x(n)线性卷积)X2= fft(x); % 计算x(n)与x(n)的4点循环卷积Y2= X2.*X2; y2= ifft(Y2); subplot(2,2,3) stem(n1,y2),grid on; title(x(n)与x(n)的4点循环卷积) X3= fft(x1); % 计算x(n)与x(n)的8点循环卷积Y3= X3.*X3; y3= ifft(Y3) subplot(2,2,4) stem(n2,y3),grid on; title(x(n)与x(n)的8点循环卷积) 看懂程序。这个必须有

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

当前位置:首页 > 其他


经营许可证编号:宁ICP备18001539号-1