目 录
实验一 连续时间信号时域分析 ……..………………..2
实验二实验三实验四实验五实验六实验七实验八
离散时间信号时域分析 连续时间系统时域分析 离散时间系统时域分析 连续时间信号频域分析 连续时间系统频域分析 信号采样与重建 传输函数与系统特性 1
……………………….9 ………………………15 ………………………21 ………………………24 ……….……………..33 ……….……………..47 ………..…………….53
实验一 连续时间信号时域分析
一、 实验目的
1、熟悉MATLAB软件。
2、掌握常用连续信号与离散信号的MATLAB表示方法。
二、 实验设备
安装有matlab6.5 以上版本的PC机一台。
三、MATLAB使用说明
1、在 MATLAB可视化绘图中,对于以t 为自变量的连续信号,在绘图 时统一用plot 函数。
2、此外也可以利用 MATLAB的ezplot 函数对连续信号画图。
四、实验原理
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ ________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________
2
五、实验内容
1、用MATLAB表示连续信号:Ae?t ,Acos(ω0 t +? ),Asin(ω0 t +? )。 1) Ae?t
代码:
%连续信号的表示
ezplot('2*exp(-2*t)',-2,2); grid on
title('f(t)=2*exp(-2*t)'); xlabel('t') 图像:
f(t)=2*exp(-2*t)706050403020100-2-1.5-1-0.50t0.511.52
2)Acos(ω0 t +? ) 代码:
%连续信号的表示
ezplot('3*cos(3*t+pi/6)',[0,pi]); grid on
title('f(t)=3*cos(3*t+pi/6)'); xlabel('t') 图像:
3
f(t)=3*cos(3*t+pi/6)3210-1-2-300.511.5t22.53
3)Asin(ω0 t +? )
代码:
ezplot('3*sin(3*t+pi/6)',[0,pi]); grid on
title('f(t)=3*sin(3*t+pi/6)'); xlabel('t') 图像:
4
f(t)=3*sin(3*t+pi/6)3210-1-2-300.511.5t22.53
2、用MATLAB表示抽样信号(sinc(t))、矩形脉冲信号(rectpuls(t, width))及三角脉冲信号(tripuls(t, width, skew))。 代码:
t=-2*pi:0.01:2*pi; f=sinc(t); subplot(311); plot(t,f); grid on;
title('f=sinc(t)'); xlabel('t');
%矩形脉冲信号(rectpuls(t, width)) x=-2:0.01:2; y=rectpuls(x,2); subplot(312); plot(x,y) grid on
axis([-2,2,-2,2]); xlabel('t');
%三角脉冲信号(tripuls(t, width, skew))
5
y=tripuls(x, 2, 0); subplot(313); plot(x,y)
axis([-2,2,-2,2]) grid on 图像:
f=sinc(t)10-1-8-6-4-202t矩形脉冲信号46820-2-2-1.5-1-0.500.5t三角脉冲信号11.5220-2-2-1.5-1-0.500.511.52
3、编写如图3 的函数并用MATLAB 绘出满足下面要求的图形。
(1) f (?t); (2) f (t ? 2); (3) f (1? 2t); (4) f (0.5t +1).
6
代码:
%试验1-3 clear,clc;
t=-1:0.001:12;
f=4*rectpuls(t-6,12)+3*tripuls(t-6,4); subplot(321); plot(t,f) grid on
axis([-1,13,0,8]) xlabel('t');title('f(t)'); %f(-t)
x1=-t; subplot(322); plot(x1,f) grid on
axis([-13,1,0,8]); title('f(-t)'); xlabel('t'); %f(t-2)
x2=t+2; subplot(323); plot(x2,f); grid on
axis([1,15,0,8]) title('f(t-2)'); xlabel('t'); %f(1-2t)
x3=(1-t)/2; subplot(324); plot(x3,f) grid on
title('f(1-2t)');xlabel('t') axis([-6,1,0,8]) %f(0.5t+1)
x4=2*(t-1); subplot(325); plot(x4,f) grid on
xlabel('t');title('f(0.5t+1)') 图像:
7
f(t)500510tf(t-2)5051015tf(0.5t+1)1050-100102030t六、实验小结
8
f(-t)50-10-50tf(1-2t)50-6-4-20t
实验二 连续时间系统的时域分析
一、实验目的
1. 掌握常用离散信号的MATLAB 表示方法。 2、掌握用MATLAB 计算卷积和的方法。
二、实验设备
安装有matlab6.5 以上版本的PC 机一台。
三、实验原理
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ ______________________________________________________________________________________________________________________________________________________________________________ __________________________________________________________ ______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
9
四、实验内容
k1.用MATLAB表示离散信号:a,Asin(k)。
源代码:
1)ak(k>=0)
代码:
k=-10:1:10; y=2.^k.*(k>=0); stem(k,y,'filled')
图像:
120010008006004002000-10-8-6-4-202468102)
代码:
n=-5:1:5; f=3*sin(n);
stem(n,f,'r','filled'); grid on
title('f=3*sin(n)');
10
xlabel('n'); ylabel('f');
图像:
f=3*sin(n)3210f-1-2-3-5-4-3-2-1
2、已知离散序列波形如图4 所示,试用MATLAB 绘出满足下列要求的序列波形。
0n12345(1) f[k-2]u[k] (2) f[-k] (3) f[-k+2] (4) f[k-2]u[k-2]
代码:
%2_2 k=-6:1:5;
f=[0,1,3,6,10,15,14,12,9,5,0,0]; subplot(321) stem(k,f,'filled') grid on xlabel('k');
11
ylabel('f(k)'); title('f[k]') %f(k-2)u(k) subplot(322)
stem(k+2,f.*(k+2>=0),'filled') grid on xlabel('k')
title('f[k-2]u[k]'); %f[-k]
subplot(323) stem(-k,f,'filled') grid on xlabel('k') title('f[-k]'); %f[-k+2] subplot(324)
stem(2-k,f,'filled') grid on
title('f[-k+2]'); xlabel('k'); %f[k-2]u[k-2] subplot(325)
stem(2+k,f.*(k>=0),'filled') grid on
title('f[k-2]u[k-2]') xlabel('k') 图像:
12
f[k]20f(k)f[k-2]u[k]20100-5100-10-5kf[-k]050kf[-k+2]51020100-5051020100-50k510kf[k-2]u[k-2]20100-50k5102.若x[n] {1,1,1,1,0,0} ,计算x[n]*x[n]。 代码:
clear,clc;
x=[1,1,1,1,0,0] f=conv(x,x) stem(f,'r','filled')
图像:
13
x[n]*x[n]43.532.521.510.501234567891011
五、实验小结
14
实验三 连续时间系统时域分析
一、实验目的
1、掌握卷积计算方法。
2、掌握函数lsim,impulse,step 的用法,lsim 为求取零状态响应, impulse 为求取单位脉冲响应,step 为求取单位阶跃响应。
3、运用课堂上学到的理论知识,从RC、RL 一阶电路的响应中正确 区分零输入响应、零状态响应、自由响应与受迫响应。
二、实验设备
安装有matlab6.5 以上版本的PC 机一台。
三、实验原理
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ ________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ ____________________________________________________________________________________________________________________
__________________________________________________________
15
四、实验内容
1. 分别用函数lsim 和卷积积分两种方法求如图7 所示系统的零状态响应。其中L=1,R=2,e(t) = e?tε(t),i(0? ) = 2。
? e(t) ? L i(t) R 系统方程:
L(di/dt)+iR= e(t) 代入 L=1,R=2 得 i′(t) + 2i (t) = e(t),e(t) = e?tε(t) 1)lism方法 代码:
%i'(t)+2i=exp(-t)u(t) %lsim
ts=0;te=5;dt=0.01; t=ts:dt:te; f=exp(-t); a=[1 2];b=[1]; y=lsim(b,a,f,t); plot(t,y) grid on
图像:
16
0.250.20.150.10.05000.511.522.533.544.55
2)卷积积分方法 代码:
%卷积 h(t)=e^(-2t) syms t x; h=exp(-2.*x); e=exp(-(t-x)); i=int(e.*h,x,0,t); ezplot(i,[0 6]); grid on
xlabel('Time(sec)'); ylabel('y(t)'); title('h(t)*e(t)');
图像:
17
h(t)*e(t)0.250.20.15y(t)0.10.0500123Time(sec)456
2. 求上述系统的冲激响应与阶跃响应。 代码: clear,clc;
a=[1 2];b=[1]; impulse(b,a); grid on pause step(b,a) grid on
图像:
18
Impulse Response10.90.80.70.6Amplitude0.50.40.30.20.1000.511.5Time (sec)22.53Step Response0.50.450.40.350.3Amplitude0.250.20.150.10.05000.511.5Time (sec)22.53
五、思考题
1. 为什么连续时间系统的零状态响应为激励与冲击响应的卷积?
19
2. 利用卷积积分法计算系统响应应从几个方面进行?
六、实验小结
20
六、实验小结
46
实验七 信号采样与重建
一、实验目的:
1、深刻理解采样定理的内容。 2、掌握信号采样后的频谱。
二、实验设备:
安装有matlab6.5 以上版本的PC 机一台。
三、实验原理:
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ ________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ ________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ ________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
47
四、实验内容:
1、已知f (t) = Sa(2t),以fs为采样频率,对f (t)进行采样得到fa(t) ,观察随着fs 由小变大, fa(t)频谱的变化,最后得出fa(t)与f (t)两者频谱之间的关系。
代码:
syms t w;
f=sin(2*t)/(2*t); subplot(321); ezplot(f,[-5,5]); title('时域信号'); ff=fourier(f); subplot(322);
ezplot(ff,[-5,5]); title('频谱信号');
fs=0.4;fc=0; for n=-3:3
fc=fc+(pi/2)*fs*(-heaviside(w-2-n*2*pi*fs)+heaviside(w+2-n*2*pi*fs)); end
subplot(323);
ezplot(fc,[-30,30]);
title('采样信号频谱,采样频率0.4');
fs=1;fc=0; for n=-3:3
fc=fc+(pi/2)*fs*(-heaviside(w-2-n*2*pi*fs)+heaviside(w+2-n*2*pi*fs)); end
subplot(324);
ezplot(fc,[-30,30]);
title('采样信号频谱,采样频率1');
fs=3;fc=0; for n=-3:3
fc=fc+(pi/2)*fs*(-heaviside(w-2-n*2*pi*fs)+heaviside(w+2-n*2*pi*fs)); end
subplot(325);
48
ezplot(fc,[-30,30]);
title('采样信号频谱,采样频率3');
fs=5;fc=0; for n=-3:3
fc=fc+(pi/2)*fs*(-heaviside(w-2-n*2*pi*fs)+heaviside(w+2-n*2*pi*fs)); end
subplot(326);
ezplot(fc,[-30,30]);
title('采样信号频谱,采样频率5');
图像:
时域信号10.50-505t采样信号频谱,采样频率0.41.510.50-5频谱信号05w采样信号频谱,采样频率110.50020w采样信号频谱,采样频率3-201.510.50020w采样信号频谱,采样频率510-20420-200w2050-20
2、 由实验1 中采样得到的离散信号重建对应的连续时间信号:情况一、f s ≥ 2f m;情况二、f s < 2f m。提示根据内插公式重建连续时间信号,或者根据采样后频谱通过低通滤波器的形式重建连续时间信号。
代码:
clc ,close, clear; syms t w;
f=sin(2*t)/(2*t);
49
0w20subplot(4,2,1); ezplot(f,[-5,5]); title('时域信号'); ff=fourier(f); subplot(4,2,2); ezplot(ff,[-5,5]);
title('频谱信号');
fs=2;%fm=w/(2π)=2/(2π) ≈0.32,fs>=2fm fc=0; for n=-3:3
fc=fc+(pi/2)*fs*(-heaviside(w-2-n*2*pi*fs)+heaviside(w+2-n*2*pi*fs)); end
subplot(4,2,3); ezplot(fc,[-40,40]); axis([-40 40 -0.1 6]);
title('采样信号频谱,fs≥2fm,(fs=2)');
G=-heaviside(w-4)+heaviside(w+4); %低通滤波器 Fc=fc*G;
f1=ifourier(Fc)/fs; subplot(4,2,4); ezplot(Fc,[-40,40]); axis([-40 40 -0.1 6]);
title('重建信号频谱,fs≥2fm,(fs=2)'); subplot(4,2,5); ezplot(f1,[-5,5]);
title('重建时域信号,fs≥2fm(fs=2)');
fs=0.5; fc=0; for n=-3:3
fc=fc+(pi/2)*fs*(-heaviside(w-2-n*2*pi*fs)+heaviside(w+2-n*2*pi*fs)); end
subplot(4,2,6); ezplot(fc,[-40,40]);
title('采样信号频谱,fs<2fm(fs=0.5)');
G=-heaviside(w-2)+heaviside(w+2); %低通滤波器 Fc=fc*G;
f1=ifourier(Fc)/fs;
50
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说成教大学东华大学信号与线性系统实验解读在线全文阅读。
相关推荐: