当前位置:文档之家› 信号与系统实验一

信号与系统实验一

信号与系统实验报告实验一信号与系统的时域分析学院:信息工程学院班级:2012级电子信息工程三班姓名:学号:2012550711指导老师:苏永新一、实验目的1、熟悉和掌握常用的用于信号与系统时域仿真分析的MATLAB函数;2、掌握连续时间和离散时间信号的MATLAB产生,掌握用周期延拓的方法将一个非周期信号进行周期信号延拓形成一个周期信号的MATLAB编程;3、牢固掌握系统的单位冲激响应的概念,掌握LTI系统的卷积表达式及其物理意义,掌握卷积的计算方法、卷积的基本性质;4、掌握利用MATLAB计算卷积的编程方法,并利用所编写的MATLAB程序验证卷积的常用基本性质;掌握MATLAB描述LTI系统的常用方法及有关函数,并学会利用MATLAB求解LTI系统响应,绘制相应曲线。

基本要求:掌握用MATLAB描述连续时间信号和离散时间信号的方法,能够编写MATLAB 程序,实现各种信号的时域变换和运算,并且以图形的方式再现各种信号的波形。

掌握线性时不变连续系统的时域数学模型用MATLAB描述的方法,掌握卷积运算、线性常系数微分方程的求解编程。

二、实验内容及步骤实验前,必须首先阅读本实验原理,读懂所给出的全部范例程序。

实验开始时,先在计算机上运行这些范例程序,观察所得到的信号的波形图。

并结合范例程序应该完成的工作,进一步分析程序中各个语句的作用,从而真正理解这些程序。

实验前,一定要针对下面的实验项目做好相应的实验准备工作,包括事先编写好相应的实验程序等事项。

Q1-1:修改程序Program1_1,将dt改为0.2,再执行该程序,保存图形,看看所得图形的效果如何?dt = 0.01时的信号波形 dt = 0.2时的信号波形此处粘贴图形此处粘贴图形% Program1_1% This program is used to generate a sinusoidal signal and draw its plot clear, % Clear all variablesclose all, % Close all figure windowsdt = 0.01; % Specify the step of time variablet = -2:dt:2; % Specify the interval of timex = sin(2*pi*t); % Generate the signalplot(t,x) % Open a figure window and draw the plot of x(t) title('Sinusoidal signal x(t)')xlabel('Time t (sec)')这两幅图形有什么区别,哪一幅图形看起来与实际信号波形更像?答:第一幅图较第二幅图更平滑一些,第二幅图在其峰值处显示出的是折线,一点也不平滑。

相比之下,第一幅图更接近实际波形。

Q1-2:修改程序Program1_1,并以Q1_2为文件名存盘,产生实指数信号x(t)=e-0.5t。

要求在图形中加上网格线,并使用函数axis()控制图形的时间范围在0~2秒之间。

然后执行该程序,保存所的图形。

修改Program1_1后得到的程序Q1_2如下:% Program Q1_2% This program is used to generate a sinusoidal signal and draw its plot clear, % Clear all variablesclose all, % Close all figure windowsdt = 0.2; % Specify the step of time variablet = -2:dt:2; % Specify the interval of timex =exp(-0.5*t); % Generate the signalplot(t,x) % Open a figure window and draw the plot of x(t)axis([0 2 0 1])grid on;title('Exponential signal x(t)')xlabel('Time t (sec)')信号x(t)=e-0.5t的波形图Time t (sec)Q1-3:修改程序Program1_1,并以Q1_3为文件名存盘,使之能够仿真从键盘上任意输入的一个连续时间信号,并利用该程序仿真信号x(t)=e-2t。

修改Program1_1后得到的程序Q1_3如下:% Program Q1_3clcclear, % Clear all variablesclose all, % Close all figure windowsdt = 0.01; % Specify the step of time variablet = -2:dt:2; % Specify the interval of timex = input('please input a signal,I’ll draw its plot for you. Signal x='); % Input the signalplot(t,x) % Open a figure window and draw the plot of x(t)xlabel('Time t (sec)')grid on% x =exp(-2*t)信号x(t)=e-2t的波形图Time t (sec)Q1-4:将实验原理中所给的单位冲激信号和单位阶跃信号的函数文件在MATLAB文件编辑器中编写好,并分别以以文件名delta和u存入work文件夹中以便于使用。

抄写函数文件delta如下:function y = delta(t)dt = 0.01;y = (u(t)-u(t-dt))/dt;抄写函数文件u如下:% Unit step functionfunction y = u(t)y = (t>=0); % y = 1 for t > 0, else y = 0Q1-5:修改程序Program1_4,并以Q1_5为文件名存盘,利用axis()函数,将图形窗口的横坐标范围改为-2≤n≤5,纵坐标范围改为-1.5≤ x ≤1.5。

修改Program1_4后得到的程序Q1_5如下:% Program1_4% This program is used to generate a discrete-time sinusoidal signal% and draw its plotclear, % Clear all variablesclose all, % Close all figure windowsn = -5:5; % Specify the interval of timex = [zeros(1,4), 0.1, 1.1, -1.2, 0, 1.3, zeros(1,2)]; % Generate the sequencestem (n,x,'.') % Open a figure window and draw the plot of x[n] grid on,axis([-2,5,-1.5,1.5])title ('A discrete-time sequence x[n]')xlabel ('Time index n')信号的波形图A discrete-time sequence x[n]Time index nQ1-6:仿照前面的示例程序的编写方法,编写一个MATLAB程序,以Q6为文件名存盘,使之能够在同一个图形窗口中的两个子图中分别绘制信号x[n]=0.5|n| 和x(t)=cos(2πt)[u(t)-u(t-3)]。

要求选择的时间窗能够表现出信号的主要部分(或特征)。

编写的程序Q1_6如下:% Program Q1_6% This program is used to implement the time-shift operation% on a continuous-time signal and to obtain its time-shifted versions% and to draw their plots.clear,close all,n=-5:5;x=pow2(-abs(n));dt = 0.01;t = -2:dt:2;x1=cos(2*pi*t).*[u(t)-u(t-3)];subplot(211)plot(n,x) % Plot x(t)grid on,title ('signal x(n)')xlabel ('Time index n')subplot (212)plot (t,x1) % Plot x1grid on,title ('signal x(t)') xlabel ('Time t (sec)')信号x[n]=0.5|n|和信号x(t)=cos(2πt)[u(t)-u(t-3)]的波形图-5-4-3-2-101234500.51signal x(n)Time index n -2-1.5-1-0.500.511.52-1-0.500.51signal x(t)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如下: % Program Q1_7% This program is used to generate a sinusoidal signal and draw its plot clear, % Clear all variablesclose all , % Close all figure windowsdt = 0.01; % Specify the step of time variable t = -5:dt:5; % Specify the interval of time x =exp(-0.2*t).*u(t); % Generate the signal y=exp(-0.5*(1.5*t+3)).*u(1.5*t+3) subplot(211)plot(t,x) % Plot x(t) grid on ,title ('Original signal x(t)') subplot (212)plot (t,y) % Plot x1grid on ,title ('Transform version of y(t)') xlabel ('Time t (sec)')信号x(t)的波形图和信号y(t)=x(1.5t+3) 的波形图-5-4-3-2-101234500.51Original signal x(t)-5-4-3-2-101234500.51Transform version of y(t)Time t (sec)Q1-8:给定一个离散时间信号x[n] = u[n] – u[n-8],仿照示例程序Program1_5,编写程序Q1_8,产生x[n]的左移序列x 1[n] = x[n+6]和右移序列x 2[n] = x[n-6],并在同一个图形窗口的三个子图中分别绘制这三个序列的图形。

相关主题