实验离散信号的时域描述与运算演示文稿
*
1页,共32页,星期四。
*
优选实验离散信号的时域描述与运算
2页,共32页,星期四。
实验目的:
1、掌握常用时域离散信号的MATLAB表示方法
2、掌握离散信号的2,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]) ;
17页,共32页,星期四。
18页,共32页,星期四。
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]) ;
function f = x_f(n)
a = ; N = 8 ;
f1 = a.^n ;
f2 = u(n)-u(n-N) ;
f = f1.*f2 ;
19页,共32页,星期四。
序列的尺度变换
序列的尺度变换是由序列 得到 ,对应着
抽取和插值。当 ,每隔 个序列值抽取一
个值;当 ,每两个序列值之间插入 零值
20页,共32页,星期四。
例2:
21页,共32页,星期四。
clf ;
n = 0:49 ;
x = sin(2*pi**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,'.');
22页,共32页,星期四。
例3:
23页,共32页,星期四。
clf ;
n = 0:49 ;
m = 0:floor(50/3) -1;
x = sin(2*pi**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,'.');
24页,共32页,星期四。
序列的相加与相乘
对应离散样点值的加减乘除,因此与连续时间信号的数值处理方法一致
25页,共32页,星期四。
例3:
26页,共32页,星期四。
n = -3:5 ;
f1 = u(n) - u(n-4) ;f2 = 2.^(-n) ;
x1 = f1 + f2 ;x2 = f1 - f2 ;x3 = f1.*f2 ;
27页,共32页,星期四。
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 ;
function [f,n] = sigadd(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
实验离散信号的时域描述与运算演示文稿 来自淘豆网www.taodocs.com转载请标明出处.