.
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
12 3 4 5 6
(4)、已知信号x(t)?4?t,(0?t?4),用MATLAB绘出下列信号的波形
1、
x3(t)?x1(t)?x2(t)
>> t=0:0.001:10;
>> x1=(-t+4).*(heaviside(t)-heaviside(t-4)); >> x2=sin(2*pi*t); >>x3=x1+x2; plot(t,x3)
5 4 3 2 1 0 -1 0
1 2 3 4 5 6 7 8 9
10
'.
.
2、x4(t)?x1(t)?x2(t) >> t=0:0.001:10;
>> x1=(-t+4).*(heaviside(t)-heaviside(t-4)); >> x2=sin(2*pi*t); >> x4=x1.*x2; plot(t,x4)
3 2 1 0 -1 -2 -3 -4 0
1 2 3 4 5 6 7 8 9
3、
x5(t)?x1(?t)?x1(t)
syms t;
x1=(4-t)*(heaviside(t)-heaviside(t-4)); x1=(4+t)*(heaviside(-t)-heaviside(t+4)); x5=x1+x2; ezplot(t,x5);
'.