Plot[1-UnitStep[t-1]+UnitStep[t-2],{t,-2,4}]