Writing it in terms of singularity function would be;
y(t) = 2u(t) - u(t-2) + u(t-4) - r(t-6)
function [y1] = y1(t)
y1 = y1 = 2*(t>=0 & t<2)-1*(t>=2 & t<4)+1*(t>=4 & t<6)+ (2)*(-t/3).*(t>=6 & t<8);
t = -10:0.01:10;
Y1 = y1(t);
For some reason the unit step and ramp signals are always referring to the origin. And my ramp signal starts at -4 which I have no idea why.