(*SHM with UNIT PULSE Driving Force*)
(*    y''+y = 1-H(t-1)     *)
(*=================================*)
ClearAll["@"]

(*Define the d.e. and initial conditions*)
de=y''[t]+y[t]==(1-UnitStep[t-1]);
ic1=y[0]==0;
ic2=y'[0]==0;

(*Solve and plot*)
ans=FullSimplify[DSolve[{de,ic1,ic2},y[t],t]]
Plot[y[t]/.ans,{t,0,15}]

