4. Compute the coefficients $ a_k $ of the Fourier series of the signal $ x(t) $ periodic with period $ T=4 $ defined by
$ \,x(t)=\left\{\begin{array}{cc} 0, & -2<t<-1 \\ 1, & -1\leq t\leq 1 \\ 0, & 1<t\leq 2 \end{array} \right. \, $
(Simplify your answer as much as possible.)
Answer
$ \,a_k=\frac{1}{4}\int_{-2}^{2}x(t)e^{-jk\frac{\pi}{2}t}\,dt\, $
$ \,a_k=\frac{1}{4}\int_{-1}^{1}e^{-jk\frac{\pi}{2}t}\,dt\, $
$ \,a_k=\frac{1}{4}\left. \frac{1}{-jk\frac{\pi}{2}}e^{-jk\frac{\pi}{2}t}\right|_{-1}^{1}\, $
$ \,a_k=\frac{-1}{jk2\pi}(e^{-jk\frac{\pi}{2}} - e^{jk\frac{\pi}{2}})\, $
$ \,a_k=\frac{1}{k\pi}(\frac{e^{jk\frac{\pi}{2}} - e^{-jk\frac{\pi}{2}}}{2j})\, $
$ \,a_k=\frac{1}{k\pi}\sin(k\frac{\pi}{2})\, $
Since this is undefined at $ k=0 $ (we get $ a_0=\frac{0}{0} $), we must determine this separately. However, this is simply the average of the function over one period.
$ \,a_0=\frac{1}{4}\int_{-2}^{2}x(t)\,dt\, $
$ \,a_0=\frac{1}{4}2\, $
$ \,a_0=\frac{1}{2}\, $