syms t;
f=(t+1).*(t+1>=0)-2.*(t-1>=0)-(t-1).*(t-3>=0);
f1=subs(f,t,t+2);
f2=subs(f1,t,2*t);
f=@(x)subs(f,t,x);
f1=@(x)subs(f1,t,x);
f2=@(x)subs(f2,t,x);
subplot(3,1,1),fplot(f,[-8,8]);grid on
subplot(3,1,2),fplot(f1,[-8,8]);grid on
subplot(3,1,3),fplot(f2,[-8,8]);grid on