1、信号与系统实验教程只有答案信 号 与 系 统实 验 教 程(只有答案)(实验报告)这么玩!实验一 信号与系统的时域分析三、实验内容及步骤实验前,必须首先阅读本实验原理,读懂所给出的全部范例程序。实验开始时,先在计算机上运行这些范例程序,观察所得到的信号的波形图。并结合范例程序应该完成的工作,进一步分析程序中各个语句的作用,从而真正理解这些程序。实验前,一定要针对下面的实验项目做好相应的实验准备工作,包括事先编写好相应的实验程序等事项。Q1-1:修改程序Program1_1,将dt改为0.2,再执行该程序,保存图形,看看所得图形的效果如何? dt = 0.01时的信号波形 dt = 0.2时的信
2、号波形 这两幅图形有什么区别,哪一幅图形看起来与实际信号波形更像?答:Q1-2:修改程序Program1_1,并以Q1_2为文件名存盘,产生实指数信号x(t)=e-0.5t。 要求在图形中加上网格线,并使用函数axis()控制图形的时间范围在02秒之间。然后执行该程序,保存所的图形。修改Program1_1后得到的程序Q1_2如下: 信号x(t)=e-0.5t的波形图clear, % Clear all variablesclose all, % Close all figure windowsdt = 0.2; % Specify the step of time variablet = -
3、2:dt:2; % Specify the interval of timex = exp(-0.5*t); % Generate the signalplot(t,x) grid on;axis (0 2 0 1 ) title(Sinusoidal signal x(t)xlabel(Time t (sec)Q1-3:修改程序Program1_1,并以Q1_3为文件名存盘,使之能够仿真从键盘上任意输入的一个连续时间信号,并利用该程序仿真信号x(t)=e-2t。修改Program1_1后得到的程序Q1_3如下: 信号x(t)=e-2t的波形图clear, close all, dt = 0.
4、2; t = -2:dt:2; x=input(Input x(t):);plot(t,x) grid on;axis (0 2 -1 1 ) title(Sinusoidal signal x(t)xlabel(Time t (sec) Q1-4:将实验原理中所给的单位冲激信号和单位阶跃信号的函数文件在MATLAB文件编辑器中编写好,并分别以文件名delta和u存入work文件夹中以便于使用。抄写函数文件delta如下: 抄写函数文件u如下:function y = delta(t) % Unit step functiondt = 0.01; function y = u(t)y = (u
5、(t)-u(t-dt)/dt; y = (t=0); % y = 1 for t 0, else y = 0Q1-5:修改程序Program1_4,并以Q1_5为文件名存盘,利用axis()函数,将图形窗口的横坐标范围改为-2n5,纵坐标范围改为-1.5 x 1.5。修改Program1_4后得到的程序Q1_5如下: 信号的波形图 clear, close all, n = -5:5; x = zeros(1,4), 0.1, 1.1, -1.2, 0, 1.3, zeros(1,2); stem (n,x,.) grid on,axis(-2 5 -1.5 1.5);title (A dis
6、crete-time sequence xn)xlabel (Time index n)Q1-6:仿照前面的示例程序的编写方法,编写一个MATLAB程序,以Q1_6为文件名存盘,使之能够在同一个图形窗口中的两个子图中分别绘制信号xn=0.5|n| 和x(t)=cos(2t)u(t)-u(t-3)。要求选择的时间窗能够表现出信号的主要部分(或特征)。编写的程序Q1_6如下: 信号xn=0.5|n| 的波形图和信号x(t)=cos(2t)u(t)-u(t-3)的波形图clear,close all,t = -1:0.01:4;xt = cos(2*pi*t).*(u(t)-u(t-3); n=-5
7、:5; xn=(0.5).abs(n); subplot(211)plot(t,xt) grid on,title (Original signal x(t)subplot(212)stem(n,xn,.) grid on,title (Original signal x(n)xlabel (Time t (sec)Q1-7:根据示例程序的编程方法,编写一个MATLAB程序,以Q1_7为文件名存盘,由给定信号x(t) = e-0.5tu(t) 求信号y(t) = x(1.5t+3),并绘制出x(t) 和y(t)的图形。编写的程序Q1_7如下:编写产生x(t)的函数文件x.mfunction y
8、=x(t)y=exp(-0.5*t).*u(t);clear,close all,t = -3:0.01:4;xt = x(t); % Generate the original signal x(t)yt=x(1.5*t+3); subplot(211)plot(t,xt) % Plot x(t)grid on,title (Original signal x(t)subplot(212)plot(t,yt) % Plot x(t)grid on,title (Original signal y(t)xlabel (Time t (sec) 信号x(t)的波形图 信号y(t) = x(1.5
9、t+3) 的波形图Q1-8:给定一个离散时间信号xn = un un-8,仿照示例程序Program1_5,编写程序Q1_8,产生xn的左移序列x1n = xn+6和右移序列x2n = xn-6,并在同一个图形窗口的三个子图中分别绘制这三个序列的图形。编写的程序Q1_8如下:编写产生x(t)的函数文件xx.mfunction y=xx(n)y=u(n)-u(n-8);clear,close all,n = -10:15;x =xx(n); % Generate the original signal x(n)x1 = xx(n+6); % Shift x(t) to the left by 2
10、 second to get x1(n+6)x2 =xx(n-6); % Shift x(t) to the right by 2 second to get x2(n-6)subplot(311)stem(n,x,.) % Plot x(t)grid on,title (Original signal x(n)subplot (312)stem (n,x1,.) % Plot x1(t)grid on,title (Left shifted version of x(n)subplot (313)stem (n,x2,.) % Plot x2(t)grid on,title (Right s
11、hifted version of x(n)xlabel (Time t (sec)信号波形图Q1-9:编写程序Q1_9,使之能够接受以键盘方式输入的定义在不同时间段的两个不同连续时间信号并完成卷积运算,分别绘制这两个信号及其卷积的结果的图形,图形按照22分割成四个子图。编写的程序Q1_9如下:clear;close all;dt = 0.01;t0=input(Input first signal t0:);t1=input(Input first first signal t1:);tx = t0:dt:t1;x = input(Input first signal variable(tx
12、) :);t2=input(Input second signal t0:);t3=input(Input second signal t1:);th=t2:dt:t3;h = input(Input second signal variable(th) :)y = dt*conv(x,h); % Compute the convolution of x(t) and h(t)subplot(221)plot(tx,x), grid on, title(Signal x(t)xlabel(Time t sec)subplot(222)plot(th,h), grid on, title(Sig
13、nal h(t)xlabel(Time t sec)subplot(313)plot(y), grid on, title(The convolution of x(t) and h(t) xlabel(Time t sec)信号x (t)、h(t)和x (t)*h(t)的波形图Q1-10:给定两个离散时间序列 xn = 0.5nun-un-8 hn = un-un-8编写程序Q1_10,计算它们的卷积,并分别绘制xn、hn和它们的卷积yn的图形。编写的程序Q1_10如下:n=0:10;x = (0.5).n.*(u(n)-u(n-8);h = u(n)-u(n-8);y =conv(x,h)
14、; % Compute the convolution of x(t) and h(t)subplot(221)stem(n,x,.), grid on, title(Signal x(n)subplot(222)stem(n,h,.), grid on, title(Signal h(n)subplot(212)stem(y), grid on, title(The convolution of x(n) and h(n), xlabel(Time t sec);信号xn、hn和yn的波形图Q1-11已知一个序列为 编写MATLAB程序Q1_11,能够将xn以N = 8为周期进行周期延拓得到
15、一个周期为N =8的周期序列yn,并分别绘制xn和yn图形。编写的程序Q1_11如下:U4.mfunction y=u4(n)y=n.*(u(n)-u(n-5);Q111.mclear, close all;n =-16:32x=u4(n);T = 8; y = 0;for k = -2:4; y =y+u4(n-k*T);endsubplot(211)stem(n,x,.);grid on,title (Original signal x(n)xlabel(Time t sec)subplot(212)stem(n,y);title (period signal x(n)xlabel(Tim
16、e t sec)grid on,信号xn的波形图 信号yn的波形图Q1-12 仿照范例程序Program1_7,编写程序Q1_12,计算并绘制由如下微分方程表示的系统在输入信号为x(t) = (e-2t - e-3t)u(t)时的零状态响应和你手工计算得到的系统零状态响应曲线。 手工计算得到的系统零状态响应的数学表达式是:编写的程序Q1_12如下: 用MATLAB绘制的手工计算的系统响应clear, close all;num = input(Type in the right coefficient vector of differential equation:);den = input(
17、Type in the left coefficient vector of differential equation:);t = 0:0.01:8;x = input(Type in the expression of the input signal x(t):);y=lsim(num,den,x,t);plot(t,y)执行程序Q1_12得到的系统响应Q1-13:利用程序Q1_9,验证卷积的相关性质。(a) 验证性质:选择信号x(t)的数学表达式为:sin(t)x(t)、(t)和x(t)*(t)的波形验证所得结论是:(b) 验证性质:选择信号x(t)的数学表达式为:sin(t) t0=
18、2x(t)、(t-t0) 和的波形验证所得结论是:(c) 验证性质:选择信号x(t)的数学表达式为: sin(t) 选择的t1 = 2 秒,t2 = 3 秒。执行程序Q1_9,输入信号x(t-t1) 和(t-t2) 的数学表达式,得到的信号及其卷积的波形图如下:执行程序Q1_9,输入信号x(t-t2) 和(t-t1) 的数学表达式,得到的信号及其卷积的波形图如下:验证所得结论是:(d) 验证性质:选择信号x(t)(建议选择一个时限信号)的数学表达式为:u(t)-u(t-3)的数学表达式为:手工绘制的波形如下:执行程序Q1_9,输入信号x(t) 和u(t) 的数学表达式,得到的信号及其卷积的波形
19、图如下:验证所得结论是:(e) 验证性质:选择信号x(t)的数学表达式为: sin(t) 选择信号h(t)的数学表达式为:sin(t)选择的t0=:1执行程序Q1_9,输入信号x(t) 和h(t-t0) 的数学表达式,得到的信号及其卷积的波形图如下:执行程序Q1_9,输入信号x(t-t0) 和h(t) 的数学表达式,得到的信号及其卷积的波形图如下:验证所得结论是:Q1-14:做如下总结:1、信号与系统分析,就是基于信号的分解,在时域中,信号主要分解成:2、写出卷积的运算步骤,并谈谈你对卷积的一些基本性质的理解。利用MATLAB计算卷积的函数是什么?如何使用?3、在时域中,描述一个连续时间LTI
20、系统的数学模型有:4、MATLAB是如何表示一个由微分方程描述的连续时间LTI系统的?求解连续时间LTI系统的单位冲激响应、单位阶跃响应以及系统在某一个输入信号作用下的零状态响应的MATLAB函数有哪些?四、实验报告要求1、按要求完整书写你所编写的全部MATLAB程序2、详细记录实验过程中的有关信号波形图(存于自带的U盘中),图形要有明确的标题。全部的MATLAB图形应该用打印机打印,然后贴在本实验报告中的相应位置,禁止复印件。3、实事求是地回答相关问题,严禁抄袭。本实验完成时间: 年 月 日实验二 连续时间信号的频域分析三、实验内容及步骤实验前,必须首先阅读本实验原理,读懂所给出的全部范例程
21、序。实验开始时,先在计算机上运行这些范例程序,观察所得到的信号的波形图。并结合范例程序应该完成的工作,进一步分析程序中各个语句的作用,从而真正理解这些程序。实验前,一定要针对下面的实验项目做好相应的实验准备工作,包括事先编写好相应的实验程序等事项。Q2-1 编写程序Q2_1,绘制下面的信号的波形图: 其中,0 = 0.5,要求将一个图形窗口分割成四个子图,分别绘制cos(0t)、cos(30t)、cos(50t) 和x(t) 的波形图,给图形加title,网格线和x坐标标签,并且程序能够接受从键盘输入的和式中的项数。抄写程序Q2_1如下:clear,close allT = 2; dt = 0
22、.00001; t = -2*pi:dt:2*pi; w0=0.5*pi;x1 = cos(w0*t);x3=(-1/3)*cos(3*w0*t);x5=(1/5)*cos(5*w0*t);N = input(Type in the number of the harmonic components N = :);y=0;for q = 1:N; % Synthesiz the periodic signal y(t) from the finite Fourier series y = y+(1/q).*sin(q*pi)/2).*cos(q*w0*t);end;subplot(221),p
23、lot(t,x1), title(The original signal cos(w0t);grid on; axis(-2*pi,2*pi,-1,1), xlabel(Time t)subplot(223), plot(t,x5), title(The original signal (1/5)cos(5w0t);grid on; axis(-2*pi,2*pi,-1,1), xlabel(Time t)subplot(222)plot(t,x3), title(The original signal (-1/3)cos(3w0t);grid on; axis(-2*pi,2*pi,-1,1
24、), xlabel(Time t)subplot(224)plot(t,y), title(The synthesis signal of x(t);grid on; axis(-10,10,-1,1), xlabel(Index N)执行程序Q2_1所得到的图形如下:N=10Q2-2 给程序Program2_1增加适当的语句,并以Q2_2存盘,使之能够计算例题2-1中的周期方波信号的傅里叶级数的系数,并绘制出信号的幅度谱和相位谱的谱线图。通过增加适当的语句修改Program2_1而成的程序Q2_2抄写如下:clear,close allT = 2; dt = 0.00001; t = -2:
25、dt:2;x1 = u(t)-u(t-1-dt); x = 0;for m = -1:1 x = x + u(t-m*T) - u(t-1-m*T-dt); % Periodically extend x1(t) to form a periodic signalendw0 = 2*pi/T;N = input(Type in the number of the harmonic components N = :);L = 2*N+1;for k = -N:1:N; ak(N+1+k) = (1/T)*x1*exp(-j*k*w0*t)*dt;endphi = angle(ak);y=0;fo
26、r q = 1:L; % Synthesiz the periodic signal y(t) from the finite Fourier series y = y+ak(q)*exp(j*(-(L-1)/2+q-1)*2*pi*t/T);end;subplot(221)plot(t,x), title(The original signal x(t), axis(-2,2,-0.2,1.2),grid on;subplot(222)k=-N:N; stem(ak), title(The ak of x(t), axis(-1,1,-0.4,0.4),grid on;subplot(223
27、)k=-N:N; stem(k,abs(ak),k.), title(The amplitude |ak| of x(t), axis(-N,N,-0.1,0.6),grid on;subplot(224)stem(k,phi,r.), title(The phase phi(k) of x(t), axis(-N,N,-2,2), xlabel(Index k),grid on;执行程序Q2_2得到的图形Q2-3 反复执行程序Program2_2,每次执行该程序时,输入不同的N值,并观察所合成的周期方波信号。通过观察,你了解的吉伯斯现象的特点是: N=5 N=10N=20 N=401、周期信
28、号的傅里叶级数与GIBBS现象给定如下两个周期信号:Q2-4 分别手工计算x1(t) 和x2(t) 的傅里叶级数的系数。信号x1(t) 在其主周期内的数学表达式为:t+1 -1t01-t 0t1计算x1(t) 的傅里叶级数的系数的计算过程如下:k = -10:10;ak=0; ak = 1/2.* (sin(k)*pi/2)./(k)*pi/2)N=-10:10; stem(k,ak);通过计算得到的x1(t)的傅里叶级数的系数的数学表达式是:1/2.* (sin(k)*pi/2)./(k)*pi/2)信号x2(t) 在其主周期内的数学表达式为: 1 |t|0.2 0 0.2|t|1计算x2(
29、t) 的傅里叶级数的系数的计算过程如下:k = -10:10;ak=0; ak =sin(k*pi*0.2)./(k*pi)N=-10:10; stem(k,ak);通过计算得到的x1(t)的傅里叶级数的系数的数学表达式是:sin(k*pi*0.2)./(k*pi)用MATLAB帮助你计算出你手工计算的傅里叶级数的系数ak从-10到10共21个系数。从命令窗口上抄写x1(t)的21个系数如下:ak = Columns 1 through 8 0.0000 0.0354 -0.0000 -0.0455 0.0000 0.0637 -0.0000 -0.1061 Columns 9 through 16 0.0000 0.3183 NaN 0.3183 0.0000 -0.1061 -0.0000 0.0637 Columns 17 through 21 0.0000 -0.0455 -0.0000 0.0354 0.0000从命令窗口上抄写x2(t)的21个系数如下:Columns 1 through 8 -0.0000 -0.0208 -0.0378 -0.0432 -0.0312 0.0000 0.0468 0.1
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2