matlab实验指导重点讲义资料

《数字信号处理》MATLAB实验指导

实验一:离散时间信号和离散时间系统

一、 实验目的:

1、 以MATLAB为工具学习离散时间信号的图形表示;

2、 以课本提供的例程,练习、理解典型离散信号及其基本运算; 3、 通过MATLAB仿真简单的离散时间系统,研究其时域特性; 4、 加深对离散系统的差分方程、冲激响应和卷积分析方法的理解。 二、 实验内容:

1、 典型序列的产生与显示; 2、 序列的简单运算;

3、 复合和复杂信号的产生与显示;

4、 离散时间系统的仿真:线性和非线性系统、时变和非时变系统的仿真;

5、 线性时不变离散时间系统:系统冲激响应、卷积运算、系统的级联、系统的稳

定性;

三、实验例程:

1、 参照课本例程产生下列序列,并用plot、stem好人subplot命令绘出其图形: ①单位取样序列??n?;②单位阶跃序列??n?;③矩形序列RN(n),④斜变序列n??n?。 所需输入的数据是产生序列的长度L和抽样频率FT。 % Program P1_1

% Generation of a Unit Sample Sequence clf;

% Generate a vector from -10 to 20 n = -10:20;

% Generate the unit sample sequence u = [zeros(1,10) 1 zeros(1,20)]; % Plot the unit sample sequence stem(n,u);

xlabel('Time index n');ylabel('Amplitude'); title('Unit Sample Sequence'); axis([-10 20 0 1.2]);

2、 编写MATLAB实指数序列程序, % Program P1_3

% Generation of a real exponential sequence clf;

n = 0:35; a = 1.2; K = 0.2; x = K*a.^n;

stem(n,x);

xlabel('Time index n');ylabel('Amplitude');

3、 编写产生swept frequency sinusoidal 序列的程序。 % Program P1_7

% Generation of a swept frequency sinusoidal sequence n = 0:100; a = pi/2/100; b = 0;

arg = a*n.*n + b*n; x = cos(arg); clf; stem(n, x);

axis([0,100,-1.5,1.5]);

title('Swept-Frequency Sinusoidal Signal'); xlabel('Time index n'); ylabel('Amplitude'); grid; axis; >>

4、 产生正弦振幅调制序列

% Generation of amplitude modulated sequence clf;

n = 0:100;

m = 0.4;fH = 0.1; fL = 0.01; xH = sin(2*pi*fH*n); xL = sin(2*pi*fL*n); y = (1+m*xL).*xH; stem(n,y);grid;

xlabel('Time index n');ylabel('Amplitude');

5、 用滑动平均滤波器平滑带噪信号,讨论滤波器长度对平滑效果、输出平滑后信号与

输入带噪信号之间延时的影响。

% Program P1_5

% Signal Smoothing by Averaging clf; R = 51;

d = 0.8*(rand(R,1) - 0.5); % Generate random noise m = 0:R-1;

s = 2*m.*(0.9.^m); % Generate uncorrupted signal

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4