1、利用MATLAB的向量表示法绘制下列连续信号的时域波形。
(1) x1(t) = u(t + 2) - u(t - 3)
(2) x2(t) = cos(2πt + π/3)
(3) x3(t) = (2exp(-t) - exp(-2t))u(t -1)
(4) x4(t) = (0.2t - 2)u(t)
解: 建立阶跃函数文件Ustep.m,
则Ustep.m文件内容为:
function f = Ustep(t)
f = (t > 0); %若t > 0,则阶跃函数为1
(1) t = -5:0.01:5;
x1 = Ustep(t + 2) - Ustep(t - 3);
plot(t,x1);
axis([-5,5,-5,5]);
(2) t = -3:0.1:3;
x2 = cos(2*pi*t + pi/3);
plot(t,x2);
(3) t = 0:0.01:10;
x3 = (2*exp(-t) - exp(-2*t)) .* Ustep(t - 1);
plot(t,x3);
(4) t = -3:0.01:3;
x4 = (0.2*t - 2) .* Ustep(t);
plot(t,x4);
axis([-3,3,-2,2]);
2、利用MATLAB的符号运算功能绘制上题连续信号的时域波形。
解: 建立阶跃函数文件Ustep.m,
则Ustep.m文件内容为:
function f = Ustep(t)
f = (t > 0); %若t > 0,则阶跃函数为1
(1) syms t;
x1 = sym('Ustep(t + 2) - Ustep(t - 3)');
ezplot(x1,-3,4);
(2) syms t;
x2 = sym('cos(2*pi*t + pi/3)');
ezplot(t,x2,[-3,3]);
(3) syms t;
x3 = sym('(2*exp(-t) - exp(-2*t)) * Ustep(t - 1)');
ezplot(x3,[0,10,0,0.7],1);
(4) syms t;
x4 = sym('(0.2 * t - 2) * Ustep(t)');
ezplot(x4,[-3,3,-2,2],1);
3、已知x(t) = Sa(t),试用MATLAB编程绘制下列信号的时域波形。
(1) x1(t) = x(2 - 2t)
(2) x2(t) = x(2t + 2)
(3) x3(t) = x(0.5t - 1)
(4) x4(t) = x(1 - 0.5t)
解: 建立阶跃函数文件Ustep.m,
则Ustep.m文件内容为:
function f = Ustep(t)
f = (t > 0); %若t > 0,则阶跃函数为1
(1) syms t;
x1 = sym('sinc(2 - 2*t)');
ezplot(x1,[-2,3,-2,2],1);
(2) syms t;
x2 = sym('sinc(2*t + 2)');
ezplot(x1,[-2,3,-2,2],1);
(3) syms t;
x3 = sym('sinc(0.5*t - 1)');
ezplot(x3,[-10,10,-2,2],1);
(4) syms t;
x4 = sym('sinc(1 - 0.5*t)');
ezplot(x4,[-10,10,-2,2],1);