t=0:0.01:3;
ft1=t.*(t>=0 & t<=1);
ft2=t.*(t>=0);
ft3=t.*(t>=0 & t<=1)+(t>=1);
ft4=(t-1).*(t>=1);
ft5=-(t-1).*(t>=0 & t<=1);
ft6=t.*(t>=2 & t<=3);
ft7=(t-2).*(t>=2 & t<=3);
>> subplot(241),plot(t,ft1),title('t[u(t)-u(t-1)]');
>> subplot(242),plot(t,ft2),title('tu(t-1)');
>> ft3=t.*(t>=0 & t<=1)+(t>1);
>> subplot(243),plot(t,ft3),title('t[u(t)-u(t-1)]+u(t-1)');
>> axis([0 6 0 2]);
>> subplot(244),plot(t,ft4),title('(t-1)u(t)');
>> axis([0 6 -1 2]);
>> subplot(245),plot(t,ft5),title('-(t-1)[u(t)-u(t-1)]');
>> subplot(246),plot(t,ft6),title('t[u(t-2)-u(t-3)]');
>> subplot(247),plot(t,ft7),title('(t-2)[u(t-2)-u(t-3)]');
syms tao;
>> t=sym('t','positive');
>> xt1=sym('heaviside(t)-heaviside(t-1)');
>> xt_tao=subs(xt1,t,tao)*subs(xt1,t,t-tao);
>> yt=int(xt_tao,tao,0,t);
>> yt=simplify(yt);
>> ezplot(yt,[0,2]);grid on
f(t)=u(t)-u(t-1),求s(t)=f(t)*f(t):
t=0:dt:3;
f=(t>=1)-(t>=2);
f1=conv(f,f)*dt;
n=length(f1);
tt=(0:n-1)*dt+2;
subplot(121),plot(t,f),grid on
title('f(t)=u(t-1)-u(t-2)')
subplot(122),plot(tt,f1),grid on
title('s(t)=f(t)*f(t)')
dt=0.01;
t=-6:dt:6;
f1=(t>=-1)-(t>=1);
f2=(t==-5)+(t==5);
f3=(t==-1/2)+(t==1/2);
st1=conv(f1,f2);
st11=(t>=-6)-(t>=-4)+(t>=4)-(t>=6);
st2=conv(stt,f2);
st=(t>=-5)-(t>=-4)+(t>=4)-(t>=5);
st3=conv(st,f2);
st4=conv(f1,f3);
n1=length(st1);
n2=length(st2);
n3=length(st3);
n4=length(st4);
t1=(0:n1-1)*dt-12;
t2=(0:n2-1)*dt-12;
t3=(0:n3-1)*dt-12;
t4=(0:n4-1)*dt-12;
subplot(221),plot(t1,st1),axis([-7 7 0 3]),title('s(t)=f1(t)*f2(t)')
subplot(222),plot(t2,st2),axis([-12 12 0 3]),title('s(t)=f1(t)*f2(t)*f2(t)')
subplot(223),plot(t3,st3),axis([-12 12 0 3]),title('s(t)=f(t)*f(t)')
subplot(224),plot(t4,st4),axis([-1 1 0 3]),title('s(t)=f1(t)*f3(t)')