Overlap of two periodic step functions

256 Views Asked by At

Say I have two periodic step functions with different periods ($T_n$) where the second is at an offset $\phi$ from the first one. That is, taking $t>0$ we can write the two functions as : $$f(t) = \begin{cases} 1, & t < \frac{T_1}{2} \\ -1, & \frac{T_1}{2} < t < T_1 \end{cases}$$ repeated every $T_1$ and: $$g(t) = \begin{cases} 1, & \phi < t < \phi + \frac{T_2}{2} \\ -1, & t \in [0, \phi] \cup[\phi + \frac{T_2}{2}, T_2]\end{cases}$$ repeated every $T_2$ where we can take $\phi < T_2$. What I want to know is how to find a general expression (in terms of $T_1$, $T_2$, and $\phi$) for the average "overlap" percentage of the two functions where I am taking the term overlap to mean intervals where: $$f(t) = g(t)$$ So if we define an overlap function: $$h(t) = \begin{cases} 1, & f(t) = g(t) \\ 0, & \mbox{else} \end{cases}$$ I want to know what the value of: $$x = \frac{\int_0^a h(t) \,dt}{a}$$ converges to for large $a$.

So far all I really can think of is that the lcm of the two periods is important since if we define the lcm of the two periods to be $T$: $$T = \mbox{lcm}(T_1, T_2)$$ then the overlap in the interval: $$t\in [kT, (k+1)T]$$ for any $k\in \mathbb{N}$ should be equal. That is, we should expect that $h(t)$ is periodic with period T. Hence the quantity $x$ should converge to: $$\frac{\int_0^Th(t)\,dt}{T}$$ However, I get stuck with how to calculate the overlap in one interval, $\int_0^Th(t)\,dt$, in the general case.