Question: Periodic piecewise (peicemeal) function

Hi,

 

I'm trying to make a piecewise function that will have period 12. That is, it repeats every 12 units across the x-axis.

 

I managed to do one cycle successfully with

plot(piecewise(0<=t and t<2, 4,2<=t and t<12,0), t=0..13);

But I'm not sure how to do it periodically. I thought about using modular arithmetic in the conditions and setting up something like

H(t)=piecewise(0<=modp1(f(t),12) and modp1(f(t),12)<2, 4,2<=modp1(f(t),12) and modp1(f(t),12)<12,0);

but this clearly doesn't work.

 

Some direction or advice would be appreciated. Thanks!

 

Please Wait...