I am modelling a series of gratings and something seems amiss that I can not pinpoint. The problem that I am having is that the convolution of the gratings results in something that alternates into the negatives, which is non-sensical in this setting. So let me show my work so far.
We define the train pulse with a period $p$, duty cycle $\kappa$, upper level $1$, and lower level $\tau$ according to
\begin{align}
T_\kappa^\tau(x) = 1~when~|x|<\frac{b}{2},~ \\
T_\kappa^\tau(x) = \tau~when~\frac{p}{2}\geq x\geq\frac{b}{2},~ \\
T_\kappa^\tau(x+np) = T_\kappa^\tau(x),
\end{align}
where $n$ is an integer and $\kappa = \frac{b}{p}$ where $b$ is the pulse width and $p$ is the period, thus making $\kappa$ the duty cycle.
Since this is an even function, we can use the Fourier series for an even function and set the coefficients to
\begin{align}
a_0 &= \dfrac{1}{p}\int_{-\frac{p}{2}}^\frac{p}{2}T_\kappa^\tau(x)dx = \dfrac{2}{p}\left[\int_{0}^{\frac{\kappa p}{2}} 1 dx + \int_{\frac{\kappa p}{2}}^{\frac{p}{2}}\tau dx\right] = \dfrac{2}{p}\left[\dfrac{\kappa p}{2} + \tau\left(\dfrac{p}{2}-\dfrac{\kappa p }{2}\right)\right] = \kappa+ \tau(1-\kappa)
\end{align}
and (directly using even function property of integrating from 0)
\begin{align}
a_n &= \dfrac{4}{p}\left[\int_{0}^{\frac{\kappa p}{2}} \cos(n\omega x) dx + \int_{\frac{\kappa p}{2}}^{\frac{p}{2}}\tau\cos(n\omega x) dx\right] = \dfrac{2}{n\pi}\left[(1-\tau)\sin(n\pi\kappa)+\sin(n\pi)\right] = ... = 2\kappa(1-\tau)\text{sinc}_\pi(n\kappa)
\end{align}
where $ \text{sinc}_\pi(n\kappa) = \frac{\sin(n\pi\kappa)}{n\pi\kappa} $, and where I've used that $ \sin(n\pi) = 0$ for all integer $ n $.
This leaves us with the Fourier series \begin{align} T_\kappa^\tau (x) = a_0 + \sum_{n=1}^\infty a_n\cos\left(n\frac{2\pi}{p}x\right) = \kappa+ \tau(1-\kappa) + 2\kappa(1-\tau)\sum_{n=1}^\infty\text{sinc}_\pi(n\kappa)\cos\left(n\frac{2\pi}{p}x\right). \end{align}
From the convolution theorem we can show that the convolution of two functions over x becomes the product in Fourier space. Given that we have two rectangular pulse trains with parameters ($\kappa_1$,$\tau_1$) and ($\kappa_2$,$\tau_2$) respectively and both with the same period, the convolution theorem then leads me to the function \begin{align} \tilde{T}(x) = c_0 + \sum_{n=1}^\infty c_n \cos\left(n\frac{2\pi}{p}x\right) + \sum_{n=-1}^{-\infty} c_n \cos\left(n\frac{2\pi}{p}x\right) \end{align} where \begin{align} c_0 = (\kappa_1+ \tau_1(1-\kappa_1))(\kappa_2+ \tau_2(1-\kappa_2)) \end{align}
and
\begin{align} c_n = \kappa_1(1-\tau_1)\kappa_2(1-\tau_2)sinc_\pi(n\kappa_1)sinc_\pi(n\kappa_2). \end{align}
This function should become triangular periodic function with maximum value of 1 and a minimum value of 0 given that $\tau_1 = \tau_2 = 0$ and $\kappa_1 = \kappa_2 = 0.5$. However, the function I have derived is a triangular function going from 0 to 0.5, no matter how many terms in the sum I include. So there is a factor of 2 for the whole function missing.
So somewhere I seem to have made a mistake, but I can't for my life find it.
Is there something I have missed in the derivation, is there something wrong with my intuition of what to expect, or something else?
I seems as if I had the correct formula, the maximum of the convolution seems to become 0.5. I realised that the maximum of the convolution would be realised when the rectangular parts are fully overlapping. At this value of x, the integral takes the form $$ \frac{1}{p}\int_{-\frac{-\kappa p}{2}}^{\frac{-\kappa p}{2}}d\tau = \kappa. $$ The more general case for rectangular functions with equal periods with heights $A$ and $B$ would produce the height $AB\kappa$ where $\kappa$ is the duty cycle of the "thinner" rectangle.
One can make this more general, but I don't want to right now.