




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、实 验 报 告 课 程: 数字信号处理 专业班级: 学生姓名: 学 号: 年 月 日2.1对M=2,运行上述程序,生成输入xn=s1n+s2n的输出信号。输入xn的哪个分量被该离散时间系统抑制?% 程序 P2_1% 一个M点滑动平均滤波器的仿真% 产生输入信号n = 0:100;s1 = cos(2*pi*0.05*n); % 一个低频正弦s2 = cos(2*pi*0.47*n); % 一个高频正弦x = s1+s2;% M点滑动平均滤波器的实现M = input(滤波器所需的长度 = );num = ones(1,M);y = filter(num,1,x)/M;clf;subplot(2
2、,2,1);plot(n, s1);axis(0, 100, -2, 2);xlabel(时间序号n); ylabel(振幅);title(低频正弦);subplot(2,2,2);plot(n, s2);axis(0, 100, -2, 2);xlabel(时间序号n); ylabel(振幅);title(高频正弦);subplot(2,2,3);plot(n, x);axis(0, 100, -2, 2);xlabel(时间序号n); ylabel(振幅);title(输入信号);subplot(2,2,4);plot(n, y);axis(0, 100, -2, 2);xlabel(时间
3、序号n); ylabel(振幅);title(输出信号); axis;图形显示如下:答:输入部分的高频成分成分被抑制了。2.3对滤波器长度M和正弦信号s1n和s2n的频率取其他值,运行程序P2.1,算出结果。n = 0:100;s1=cos(2*pi*0.02*n);s2=cos(2*pi*0.46*n);x = s1+s2;% M点滑动平均滤波器的实现M = input(滤波器所需的长度 = );num = ones(1,M);y = filter(num,1,x)/M;clf;figure,subplot(2,2,1);plot(n, s1);axis(0, 100, -2, 2);xla
4、bel(时间序号n); ylabel(振幅);title(低频正弦);subplot(2,2,2);plot(n, s2);axis(0, 100, -2, 2);xlabel(时间序号n); ylabel(振幅);title(高频正弦);subplot(2,2,3);plot(n, x);axis(0, 100, -2, 2);xlabel(时间序号n); ylabel(振幅);title(输入信号);subplot(2,2,4);plot(n, y);axis(0, 100, -2, 2);xlabel(时间序号n); ylabel(振幅);title(输出信号); axis;num =1
5、,-ones(1,M-1);y = filter(num,1,x)/M;figure,subplot(2,2,1);plot(n, s1);axis(0, 100, -2, 2);xlabel(时间序号n); ylabel(振幅);title(低频正弦);subplot(2,2,2);plot(n, s2);axis(0, 100, -2, 2);xlabel(时间序号n); ylabel(振幅);title(高频正弦);subplot(2,2,3);plot(n, x);axis(0, 100, -2, 2);xlabel(时间序号n); ylabel(振幅);title(输入信号);sub
6、plot(2,2,4);plot(n, y);axis(0, 100, -2, 2);xlabel(时间序号n); ylabel(振幅);title(输出信号); axis;图形显示如下:答:运行结果如下图,可以看出输出信号保留了输入信号xn的高频分量,即保留了s2n分量,低频部分s1n被抑制了。2.5用不同频率的正弦信号作为输入信号,计算每个输入信号的输出信号。输出信号是如何受到输入信号频率的影响的?从数学上对你的结论加以证明。% 程序P2_2% 产生一个正弦输入信号clf;n = 0:200;f=input(Please input the value of f:)x = cos(2*pi
7、*f*n);% 计算输出信号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);% 画出输入和输出信号subplot(2,1,1)plot(n, x)xlabel(时间序列n);ylabel(振幅);title(输入信号)subplot(2,1,2)plot(n,y)xlabel(时间信号n);ylabel(振幅);title(输出信号);分别取F=0.05,F=0.47,F=0.5以及F=0,仿真结果如下所示: 证明:设输入信号为,则以及则答
8、:从图形中可以看出,输入频率越大,输出信号值越小。最后都逐渐趋于0。2.7运行程序P2.3,对由加权输入得到的yn在与相同权系数下输出y1n和y2n相加得到的ytn进行比较,这两个序列是否相等?该系统是线性系统么?clf;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;ic = 0 0;y1 = filter(num,den,x1,ic);y2 = filter(num,den,x2,ic); y
9、= filter(num,den,x,ic);yt = a*y1 + b*y2; d = y - yt; subplot(3,1,1)stem(n,y);ylabel(振幅);title(加权输入: a cdot x_1n + b cdot x_2n的输出);subplot(3,1,2)stem(n,yt);ylabel(这幅);title(加权输出: a cdot y_1n + b cdot y_2n);subplot(3,1,3)stem(n,d);xlabel(时间序号 n);ylabel(振幅);title(差信号);图形显示如下:答:该仿真结果说明这两个序列相等,该系统是线性系统。2
10、.9当初始条件非零时重做习题Q2.7。令ic = 10 20;则仿真结论如下所示:答:该仿真结果说明这两个序列不相等,该系统不是线性系统。2.11假定另一个系统为yn=xnxn-1,修改程序P2.3,计算这个系统的输出序列y1n,y2n和yn。比较yn和ytn。这两个序列是否相等?该系统是线性系统吗?n=0:40;a=2;b=-3;x11=0 cos(2*pi*0.1*n) 0;x12=0 0 cos(2*pi*0.1*n);x21=0 cos(2*pi*0.4*n) 0; x22=0 0 cos(2*pi*0.4*n);y1=x11.*x12;y2=x21.*x22;yt=a*y1+b*y2
11、;y=(a*x11+b*x21).*(a*x12+b*x22);d=y-yt;subplot(3,1,1)stem(0 n 0,y);ylabel(振幅);title(加权输入: a cdot x_1n + b cdot x_2n的输出);subplot(3,1,2)stem(0 n 0,yt);ylabel(这幅);title(加权输出: a cdot y_1n + b cdot y_2n);subplot(3,1,3)stem(0 n 0,d);xlabel(时间序号 n);ylabel(振幅);title(差信号);图形显示如下:答:这两个序列不相等,该系统不是线性系统。2.13采用三个
12、不同的延时变量D的值重做习题Q2.12。D=2;D=6;D=12;显示图形如下:答:该系统是时不变系统,满足yn-D=ydn。2.15在非零的初始条件下重做习题Q2.12,该系统是时不变系统吗?clf;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;num = 2.2403 2.4908 2.2403;den = 1 -0.4 0.75;ic = 5 10; y = filter(num,den,x,ic);yd = filter(num,den,xd,ic)
13、;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( xn-10); grid;subplot(3,1,3)stem(n,d);xlabel( n); ylabel();title();grid;图形显示如下:答:该仿真结果说明该系统是时变系统。2.17考虑另一个系统:yn=nxn+xn-1,修改程序P2.4,以仿真上面的系统并确定该系统是否为时不变系统。clf;n = 0:40; D = 10;a = 3.0;
14、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: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(由于延时输入 xn-10的输出); grid;subplot(3,1,3)ste
15、m(n,d);xlabel(时间序号 n); ylabel(振幅);title(差值信号);grid;图形显示如下:答:从仿真结果看,该系统是时变系统。2.19运行程序P2.5,生成式(2.15)所给的离散系统的冲激响应。clf;N=40;num=2.2403 2.4908 2.2403;den=1 -0.4 0.75;y=impz(num,den,N);%画出冲激相应stem(y);xlabel(时间序号n);ylabel(振幅); title(冲激响应);grid;图形显示如下:2.21利用filter命令编写一个MATLB程序,生成式(2.17)给出的因果线性时不变系统的冲激响应,计算并
16、画出前40个的样本。把你的结果和习题Q2.20中得到的结果相比较。clf;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; but this will agree with% the INCORRECT pl
17、otting that was also done% by program P2_5.stem(y);xlabel(Time index n); ylabel(Amplitude);title(Impulse Response); grid;图形显示如下:答:两题结果一样。2.23运行程序P2.6,计算输出序列yn和y2n以及差值信号dn。yn和y2n相等吗?% Program P2_6% Cascade Realizationclf;x = 1 zeros(1,40); % Generate the inputn = 0:40;% Coefficients of 4th order syst
18、emden = 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.7 0.85;% Output y1n of the first stage in the cascadey1 = filter
19、(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 of 4th order Realization); grid;subplot(3,1,2);stem(n,y2)ylabel(Amplitude);titl
20、e(Output of Cascade Realization); grid;subplot(3,1,3);stem(n,d)xlabel(Time index n);ylabel(Amplitude);title(Difference Signal); grid;图形显示如下:答:y(n)和y2(n)相等。2.25用任意的非零初始向量ic,ic1和ic2来重做习题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
21、.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 = 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(num
22、1,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 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(Amp
23、litude);title(Output of Cascade Realization); grid;subplot(3,1,3);stem(n,d)xlabel(Time index n);ylabel(Amplitude);title(Difference Signal); grid;图形显示如下:答:y(n)和y2(n)不相等。2.27用任意非零初始向量ic,ic1和ic2来重做习题Q2.26。% Program P2.27% Cascade Realizationclf;x = 1 zeros(1,40); % Generate the inputn = 0:40;% Coeffici
24、ents 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% Compute 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
25、first stage in the cascadey1 = filter(num2,den2,x,ic(1:2);% Output y2n of the second stage in the cascadey2 = 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); g
26、rid;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;图形显示如下:答:由结果表明,两个输出结果有没差别。有差别证明级联的顺序不可以互换,这里是一个验证程序。2.29修改程序P2.7,计算长度为15的序列hn和长度为10的序列xn的卷积,重做问题Q2.28。hn和xn的样本值你自己给定
27、。% Program P2.29clf;h = 3 2 1 -2 1 0 -4 0 3 1 5 4 0 3 5; % impulse responsex = 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
28、,2);stem(n,y1);xlabel(Time index n); ylabel(Amplitude);title(Output Generated by Filtering); grid;图形显示如下:答:xn后面补零数应为x(n)和hn序列的长度之和减一,为14.2.31使用命令break的目的是什么?答:使用命令break是使当在k未到最后一个数值是此时的值已经小于时,跳出for循环。2.33考虑用差分方程描述的离散时间系统。修改程序P2.8,计算并画出上述系统的冲激响应。该系统稳定吗?% values of the impulse response samplesclf;num = 1 -4 3; den = 1 -1.7 1;N = 200;h = impz(num,den,N
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 天津远洋万和城高端产品打造案例
- 2025年大坝建设合作协议书
- 2025年锰粉系列项目建议书
- 高性能网络漏洞扫描数据分析系统租赁与定制服务合同
- 展览现场安保人员调度与补充协议
- 物流运输授权分成补充协议
- 智能家居解决方案性能优化补充协议
- 商业步行街商业地产租赁与委托运营服务协议
- 跨行业战略合作收益分成补充协议
- 海外合同文本翻译及国际法律认证合同
- 开休闲书吧创业计划书
- 人体常见病智慧树知到期末考试答案章节答案2024年
- 《石油行业安全生产标准化-陆上采油实施规范》
- 异常产程的识别和处理
- 危险化学品“两重点一重大”简介(刘卓)省公开课一等奖全国示范课微课金奖课件
- 完整版购销合同范本(标准版)-2024多场合版
- 2024年甘肃省临夏州永靖县部分学校中考物理一模试卷+
- 传染病孕妇的管理与预防
- 生物教学中的跨学科教学设计和实施
- 机织产品工艺设计与计算改样本
- 梅陇镇永联村未来规划方案
评论
0/150
提交评论