时域离散信号地产生与基本运算Word下载.docx
《时域离散信号地产生与基本运算Word下载.docx》由会员分享,可在线阅读,更多相关《时域离散信号地产生与基本运算Word下载.docx(13页珍藏版)》请在冰豆网上搜索。
3、实现步骤
(1)单位抽样序列
程序:
x=zeros(1,10);
x
(2)=1;
stem(x,'
filled'
)
axis([0,10,-0.2,1]);
title('
µ
¥
Î
»
³
é
Ñ
ù
Ð
ò
Á
'
);
图1
(2)单位阶跃序列
N=10;
u=ones(1,N);
stem(u,'
axis([-10,10,0,1]);
½
×
Ô
¾
图2
(3)正弦序列
x=-20:
1:
20;
y=sin(0.2*pi.*x+0.5*pi);
stem(x,y,'
axis([-20,20,-2,2]);
Õ
ý
Ï
Ò
图3
(4)实指数序列a=1/2
n=0:
10;
a1=1/2;
y1=a1.^n;
stem(n,y1,'
axis([0,10,0,1]);
Ê
Ö
¸
£
¬
a=1/2'
图4
5实指数序列a=2
a2=2;
y2=a2.^n;
stem(n,y2,'
a=2'
图5
6随机序列
y=rand(1,20);
stem(y,'
Ë
æ
ú
图6
信号的移位:
(1)信号移位
n=-3:
k0=3;
k1=-3;
%Ê
Å
º
Ä
Æ
x=cos(2*pi*n/10);
x1=cos(2*pi*(n-k0)/10);
x2=cos(2*pi*(n-k1)/10);
subplot(3,1,1),stem(n,x,'
ylabel('
x(n)'
subplot(3,1,2),stem(n,x1,'
x(n-2)'
subplot(3,1,3),stem(n,x2,'
x(n+2)'
2信号相加、信号相乘
x1=cos(2*pi*n/10);
subplot(2,2,1);
stem(n,x1,'
x
(1)'
axis([-4,20,-2,2]);
x2=cos(2*pi*n/10);
subplot(2,2,2);
stem(n,x2,'
x
(2)'
y=x1+x2;
subplot(2,2,3);
stem(n,y,'
à
¼
Ó
y=x1.*x2;
subplot(2,2,4);
n=-5:
5;
x=exp(-0.4*n);
x1=fliplr(x);
n1=-fliplr(n);
subplot(2,1,1),stem(n,x,'
subplot(2,1,2),stem(n1,x1,'
x(-n)'
信号和、信号积、信号能量:
x=[1,2,3,4,5,6,7,8,9];
y1=sum(x)
y2=prod(x)
E1=sum(x.*conj(x))
得到:
y1=45
y2=362880
E1=285
序列的波形;
序列;
(3)描绘一下序列的波形
functionf=u(t)
f=(t>
=0);
subplot(2,1,1)
n=-10:
y1=(2*n+5).*(u(n+4)-u(n))+6.*(u(n)-u(n-5));
axis([-10,10,-3,6]);
序列波形'
t=-10:
subplot(2,1,2)
y=(-3)*(u(t+4)-u(t+3))+(-1)*(u(t+3)-u(t+2))+(u(t+2)-u(t+1))+3*(u(t+1)-u(t))+6*(u(t)-u(t-1))+6*(u(t-1)-u(t-2))+6*(u(t-2)-u(t-3))+6*(u(t-3)-u(t-4))+6*(u(t-4)-u(t-5));
stem(t,y,'
用单位脉冲序列及其加权和表示序列波形'
subplot(2,2,1)
axis([-10,10,-6,12]);
subplot(2,2,2)
stem(t+2,2*y,'
2x(n-2)'
subplot(2,2,3)
stem(t-2,2*y,'
2x(n+2)'
subplot(2,2,4)
stem(2-t,y,'
x(2-n)'
4、思考题
当进行离散序列的相乘运算时,例1-6程序中有yp=xa1.*xa2,请问此处进行的相乘运算是矩阵乘还是数组乘,为何这样使用?
答:
此处进行的是数组乘,因为只有用数乘组,才能将序列中对应的数乘起来,实现序列相乘