Hi,
your idea for a smoothed impulse function seems quite close to a good
solution, what about:
x <- seq(-20, 20, 1e-3)
steep <- 20
plot(x, (tanh(steep * (x %% 10 - 8))
- tanh(steep * (x %% 10 - 2)))/2 + 1,
type = "l", col = "red")
thpe