文档介绍:实验报告
课程名称数字信号处理
实验项目名称离散信号产生及序列的运算
实验成绩指导老师(签名) 日期 2010-09-25
一. 实验目的和要求
了解matlab语言画图的主要特点及作用。
掌握matlab产生常用时域离散信号的方法。
二. 实验内容和原理
1. 函数作图,需要用到的matlab函数主要有abs, plot, stem, stairs, bar,subplot, title, xlabel, ylabel.
1 ).编程显示函数曲线
2).编程显示子图,包括上述函数的线性图,脉冲图,阶梯图,条形图。
2. 离散信号的产生。
1) .在matlab中信号序列一般利用两个向量来表示,
例:x[k]={2,1,1,-1,3,0,2;k=-2,-1,0,1,2,3,4},
k=-2:4;
x=[2,1,1,-1,3,0,2]表示。
2). 常用序列的matlab实现。
编写程序,产生下列离散序列:
(1) ,
(2)
(3) (利用real,imag函数分别画实部和虚部)
(4) (提示:参考sinc函数)
b) 利用square函数产生R7[k] 的序列。
c) 利用sawtooth产生锯齿或三角形波。
一个连续的周期性锯齿波信号频率为10Hz,信号幅度在-1V到+1V之间,在窗口上显示3个周期的信号波形,用Hz的频率对连续信号进行采样。试显示原连续信号和其采样获得的离散信号波形。(提示:采样个数)
序列的运算。
给定系统的单位脉冲响应为
,
用线性卷积法求分别对系统和的输出响应,并画出波形。
三. 操作方法与实验步骤(包括实验数据记录和处理)
1. x=-1::1;
y=2.*sin(2.*pi.*x);
subplot(2,2,1)
plot(x,y);
xlabel('x');
ylabel('y');
title('线性图');
subplot(2,2,2)
stem(x,y);
xlabel('x');
ylabel('y');
title('脉冲图');
subplot(2,2,3)
stairs(x,y);
xlabel('x');
ylabel('y');
title('阶梯图');
subplot(2,2,4)
bar(x,y);
xlabel('x');
ylabel('y');
title('条形图');
2.
(1)
x=-2:4;
y=[2,1,1,-1,3,0,2]
stem(x,y)
(2)
a)
(1)
ns=3;
n1=-3:4;x1=[(n1-ns)==0];
stem(n1,x1);
(2) ns=3;
n2=-5:5;x2=[(n2-ns)>=0];
stem(n2,x2);
(3) n3=0:16;x3=exp((+*j*pi)*n3);
stem(n3,real(x3));
n4=-20:20;x4=sin(n4./5)./(n4./5);
stem(n3,imag(x3));
(4) n4=-20:20;x4=sin(n4./5)./(n4./5);
stem(n4,x4);
b) n=-1:7;
y=square(n);
y(1)=0;
for x=2:8
if y(x)==1
y(x)=1;
else
y(x)=y(x)+2;
end
end
y(9)=0;
stem(n,y,'fill')
n=-1:7;
y=square(n);
y(1)=0;
for x=2:8
if y(x)==1
y(x)=1;
else
y(x)=y(x)+2;
end
end
y(9)=0;
stem(n,y,'fill')
n=-1:7;
y=square(n);
y(1)=0;
for x=2:8
if y(x)==1
y(x)=1;
else
y(x)=y(x)+2;
end
end
y(9)=0;
stem(n,y,'fill')
c)
subplot(1,2,1);
fs=10;
t=0::3/fs;
x=sawtooth(20*pi*t);
plot(t,x)
subplot(1,2,2);
fs=150;
t=0:1/750:3/fs;
x=sawtooth(300*pi*t);
plot(t,x)
3. Rn=[1 1 1 1 1 1 1 1];
h1=[1 1 1 1 1 1 1 1 1 1 1];
y=conv(Rn,h1);
stem(y)
tit