文档详情

实验10 离散信号的时域描述与运算.ppt

发布:2017-05-04约2.34千字共33页下载文档
文本预览下载声明
实验10 离散信号的时域描述与运算 ;实验目的:;一、离散时间信号的时域描述;实验原理:;常用离散信号的MATLAB表示;clear all x = -3:5 ; y1 = u(x) ; y2 = delta(x) ; subplot(2,1,1) stem(x,y1,fill) ; xlabel(n) ; grid on ; axis([-3 5 -0.1 1.1]) ; subplot(2,1,2) stem(x,y2,fill) ; xlabel(n) ; grid on ; axis([-3 5 -0.1 1.1]) ;;3、矩形序列;4、单边指数序列;从实验图可知,当 时,单边指数序列发散;;5、正弦序列;6、复指数序列;二、离散时间信号基本运算;序列的平移、反转;例1:;a = 0.8 ; N = 8 ; n = -12:12 ; f1 = a.^n ; f2 = u(n)-u(n-N) ; x1 = f1.*f2 ; n1 = n ; n2 = n1-3 ; n3 = n1+2 ; n4 = -n1 ; subplot(4,1,1) stem(n1,x1,fill) ; grid on; title(x1(n)) ; axis([-15 15 0 1]) ; subplot(4,1,2) stem(n2,x1,fill) ; grid on; title(x2(n)) ; axis([-15 15 0 1]) ; subplot(4,1,3) stem(n3,x1,fill) ; grid on; title(x3(n)) ; axis([-15 15 0 1]) ; subplot(4,1,4) stem(n4,x1,fill) ; grid on; title(x4(n)) ; axis([-15 15 0 1]) ;;n = -12:12 ; x1=x_f(n); x2=x_f(n+3); x3=x_f(n-2); x4=x_f(-1*n); subplot(4,1,1); stem(n,x1,filled); grid on; title(x1(n)) ; axis([-15 15 0 1]) ; subplot(4,1,2); stem(n,x2,filled) ; grid on; title(x2(n)) ; axis([-15 15 0 1]) ; subplot(4,1,3); stem(n,x3,filled) ; grid on; title(x3(n)) ; axis([-15 15 0 1]) ; subplot(4,1,4); stem(n,x4,filled‘) ; grid on; title(x4(n)) ; axis([-15 15 0 1]) ;;序列的尺度变换;例2:;clf ; n = 0:49 ; x = sin(2*pi*0.12*n) ; y = zeros(1,3*length(x)) ; y([1:3:length(y)]) = x ;利于空间的利用 subplot(2,1,1) stem(n,x,.); subplot(2,1,2) m = 0:3*length(x)-1 ; stem(m,y,.);;例3:;clf ; n = 0:49 ; m = 0:floor(50/3) -1; x = sin(2*pi*0.042*n) ; y = zeros(1,length(m)) ; y = x([1:3:3*floor(50/3)]);%抽取 subplot(2,1,1) stem(n,x,.); subplot(2,1,2) stem(m,y,.);;序列的相加与相乘;例3:;n = -3:5 ; f1 = u(n) - u(n-4) ;f2 = 2.^(-n) ; x1 = f1 + f2 ;x2 = f1 - f2 ;x3 = f1.*f2 ;;function [f,n] = sigmult(f1,n1,f2,n2)% 序列相乘 n = min(min(n1),min(n2)):max(max(n1),max(n2)) ; x1 = zeros(1,length(n)) ; x2 = x1 ; x1(find((n=min(n1))(n=max(n1))==1))=f1 ; x2(find((n=min(n2))(n=max(n2))==1))=f2 ; f = x1.*x2 ;;clf n1 = -5:5 ; f1 = u(n1)-u(n1-4) ; n2 = -3:5 ; f2 = 2.^(-n2) ; [f3,n3] = sigadd(f1,n1,f2,n2) ; [f4,n4] = sigmult(f1,n1,f2,n2) ; subp
显示全部
相似文档