实验目的:利用 MATLAB 实现信号的时域表示以及图形表示
题目一:连续信号的 MATLAB 描述
设计要求:列出单位冲激函数、单位阶跃函数、复指数函数的 MATLAB 表达式。
实验前说明:
1、 Floor(a) 对 a 从负无穷方向取整(结果比原数小)
2、
ceil(a)
对 a 从正无穷方向取整(结果比原数大)
3、
fix(a)
对 a 朝零方向取整(结果的绝对值比原数小)
4、
round(a) 对 a 四舍五入取整
5、
plot(t,real(z)),title('实部')
6、
plot(t,imag(z)),title('虚部')
7、
plot(t,abs(z)),title('模')
8、
plot(t,angle(z)),title('相角')
建模:1、单位冲激函数
(t)无法直接用 MATLAB 描述,可以把它看作是宽
度为
(程序中用 dt 表示),幅度为 1/
的矩形脉冲,即
x1(t)=
(t-t1)= 1/
t1<t<t1+
9
0
其余
表示在 t=t1 处的冲激。
2、单位阶跃函数:在 t=t1 处跃升的阶跃可写为 u(t-t1).定义为
x2(t)= u(t-t1)= 1 t1<t<t1+
0 t<0
3、复指数函数 x3(t)=
e
(u+j
)t
若
=0,它是实指数函数,如 u=0,则为虚指数函数,其实部为余弦函数,虚
部为正弦函数。本例 u=-0.5,
=10.
参考程序:
clear, t0=0;tf=5;dt=0.05;t1=1;
t=[t0:dt:tf]; st=length(t);
n1=floor ((t1-t0)/dt);
x1=zeros(1,st);
10
x1(n1)=1/dt;
subplot(2,2,1),stairs(t,x1),grid on
axis([0,5,0,22])
x2=[zeros(1,n1-1),ones(1,st-n1+1)];
subplot(2,2,3),stairs(t,x2),grid on
axis([0,5,0,1.1])
alpha=-0.5;w=10;x3=exp((alpha+j*w)*t);
subplot(2,2,2),plot(t,real(x3)),grid on
subplot(2,2,4),plot(t,imag(x3)),grid on
题目二:LTI 系统的零输入响应
设计要求:描述 n 阶线性时不变(LTI)连续系统的微分方程为:
a1(d
n
y/dt
n
)+ a2(d
n-1
y/dt)+…+ an(dy/dt)+ (an+1)y= b1(d
m
u/dt
m
)+…+
bm(du/dt)+ (bm+1)u,已知 y 及其各阶导数的初始值为 y(0),y
(1)
(0),…,
y
(n-1)
(0),求系统的零输入响应。
参考程序:a=input('输入分母系数向量 a=[a1,a2......]=');
n=length(a)-1;
Y0=input('输入初始条件向量 Y0=[y0,Dy0,D2y0,....]=');
12
p=roots(a);V=rot90(vander(p));c=V\Y0';
dt=input('dt='); tf=input('tf=')
t=0:dt:tf; y=zeros(1, length(t));
for k=1:n y=y+c(k)*exp(p(k)*t);end
plot(t,y),grid;
hold on
运行此程序并输入:a=[3,5,7,1]; dt=0.2;tf=8;
Y0 取[1,0,0];[0,1,0];[0,0,1],三种情况。