This might be helpful

Heaviside step function - MATLAB

Think of using

heaviside(something) to be zero for time < 5 and one for time > 5

times

sin(somethingelse) to have one cycle for 5 <time< 10

times

(1-heaviside(somethingelseelse)) to be one for time < 10 and zero for time > 10