文档介绍:实验一信号的可视化实验
[实验目的]
1. 掌握用Matlab实现时间信号的表示及可视化的方法,理解信号的时域运算、时域变换及MATLAB实现。
。
[实验内容]
。
①阶跃函数:,指数函数:
②单位抽样序列: ,单位阶跃序列:
,用 Matlab绘出满足下列要求的信号波形,并指明变换的实质。
① ②
③ ④
,绘制满足下列要求的信号波形。
①②③④
[仿真程序]
%习题一(1)
%阶跃函数,定义有不同的方法
syms t;
hanshu=sym('jieyue(t)');
figure(2);
subplot(1,2,1);
ezplot(hanshu,[-5,5]);
%还可以用数值进行绘图
t=-5::5;
hanshu=(t>0);
subplot(1,2,2);
stairs(t,hanshu); %说明:stairs指令用于绘制不连续的阶梯信号
axis([-5,5,-,]);
title('阶跃函数');
%习题一(2)
%单边指数信号
syms t;
zhishu=exp(-t);
figure(3);
ezplot(zhishu,[0,5]); %还可以用数值进行绘图,这里从略
%习题一(3,4)
%单位抽样序列,单位阶跃序列
n1=input('输入序列的起点n1='); % 以交互方式输入序列的起点n1
n2=input('输入序列的终点n2='); % 以交互方式输入序列的终点n2
n=n1:n2;k=length(n); % 确定n向量及其元素的个数
x1=zeros(1,k);x1(1,-n1+1)=1; % 实现单位样值序列
figure(4);
subplot(1,2,1);stem(n,x1,'filled') % 绘制单位样值序列的图形
x2=zeros(1,k);x2(1,-n1+1:n2-n1+1)=1; % 实现单位阶跃序列
subplot(1,2,2);stem(n,x2,'filled') % 绘制单位阶跃序列的图形
%习题二
syms t;
xinhao=sym('xiti5(t)'); %定义信号,先用函数描述了信号
figure(5);
subplot(2,3,1);
ezplot(xinhao);
axis([-2,5,-,]);
line([-2 5],[0 0]);
title('输入信号');
xinhao2=subs(xinhao,t,t-2); %信号的移位
subplot(2,3,2);
ezplot(xinhao2);
axis([-2,5,-,]);
line([-2 5],[0 0]);
title('信号移位');
xinhao3=subs(xinhao,t,-t); %信号的反转
subplot(2,3,3);
ezplot(xinhao3);
axis([-2,5,-,]);
line([-2 5],[0 0]);
title('信号反转');
xinhao4=subs(xinhao,t,1-2*t); %信号的综合变换
subplot(2,3,4);
ezplot(xinhao4);
axis([-2,5,-,]);
line([-2 5],[0 0]);
title('');
xinhao5=subs(xinhao,t,t/2+1); %信号的综合变换
subplot(2,3,5);
ezplot(xinhao5);
axis([-2,5,-,]);
line([-2 5],[0 0]);
title('');
%习题三
n=0:8;
x=[0 1 2 -1 -2 1 3 4 4];
figure(6);subplot(2,3,1); % 序列x[n]
stem(n,x,'filled');axis([-8,18,-3,5]);title('x[n]');
n0=input('请输入移位量n0=');
n1=n+n0;
x1=x;
subplot(2,3,2); % x[n-2]
stem(n1,x1,'filled');axis([-8,18,-3,5]);title('x[n-2]')
n2=-fliplr(n);
x2=fliplr(x);
su