南京邮电大学DSP实验.doc
文本预览下载声明
南京邮电大学
实 验 报 告
实验名称 熟悉MATLAB环境
快速傅里叶变换(FFT)及其应用
IIR数字滤波器的设计
FIR数字滤波器的设计
课程名称 数字信号处理A
班级学号
姓 名 康登飞
开课时间 2013/2014学年, 第 二 学期
实验一 熟悉MATLAB环境
实验目的
(1)熟悉MATLAB得主要操作命令。
(2)学会简单的矩阵输入和数据读写。
(3)掌握简单的绘图命令。
(4)用MATLAB编程并学会创建函数。
(5)观察离散系统的频率响应。
实验内容
(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。
解:
clear
n = 0:1:3;
A=[1 2 3 4];
subplot(4,2,1)
stem(n,A)
xlabel(n)
ylabel(A)
B=[3,4,5,6];
subplot(4,2,2)
stem(n,B)
xlabel(n)
ylabel(B)
C=A+B;
subplot(4,2,3)
stem(n,C)
xlabel(n)
ylabel(C)
D=A-B;
subplot(4,2,4)
stem(n,D)
xlabel(n)
ylabel(D)
E=A.*B;
subplot(4,2,5)
stem(n,E)
xlabel(n)
ylabel(E)
F=A./B;
subplot(4,2,6)
stem(n,F)
xlabel(n)
ylabel(F)
G=A.^B;
subplot(4,2,7)
stem(n,G)
xlabel(n)
ylabel(G)
(2) 用MATLAB实现下列序列:
a)
解:
n=0:1:15;
x1=0.8.^n;
stem(n,x1)
xlabel(n)
ylabel(x(n))
title(2(a))
b)
解:
n=0:1:15;
i=sqrt(-1);
a = 0.2+3*i;
x2=exp(a*n);
figure
subplot(1,2,1)
stem(n,real(x2))
xlabel(n)
ylabel(x(n)实部)
subplot(1,2,2)
stem(n,imag(x2))
xlabel(n)
ylabel(x(n)虚部)
c)
解:
n=0:1:15;
x3=3*cos(0.125*pi*n+0.2*pi) + 2*sin(0.25*pi*n+0.1*pi);
stem(n,x3)
xlabel(n)
ylabel(x(n))
(4) 绘出下列时间函数的图形,对x轴、y轴以及图形上方均须加上适当的标注:
a)
解:
t=0:0.001:10;
x=sin(2*pi*t);
plot(t,x,r-)
xlabel(t),ylabel(x(t)),title(sin(2\pit))
b)
解:
t=0:0.001:4;
x=cos(100*pi*t).*sin(pi*t);
plot(t,x,r-)
xlabel(t),ylabel(x(t)),title(cos(100\pi*t).*sin(\pi*t))
给定一因果系统,求出并绘制H(z)的幅频响应和相频响应。
解:
k=256;
num=[1 1.414 1];
den=[1 -0.67 0.9];
w=0:pi/k:pi;
h=freqz(num,den,w);
subplot(2,2,1);
plot(w/pi,real(h));grid
title( 实部)
xlabel(\omega/\pi);ylabel(幅度)
subplot(2,2,2);
plot(w/pi,imag(h));grid
title( 虚部)
xlabel(\omega/\pi);ylabel(幅度)
subplot(2,2,3);
plot(w/pi,abs(h));grid
title( 幅度谱)
xlabel(\omega/\pi);ylabel(幅度)
subplot(2,2,4);
plot(w/pi,angle(h));grid
title( 相位谱)
xlabel(\omega/\pi);ylabel(幅度)
(7) 计算序列{8 -2 -1 2 3}和序列{2 3 -1 -3}的离散卷积,并作图表示卷积结果。
解:
x=[8,-2,-1,2,3];
kx=0:4;
h=[2,3,-1,-3];
kh=0
显示全部