Question: Periodic piecewise function trouble

I am trying to define a periodic piecewise function where essentially for every positive integer I have an output of '1' and the output is '0' everywhere else. I want to use this function in defining a Partial Differential Equation as well.

This is how I have been going about it after reading through the answers on similar questions posted before:

f := piecewise(t::posint, 1, 0_otherwise):
p := 1:
fperiodic := eval(f, t = t-p*trunc(t/p)):

But when I plot it to just as a test, I get a dead plot:
plot(fperiodic, t = 0 .. 5)


I am hoping for something like:

Please help!

Please Wait...