江苏大学09级数字信号实验报告
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
实验一熟悉Matlab环境
一、实验目的
1.熟悉MATLAB的主要操作命令。
2.学会简单的矩阵输入和数据读写。
3.掌握简单的绘图命令。
4.用MATLAB编程并学会创建函数。
5.观察离散系统的频率响应。
二、实验内容
认真阅读本章附录,在MATLAB环境下重新做一遍附录中的例子,体会各条命令的含义。在熟悉了MATLAB基本命令的基础上,完成以下实验。
上机实验内容:
1:数组的加、减、乘、除和乘方运算。输入A=[1 2 3 4],B=[3 4 5 6],求C=A+B,D=A-B,E=A.*B,F=A./B,G=A.^B并用stem语句画出A、B、C、D、E、F、G。
A=[1 2 3 4]
B=[3 4 5 6]
C=A+B
D=A-B
E=A.*B
F=A./B
G=A.^B
subplot(3,3,1)
stem(A)
subplot(3,3,2)
stem(B)
subplot(3,3,3)
stem(C)
subplot(3,3,4)
stem(D)
subplot(3,3,5)
stem(E)
subplot(3,3,6)
stem(F)
subplot(3,3,7)
stem(G)
2:用MATLAB实现下列序列:
a) x(n)=0.8n0≤n≤15
b) x(n)=e(0.2+3j)n0≤n≤15
c) x(n)=3cos(0.125πn+0.2π)+2sin(0.25πn+0.1π) 0≤n≤15
d) 将c)中的x(n)扩展为以16为周期的函数x16(n)=x(n+16),绘出四个周期。
e)将c)中的x(n)扩展为以10为周期的函数x10(n)=x(n+10),绘出四个周期。clear all;
n=0:15;
xa=0.8.^n;
xb=exp((0.2+3*j)*n);
xc=3*cos(0.125*pi*n+0.2*pi)+2*sin(0.25*pi*n+0.1*pi);
n=0:63;
xd=3*cos(0.125*pi*n+0.2*pi)+2*sin(0.25*pi*n+0.1*pi);
m=1:10;
xe(m)=3*cos(0.125*pi*m+0.2*pi)+2*sin(0.25*pi*m+0.1*pi); for i=0:3
for m=1:10
n=10*i+m;
xe(n)=xe(m);
end
end
subplot(5,1,1)
stem(xa)
subplot(5,1,2)
stem(xb)
subplot(5,1,3)
stem(xc)
subplot(5,1,4)
stem(xd)
subplot(5,1,5)
stem(xe)
3: x(n)=[1,-1,3,5],产生并绘出下列序列的样本:
a) x 1(n)=2x(n+2)-x(n-1)-2x(n)
b)∑=-=5
1k 2)k n (nx (n) x
clear all
n=1:4;
T=4;
x=[1 -1 3 5];
x(5:8)=x(1:4);
for i=1:4
if i-1>0
x1(i)=2*x(i+2)-x(i-1)-2*x(i);
else
x1(i)=2*x(i+2)-x(i-1+T)-2*x(i);
end
end
x1(5:8)=x1(1:4);
subplot(2,1,1);
stem(1:8,x1);
clear all
n=1:4;
T=4;
x1=[1 -1 3 5];
x1(5:8)=x1(1:4);
y(n)=0;
for i=1:4
for k=1:5
if i-k>0
x2(k)=i*x1(i-k);
y(i)=y(i)+x2(k);
else if i-k+4>0
x2(k)=i*x1(i-k+T);
y(i)=y(i)+x2(k);
else
x2(k)=i*x1(i-k+2*T); y(i)=y(i)+x2(k);
end
end
end
end
x1(5:8)=x1(1:4);
subplot(2,1,2);
stem(n,y(n));
grid;
4:绘出下列时间函数的图形,对x轴、y轴以及图形上方均须加上适当的标注:
a) x(t)=sin(2πt) 0≤t≤10s
b) x(t)=cos(100πt)sin(πt) 0≤t≤4s
ta=0:0.05:10;
xa=sin(2*pi*ta);
subplot(2,1,1);plot(ta,xa);
xlabel('t');ylabel('幅度');
tb=0:0.01:4;
xb=cos(100*pi*tb).*sin(pi*tb);
subplot(2,1,2);plot(tb,xb);
xlabel('t');ylabel('幅度');