数字信号处理00002_第1页
数字信号处理00002_第2页
数字信号处理00002_第3页
数字信号处理00002_第4页
数字信号处理00002_第5页
已阅读5页,还剩16页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、 数字信号处理实验报告 实验一 1.分析并绘出常用函数(a) 锯齿波; (b) 三角波; (c) 方波; (d) 抽样函数 的时域特性波形. 程序: allaclear t=0:0.0001:0.1; 产生五个周期锯齿波%x1=sawtooth(2*pi*50*t); subplot(221) plot(t,x1) )title(锯齿波110900623 )xlabel(t 产生五个周期三角波%x2=sawtooth(2*pi*50*t,0.5); subplot(222) plot(t,x2) )xlabel(t )三角波110900623title( 产生十个周期方波%x3=square(

2、2*pi*50*t); subplot(223) plot(t,x3) )xlabel(t )方波110900623title( axis(0,0.1,-1.2,1.2) t=-4:0.1:4; 产生抽样信号%x4=sinc(t); subplot(224) plot(t,x4) )xlabel(t axis(-5,5,-0.5,0.5) )110900623抽样信号title( 110900623角110900623锯齿波波三110.50.500-0.5-0.5 -1-0.00.00.0.1tt110900623信方波110900623号抽样0.510.500-0.5-1-0.-0.00.5

3、 tt 2.分析并绘出常用窗函数时域特性波形. clear all y1=boxcar(80); %矩形窗 plot(y1,k) axis(-1,81,-0.2,1.2) gtxst(矩形窗) hold on y2=triang(80); %三角窗 plot(y2,m.) hold on y3=hanning(80); %汉宁窗 plot(y3,y*) ) 汉宁窗gtxst( hold on 海明窗y4=hamming(80); %plot(y4,r-) ) gtxst(海明窗hold on y5=blackman(80); %布莱克曼窗plot(y5,g:) ) 布莱克曼窗gtxst(hol

4、d on 贝尔窗y6=kaiser(80,7.865);%凯塞- plot(y6,b-.) ) 贝尔窗gtxst(凯塞-110900623) title(常用窗函数110900623数用窗函矩10.80.6布莱克曼窗 0.4凯塞-贝尔窗 0.2三角窗窗明海汉宁窗0-0.201020304050607080 实验二内容: 1.计算序列x(n)=1,2,3,4,5,与序列h(n)=2,-2,3,5的线性卷积和6点、8点和10点圆周卷积. xn=1,2,3,4,5; hn=2,-2,3,5; yln=conv(xn,hn); ycn1=circonv2(xn,hn,6); ycn2=circonv2

5、(xn,hn,8); ycn3=circonv2(xn,hn,10); ny0=0:1:length(yln)-1; ny1=0:1:length(ycn1)-1; ny2=0:1:length(ycn2)-1; ny3=0:1:length(ycn3)-1; subplot(2,2,1); stem(ny0,yln) ylabel(线性卷积) subplot(2,2,2); stem(ny1,ycn1); ylabel(圆周卷积6) subplot(2,2,3); stem(ny2,ycn2) 8) 圆周卷积ylabel( subplot(2,2,4); stem(ny3,ycn3) yla

6、bel(圆周卷积10) axis(0,10,0,40); 1 yc=circonv2(x1,x2,N) %子程序function length(x1)Nif ); error(N must not be less than length of x1 end length(x2)Nif ); error(N must not be less than length of x2 end x1=x1,zeros(1,N-length(x1); x2=x2,zeros(1,N-length(x2); n=0:1:N-1; x2=x2(mod(-n,N)+1); H=zeros(N,N); n=1:1:

7、Nfor H(n,:)=cirshiftd(x2,n-1,N); end yc=x1*H; 2子程序 y=cirshiftd(x,m,N) %function length(x)Nif ); error(the length of x must be less than N end x=x,zeros(1,N-length(x); n=0:1:N-1; y=x(mod(n-m,N)+1); 110900623110900623404030306积积卷2020卷性周线圆101021109006231109006244330081积220卷卷周周圆1110 ?911?)?n?xcos0.5cosn

8、(n?2020? 某序列为2. 使用FFT函数分析其频谱.利用不同宽度N的矩形窗截短该序列,N分别为20,40,160,观察不同长度N的窗对谱分析结果的影响. clear all N=20; n=0:N-1; xn=0.5*cos(11*pi*n/20)+cos(9*pi*n/20); XK=fft(xn,N); magXK=abs(XK); phaXK=angle(XK); subplot(3,2,1) plot(n,xn) xlabel(n);ylabel(x(n); title(x(n)时域 N=20); subplot(3,2,2) k=0:length(magXK)-1; stem(

9、k,magXK,g.); xlabel(k);ylabel(|X(k)|); title(X(k) N=20); hold on N=40; n=0:N-1; xn=0.5*cos(11*pi*n/20)+cos(9*pi*n/20); XK=fft(xn,N); magXK=abs(XK); phaXK=angle(XK); subplot(3,2,3) plot(n,xn) xlabel(n);ylabel(x(n); title(x(n)时域 N=40); subplot(3,2,4) k=0:length(magXK)-1; stem(k,magXK,m.); xlabel(k);yl

10、abel(|X(k)|); title(X(k) N=40); hold on N=160; n=0:N-1; xn=0.5*cos(11*pi*n/20)+cos(9*pi*n/20); XK=fft(xn,N); magXK=abs(XK); phaXK=angle(XK); subplot(3,2,5) plot(n,xn) xlabel(n);ylabel(x(n); title(x(n)时域 N=160); subplot(3,2,6) k=0:length(magXK)-1; stem(k,magXK,b.); xlabel(k);ylabel(|X(k)|); title(X(k

11、) N=160); (k) N=20X域 N=20x(n)时102|)kn50(Xx|0-22015020510150510kn(k) N=40Xx(n)时域 N=40202 |)100n(Xx0-131242340kn(k) N=160x(n)时X域 N=160100|)k500(Xx0-510201520155100 kn 实验三: 1.用巴特沃斯滤波器设计一个数字低通滤波器,要求在0-0.2内衰耗不大于3dB,在0.6 内衰耗不小于60dB,采样频率Fs=500 Hz. wp=500*0.2*pi; ws=500*0.6*pi; Rp=3; Rs=60; Fs=500; Ts=1/Fs;

12、 %参数设计 N,Wn=buttord(wp,ws,Rp,Rs,s); %?模拟巴特沃斯低通滤波器 Z,P,K=buttap(N); %把滤波器零极点模型转化为传递函数模型Bap,Aap=zp2tf(Z,P,K); 的%把模拟滤波器原型转化为截止频率为wn 低通滤波器b,a=lp2lp(Bap,Aap,Wn); 双线性变换法实现模拟滤波器到数字滤波器% 转换bz,az=bilinear(b,a,Fs); 绘制频率响应图%H,W=freqz(bz,az); plot(W*Fs/(2*pi),abs(H); grid /Hz) 频率xlabel( 频率响应幅度) ylabel(title(1109

13、00623) 1109006231.41.21度0.8幅应响0.6率频0.40.20 250050100200150/Hz频率2.分别使用矩形窗和海明窗函数设计一个线性?j?e?,?c?)(H?d?,0?c 相位FIR低通滤波器,其逼近理想低通滤波器的频率特性. 其中c=1rad,=12s。 clf N=25; Wn=1; b=fir1(N,Wn/pi,hamming(N+1); freqz(b,1,512) title(110900623) hold on b=fir1(N,Wn/pi,boxcar(N+1); freqz(b,1,512) title(110900623) gtext(矩形) gtext(海明) gtext(矩形) gtext(海明) 11090062350)0B形矩d( ed-50uting明海 a-100M-15010.90.70.80.30.400.10.20.50.6? rad/sample)Normalized Frequency (0)s形-500erged( e-1000sa明P-150000.10.20.30.40.50.60.70.80.91? rad/sample)Normalized Frequency ( 四、实验心得 本次实验过程中,除

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论