I will try it, but don't have a program to check my calculations.
This function is symetrical. So the coeficients [itex]B_n[/itex] are 0. The period is 2D.
[tex]A_n = \frac{2}{D}\int_{0}^{D} cos\left( \frac{n\pi x}{D}\right)y(x)dx = \frac{2h}{D}\int_{D-W/2}^{D} cos\left( \frac{n\pi x}{D}\right)dx = \frac{2h}{D}\left[\frac{D}{n\pi}sin\left( \frac{n\pi x}{D}\right)\right]_{D-W/2}^{D}[/tex]
[tex]A_n = \frac{2h}{n\pi}sin\left( \frac{n\pi W}{2D} - n\pi \right) & n=1,2,...[/tex]
[tex]A_0 = \frac{Wh}{D}[/tex]
[tex]\Rightarrow y(x) = \frac{Wh}{2D} + \frac{2h}{\pi}\sum_{n=1}^{\infty}\frac{1}{n}sin\left( \frac{n\pi W}{2D} - n\pi \right) cos\left( \frac{n\pi x}{D}\right)[/tex]
This makes sense, because the bigest W can be is 2D wide. In this case, the function is y(x) = h, which is correct. (h is the height of the pulse)