rect=@(t) (abs(t)<=0.5);
tri=@(t) max(1-abs(t),0);
f=@(t) 2.0.*rect((t-3)/2).*tri((t-6)/4);
figure;
fplot(f,[-2,10], 'LineWidth', 1.5');
grid on;
xlabel('t');
ylabel('x(t)');
title('Plot of x(t)');
