实验一 时域离散信号的产生与基本运算
实验目的
1、了解常用的时域离散信号及其特点。
2、掌握MATLAB 产生常用时域离散信号的方法。
3、掌握时域离散信号简单的基本运算方法。
二、实验内容
1、自己设定参数,分别表示并绘制单位抽样序列、单位阶跃序列、正弦序列、
实指数序列、随机序列。
2、自己设定参数,分别表示并绘制信号移位、信号相加、信号相乘、信号翻转、
信号和、信号积、信号能量。
3、已知信号
(1) 描绘序列的波形。
(2) 用延迟的单位脉冲序列及其加权和表示序列。
(3) 描绘以下序列的波形:
实现步骤
1、自己设定参数,分别表示并绘制单位抽样序列、单位阶跃序列、正弦序列、
实指数序列、随机序列。
(1)单位抽样序列
程序:
x=zeros(1,10);
x(2)=1;
stem(x,'filled')
axis([0,10,-0.2,1]);
title('μ¥??3é?ùDòáD');
图1
(2)单位阶跃序列
程序:
N=10;
u=ones(1,N);
stem(u,'filled')
axis([-10,10,0,1]);
title('μ¥???×??DòáD');
图2
(3)正弦序列
程序:
x=-20:1:20;
y=sin(0.2*pi.*x+0.5*pi);
stem(x,y,'filled');
axis([-20,20,-2,2]);
title('?y?òDòáD');
图3
(4)实指数序列a=1/2
程序:
n=0:10;
a1=1/2;
y1=a1.^n;
stem(n,y1,'filled');
axis([0,10,0,1]);
title('êμ??êyDòáD£?a=1/2');
图4
5实指数序列a=2
程序:
n=0:10;
a2=2;
y2=a2.^n;
stem(n,y2,'filled');
title('êμ??êyDòáD,a=2');
图5
6 随机序列
程序:
y=rand(1,20);
stem(y,'filled');
title('???úDòáD');
图6
2、自己设定参数,分别表示并绘制信号移位、信号相加、信号相乘、信号翻转、
信号和、信号积、信号能量。信号的移位:
(1)信号移位
程序:
n=-3:10;k0=3;k1=-3;%êμ??D?o?μ?ò???
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,'filled');
ylabel('x(n)');
subplot(3,1,2),stem(n,x1,'filled');
ylabel('x(n-2)');
subplot(3,1,3),stem(n,x2,'filled');
ylabel('x(n+2)');
2信号相加、信号相乘
程序:
n=-3:20;
x1=cos(2*pi*n/10);
subplot(2,2,1);
stem(n,x1,'filled');title('x(1)');
axis([-4,20,-2,2]);
x2=cos(2*pi*n/10);
subplot(2,2,2);
stem(n,x2,'filled');title('x(2)');
axis([-4,20,-2,2]);
y=x1+x2;
subplot(2,2,3);
stem(n,y,'filled');title('D?o??à?ó');
axis([-4,20,-2,2]);
y=x1.*x2;
subplot(2,2,4);
stem(n,y,'filled');title('D?o??à3?');
axis([-4,20,-2,2]);
n=-5:5;
x=exp(-0.4*n);
x1=fliplr(x);
n1=-fliplr(n);
subplot(2,1,1),stem(n,x,'filled');title('x(n)');
subplot(2,1,2),stem(n1,x1,'filled');title('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、已知信号
(1) 描绘序列的波形;
(2) 用延迟的单位脉冲序列及其加权和表示序列;
(3) 描绘一下序列的波形
function f=u(t)
f=(