1、第5章 时域离散系统的网络结构成 绩: 数字信号处理作业与上机实验(第二章)班 级: 学 号: 姓 名: 任课老师: 完成时间: 信息与通信工程学院 20142015学年第 1 学期第5章 时域离散系统的网络结构1、对信号x(n)=1,2,3,4,5,6,7,8,n=0,1,2.7,应用如下系统进行处理: 分别用迭代法按差分方程直接编程、按照直接型网络结构编程、调用MATLAB的filter函数实现该信号的处理,求得y(n)。1)用三种方法求初始条件为0时的y(n);(1)迭代法: Matlab代码:n=0:7;x=1,2,3,4,5,6,7,8;y(1)=x(1);y(2)=x(2)+0.6
2、*x(1)-0.1*y(1);for m=3:8 y(m)=x(m)+0.6*x(m-1)+0.7*x(m-2)-0.1*y(m-1)-0.2*y(m-2);endstem(n,y);title(信号y(n);ylabel(幅值);xlabel(n);处理后的信号y(n)波形见图一:图一 信号y(n)波形图处理后信号y(n)的数值:y =1.0000 2.5000 4.4500 6.2550 7.9845 9.7506 11.5280 13.2971(2)按照直接型网络结构编程:Matlab代码:n=0:7;x=1,2,3,4,5,6,7,8;m1=0;m2=0;for m=1:8 w(m)=
3、x(m)-0.1*m1-0.2*m2; y(m)=w(m)+m1*0.6+0.7*m2; m2=m1; m1=w(m);endstem(n,y);title(信号y(n);ylabel(幅值);xlabel(n);处理后的信号y(n)波形见图二:图二 信号y(n)波形图处理后信号y(n)的数值:y =1.0000 2.5000 4.4500 6.2550 7.9845 9.7506 11.5280 13.2971(3)调用MATLAB的filter函数:Matlab代码:n=0:7;x=1,2,3,4,5,6,7,8;a=1,0.1,0.2;b=1,0.6,0.7;y=filter(b,a,x
4、);stem(n,y);title(信号y(n);ylabel(幅值);xlabel(n);处理后的信号y(n)波形见图三:图三 信号y(n)波形图处理后信号y(n)的数值:y =1.0000 2.5000 4.4500 6.2550 7.9845 9.7506 11.5280 13.29712)当初始条件为:y(-1)=-0.1,y(-2)=0.2,x(-1)=0.3,x(-2)=0.8时,用三种方法求y(n);(1)迭代法: Matlab代码:n=0:7;x=1,2,3,4,5,6,7,8;y(1)=x(1)+0.6*0.3+0.7*0.8-0.1*(-0.1)-0.2*0.2;y(2)=
5、x(2)+0.6*x(1)+0.7*0.3-0.1*y(1)-0.2*(-0.1);for m=3:8 y(m)=x(m)+0.6*x(m-1)+0.7*x(m-2)-0.1*y(m-1)-0.2*y(m-2);endstem(n,y);title(信号y(n);ylabel(幅值);xlabel(n);处理后的信号y(n)波形见图四:图四 信号y(n)波形图处理后信号y(n)的数值:y =1.7100 2.6590 4.2921 6.2390 8.0177 9.7504 11.5214 13.2978(2)按照直接型网络结构编程:Matlab代码:n=0:7;x=1,2,3,4,5,6,7,
6、8;v0=x;v1(1)=0.3;v2(1)=0.8;w1(1)=-0.1;w2(1)=0.2;for m=1:8 w0(m)=-0.1*w1(m)-0.2*w2(m)+v0(m)+0.6*v1(m)+0.7*v2(m); y(m)=w0(m); v2(m+1)=v1(m);w2(m+1)=w1(m); v1(m+1)=v0(m);w1(m+1)=w0(m);endstem(n,y);title(信号y(n);ylabel(幅值);xlabel(n);处理后的信号y(n)波形见图二:图二 信号y(n)波形图 处理后信号y(n)的数值: y =1.7100 2.6590 4.2921 6.239
7、0 8.0177 9.7504 11.5214 13.2978 (3)调用MATLAB的filter函数:Matlab代码:n=0:7;x=1,2,3,4,5,6,7,8;a=1,0.1,0.2;b=1,0.6,0.7;xs=0.3,0.8;ys=-0.1,0.2;xi=filtic(b,a,ys,xs);y=filter(b,a,x,xi);stem(n,y);title(信号y(n);ylabel(幅值);xlabel(n);处理后的信号y(n)波形见图六:图六 信号y(n)波形图 处理后信号y(n)的数值: y =1.7100 2.6590 4.2921 6.2390 8.0177 9.
8、7504 11.5214 13.29782、x(n)为受到工业高频干扰的心电信号:x(n)=-4,-2,0,-4,-6,-4,-2,-4,-6,-6,-4,-4,-6,-6,-2,6,12,8,0,-16,-38,-60,-84,-90,-66,-32,-4,-2,-4,8,12,12,10,6,6,6,4,0,0,0,0,0,-2,-4,0,0,0,-2,-2,0,0,-2,-2,-2,-2,0,n=0,1,2.,55。初始条件为0。用数字信号处理系统对其进行去噪处理。系统如下: 按直接性与级联型网络结构编程实现对心电信号的处理。(1)按级联型网络结构编程实现对心电信号的处理:Matlab代
9、码:n=0:55;x=-4,-2,0,-4,-6,-4,-2,-4,-6,-6,. -4,-4,-6,-6,-2, 6,12, 8, 0,-16,. -38,-60,-84,-90,-66,-32,-4,-2,-4, 8,. 12,12,10,6,6,6,4,0,0,0,. 0,0,-2,-4,0,0,0,-2,-2,0,. 0,-2,-2,-2,-2,0; %存有高频干扰心电图信号序列stem(n,x);xlabel(n);ylabel(x(n);title(原始心电图信号序列x(n);v1=0;v2=0;v8=0;v9=0;v15=0;v16=0;for m=1:56 v3=1.2686*
10、v1-0.7051*v2; v4=2*v1+v2; v10=1.0106*v8-0.3583*v9; v11=2*v8+v9; v17=0.9044*v15-0.2155*v16; v18=2*v15+v16; v6=x(m)+v3; v7=v6+v4; v13=v7+v10; v14=v13+v11; v20=v14+v17; y(m)=v20+v18; v2=v1;v1=v6;v9=v8;v8=v13;v16=v15;v15=v20;endfigure(2)stem(n,y/1000);xlabel(n);ylabel(y(n);title(用级联型网络结构对心电信号处理后的序列y(n);
11、心电图信号序列x(n)及处理后的信号y(n)波形见图七、八:图七 心电图信号序列x(n) 图八 信号y(n)波形图(2)按直接型网络结构编程实现对心电信号的处理:Matlab代码:n=0:55;x=-4,-2,0,-4,-6,-4,-2,-4,-6,-6,. -4,-4,-6,-6,-2, 6,12, 8, 0,-16,. -38,-60,-84,-90,-66,-32,-4,-2,-4, 8,. 12,12,10,6,6,6,4,0,0,0,. 0,0,-2,-4,0,0,0,-2,-2,0,. 0,-2,-2,-2,-2,0; %存有高频干扰心电图信号序列stem(n,x);xlabel(
12、n);ylabel(x(n);title(原始心电图信号序列x(n);S=1,2,1,1,-1.2686,0.7051; 1,2,1,1,-1.0106,0.3583; 1,2,1,1,-0.9044,0.2155;G=0.0007378;B,A=sos2tf(S,G);m1=0;m2=0;m3=0;m4=0;m5=0;m6=0;for m=1:56 w(m)=x(m)-A(2)*m1-A(3)*m2-A(4)*m3-A(5)*m4-A(6)*m5-A(7)*m6; y(m)=0.0007*w(m)+0.0044*m1+0.0111*m2+0.0148*m3+0.0111*m4+0.0044*
13、m5+0.0007*m;m6=m5;m5=m4;m4=m3;m3=m2;m2=m1;m1=w(m);endfigure(2)stem(n,y);xlabel(n);ylabel(y(n);title(用直接型网络结构对心电信号处理后的序列y(n);心电图信号序列x(n)及处理后的信号y(n)波形见图九、十:图九 心电图信号序列x(n) 图十 信号y(n)波形图(3)调用MATLAB的filter函数对心电信号的处理:Matlab代码:n=0:55;x=-4,-2,0,-4,-6,-4,-2,-4,-6,-6,. -4,-4,-6,-6,-2, 6,12, 8, 0,-16,. -38,-60,
14、-84,-90,-66,-32,-4,-2,-4, 8,. 12,12,10,6,6,6,4,0,0,0,. 0,0,-2,-4,0,0,0,-2,-2,0,. 0,-2,-2,-2,-2,0; %存有高频干扰心电图信号序列stem(n,x);xlabel(n);ylabel(x(n);title(原始心电图信号序列x(n);S=1,2,1,1,-1.2686,0.7051; 1,2,1,1,-1.0106,0.3583; 1,2,1,1,-0.9044,0.2155;G=0.0007378;B,A=sos2tf(S,G);y=filter(B,A,x);figure(2)stem(n,y);xlabel(n);ylabel(y(n);title(用filter函数对心电信号处理后的序列y(n);心电图信号序列x(n)及处理后的信号y(n)波形见图十一、十二:图十一 心电图信号序列x(n) 图十二 信号y(n)波形图参考文献1、高西全,丁玉美.数字信号处理(第三版).西安电子科技大学出版社 .2008年8月2、杨毅明.第5章 数字信号处理的实现.XX文库.2011年4月
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1