数字信号处理matlab实验2-离散系统的时域分析

上传人:cjc****537 文档编号:46112373 上传时间:2018-06-22 格式:DOC 页数:13 大小:155.50KB
返回 下载 相关 举报
数字信号处理matlab实验2-离散系统的时域分析_第1页
第1页 / 共13页
数字信号处理matlab实验2-离散系统的时域分析_第2页
第2页 / 共13页
数字信号处理matlab实验2-离散系统的时域分析_第3页
第3页 / 共13页
数字信号处理matlab实验2-离散系统的时域分析_第4页
第4页 / 共13页
数字信号处理matlab实验2-离散系统的时域分析_第5页
第5页 / 共13页
点击查看更多>>
资源描述

《数字信号处理matlab实验2-离散系统的时域分析》由会员分享,可在线阅读,更多相关《数字信号处理matlab实验2-离散系统的时域分析(13页珍藏版)》请在金锄头文库上搜索。

1、实验实验 2 2 离散系统的时域分析离散系统的时域分析实验目的实验目的:加深对离散系统的差分方程、冲激响应和卷积分析方法的理解。 实验原理实验原理:离散系统nxny Discrete-time systme其输入、输出关系可用以下差分方程描述: MkkNkkknxpknyd00输入信号分解为冲激信号,。mmnmxnx记系统单位冲激响应,nhn 则系统响应为如下的卷积计算式:mmnhmxnhnxny当时,hn是有限长度的(n:0,M) ,称系统为 FIR 系统;反之,称系统Nkdk,.2 , 1, 0为 IIR 系统。在 MATLAB 中,可以用函数 y=filter(p,d,x)实现差分方程的

2、仿真,也可以用函数 y=conv(x,h)计算卷积,用 y=impz(p,d,N)求系统的冲激响应。实验内容和要求:1、以下程序中分别使用 conv 和 filter 函数计算 h 和 x 的卷积 y 和 y1,运行程序,并分析 y 和y1 是否有差别,为什么要使用 xn补零后的 x1 来产生 y1;具体分析当 hn有 i 个值,xn有j 个值,使用 filter 完成卷积功能,需要如何补零?% Program P2_7clf;h = 3 2 1 -2 1 0 -4 0 3;% impulse responsex = 1 -2 3 -4 3 2 1;% input sequencey = co

3、nv(h,x);n = 0:14;subplot(2,1,1);stem(n,y);xlabel(Time index n); ylabel(Amplitude);title(Output Obtained by Convolution); grid;x1 = x zeros(1,8);y1 = filter(h,1,x1);subplot(2,1,2);stem(n,y1);xlabel(Time index n); ylabel(Amplitude);title(Output Generated by Filtering); grid;程序运行结果:02468101214-20-10010

4、20Time index nAmplitudeOutput Obtained by Convolution02468101214-20-1001020Time index nAmplitudeOutput Generated by Filtering由图可看出,y 与 y1 并无差别。使用 xn补零后的 x1 来产生 y1,是因为存在边界效应,只要脉冲响应采样电部分位于输入信号采样值之外,输出就不确定,如:x 1 -2 3 -4 3 2 1 2 h 3 0 -4 0 1 -2 1 2 3 2 4 1需变换成如下才能确定输出:x 1 -2 3 -4 3 2 1 2 0 0 0 0 0 0 0 0

5、 0 0 0h 3 0 -4 0 1 -2 1 2 3 2 4 1此时 n18。用 conv 函数计算能再输入序列后自动补零,而 filter 函数不能。 分析:(1)h = 1 4 2 3 2 1 -2 1 0 -4 0 3;% impulse response i=12x = 1 -2 3 -4 3 2 1 2;% input sequence j=8n = 0:17;x1 = x zeros(1,10);%补十个零值y1 = filter(h,1,x1);stem(n,y1);xlabel(Time index n); ylabel(Amplitude);title(Output Gen

6、erated by Filtering);grid(1)图(2)h = 1 4 2 3 2 1 -2 1 0 -4 0 3;% impulse response i=12x = 1 -2 3 -4 3 2 1 2;% input sequence j=8024681012141618-20-15-10-50510152025Time index nAmplitudeOutput Generated by Filteringn = 0:18;x1 = x zeros(1,11);%补 11 个零值y1 = filter(h,1,x1);stem(n,y1);xlabel(Time index n

7、); ylabel(Amplitude);title(Output Generated by Filtering); grid 024681012141618-20-15-10-50510152025Time index nAmplitudeOutput Generated by Filtering(2)图(3)h = 1 4 2 3 2 1 -2 1 0 -4 0 3;% impulse response i=12x = 1 -2 3 -4 3 2 1 2;% input sequence j=8n = 0:30;x1 = x zeros(1,23);%补 23 个零值y1 = filter

8、(h,1,x1);stem(n,y1);xlabel(Time index n); ylabel(Amplitude);title(Output Generated by Filtering); grid;051015202530-20-15-10-50510152025Time index nAmplitudeOutput Generated by Filtering(3)图对照(1) 、 (2)图,当 n18 时两图有区别,(2)图能完全卷积,当补零数少于 j1,就不能完全卷积。对照(2) 、 (3)图可知,不零数可大于 j1,须满足 n 的长度与补零后 x1 的长度相等。hn有 i 个值

9、,xn有 j 个值, 以 n 为 x 轴,n=0:N,使用 xn补零后的 x1 来产生 y1,由上述图可知,要完全卷积,x1 至少需补 j1 个零值。其中 N=(ij1)-1, n 的长度与补零后 x1的长度相等,若 x1 中补 a 个零值(a=j-1) ,则 Nia1。编制程序求解下列两个系统的单位冲激响应和阶跃响应,并绘出其图形。要求分别用 filter、conv、impz 三种函数完成。 12125. 0 175. 0nxnxnynyny432 125. 0nxnxnxnxny给出理论计算结果和程序计算结果并讨论。理论计算结果: 12125. 0 175. 0nxnxnynyny单位冲激

10、响应:2125. 0 175. 0 1nhnhnnnHn 012345 hn1-1.751.19-0.670.355-0.18.Yn1-1.751.19-0.670.355-0.18单位阶跃响应:2125. 0 175. 0nnynynyn 012345 Yn1-0.750.44-0.2340.12-0.06432 125. 0nxnxnxnxny单位冲激响应:n 012345 Yn00.250.250.250.250单位阶跃响应:n 012345 Yn00.250.50.75 1 1程序计算结果:I. 12125. 0 175. 0nxnxnynynya. 单位冲激响应:(1)用 filte

11、r 函数a1=1,0.75,0.125;b1=1,-1;n=0:20;x1=1 zeros(1,20);y1filter=filter(b1,a1,x1);stem(n,y1filter);title(y1filter);xlabel(x);ylabel(y);02468101214161820-2-1.5-1-0.500.511.5y1filterxy(2)用 conv 函数a1=1,0.75,0.125;b1=1,-1;x1=1 zeros(1,10);h=impz(b1,a1,10);y1conv=conv(h,x1);n=0:19;stem(n,y1conv,filled)024681

12、01214161820-2-1.5-1-0.500.511.5(3)用 impz 函数a1=1,0.75,0.125;b1=1,-1;impz(b1,a1,21);02468101214161820-2-1.5-1-0.500.511.5n (samples)AmplitudeImpulse Responseb. 单位阶跃响应:(1)用 filter 函数a1=1,0.75,0.125;b1=1,-1;n=0:20;x2=ones(1,21);y1filter=filter(b1,a1,x2);stem(n,y1filter);title(y1filter_step);xlabel(x);yl

13、abel(y);02468101214161820-0.8-0.6-0.4-0.200.20.40.60.81y1filterstepxy(2)用 conv 函数a1=1,0.75,0.125;b1=1,-1;x2=ones(1,21);h=impz(b1,a1,20);y1=conv(h,x2);y1conv=y1(1:21); %为何 y1conv 要取 y1 中 1:21 的值,解释见n1=0:20; %y2单位阶跃响应用 conv 函数中注释stem(n1,y1conv,filled);title(y1conv);xlabel(n);ylabel(y1n);02468101214161

14、820-0.8-0.6-0.4-0.200.20.40.60.81y1convny1n(3)用 impz 函数a=1,0.75,0.125;b=1;impz(b,a)0510152025303540-0.8-0.6-0.4-0.200.20.40.60.81n (samples)AmplitudeImpulse ResponseII. yn=0.25(xn-1+xn-2+xn-3+xn-4)a. 单位冲激响应:(1)用 filter 函数a2=1;b2=0 0.25*ones(1,4);n=0:9;x1=1 zeros(1,9);y2filter=filter(b2,a2,x1);stem(n

15、,y2filter);title(y2filter);xlabel(x);ylabel(y)012345678900.050.10.150.20.25y2filterxy(2)用 conv 函数a2=1;b2=0 0.25*ones(1,4);x1=1 zeros(1,5);h=impz(b2,a2,5);y2conv=conv(h,x1);n=0:9;stem(n,y2conv,filled)012345678900.050.10.150.20.25(3)用 impz 函数a2=1;b2=0 0.25*ones(1,4);impz(b2,a2,10);012345678900.050.10.1

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 经济/贸易/财会 > 经济学

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号