>> x=(1-exp(-0.5*t)).*(heaviside(t)); >> plot(t,x)
1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0
1
2
3
4
5
6
7
8
9
10
2、x(t)?cos(?t)[u(t)?u(t?2)]
>> t=0:0.001:10;
>> x=cos(pi*t).*(heaviside(t)-heaviside(t-2)); >> plot(t,x)
0.8 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -0.8 -1 0
1
2
3
4
5
6
7
8
9
10
3、
x(t)?|t|cos(2?t)[u(t?2)?u(t?2)]2
>> t=0:0.001:10;
>> x=abs(t)/2.*cos(pi*t).*(heaviside(t+2)-heaviside(t-2)); >> plot(t,x)
1 0.8 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 0
1 2 3 4 5 6 7 8 9 10
4、x(t)?e?t|t|sin(2?t)[u(t)?u(t?3)]
2>> t=0:0.001:10;
>> x=exp(-t).*sin(2*pi*t).*(heaviside(t)-heaviside(t-3)); >> plot(t,x)
0.8 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 0
1 2 3 4 5 6 7 8 9 10
(2)、利用MATLAB绘制下列离散时间信号的波形:
1、x(n)?u(n?3) >> x=heaviside(n-3); >>stem(n,x,'filled')
0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 1 2 3 4 5 6 7 8 9 10
nx(n)?(?1/2)u(n) 2、
>> x=(-1/2).^n.*heaviside(n); >> stem(n,x,'filled')
3、x(n)?n[u(n)?u(n?5)] >> x=n.*(heaviside(n)-heaviside(t-5)); >> stem(n,x,'filled')
4 3.5 3 2.5 2 1.5 1 0.5 0 0 1 2 3 4 5 6 7 8 9 10
4、x(n)?sin(n?/2)u(n) >> x=sin(n*pi/2).*heaviside(n); >> stem(n,x,'filled')
0.8 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -0.8 -1 0 1 2 3 4 5 6 7 8 9 10
(3)、利用MATLAB生成并绘制连续周期矩形波信号,要求周期为2,峰值为3,显示三个周期波形。
>> t=0:0.001:6; >> x=square(t*pi).*3; >> plot(t,x)
3 2 1 0 -1 -2 -3 0
1 2 3 4 5
6