Hi there. I have to find the Fourier development for $\displaystyle f(t)=\begin{Bmatrix}{1 }&\mbox{ if }& 0<t<1\\0 & \mbox{if}& 1<t<2\end{matrix}$

So this is what I did, I think its wrong, but I don't know where I did the mistake.

$\displaystyle a_0=\displaystyle\frac{1}{4}\displaystyle\int_{0}^ {1} dt=1/4$

$\displaystyle a_n=\displaystyle\frac{1}{2}\displaystyle\int_{0}^ {1}\cos \left( \displaystyle\frac{n\pi t}{2} \right) dt=\displaystyle\frac{1}{n\pi}\sin \left( \displaystyle\frac{n\pi}{2}\right)$

$\displaystyle b_n=\displaystyle\frac{1}{2}\displaystyle\int_{0}^ {1}\sin \left( \displaystyle\frac{n\pi t}{2} \right) dt=\displaystyle\frac{1}{2}\left[\displaystyle\frac{-2}{n\pi}\cos \left( \displaystyle\frac{n\pi t}{2} \right) \right]_0^1=\displaystyle\frac{-1}{n\pi}\cos \left( \displaystyle\frac{n\pi}{2} \right)+\displaystyle\frac{1}{n\pi}$

Then:

$\displaystyle f(t)\sim{ \displaystyle\frac{1}{4}+ \displaystyle\sum_{n=1}^{\infty} \displaystyle\frac{1}{n\pi} \sin \left( \displaystyle\frac{n\pi}{2}\right) - \displaystyle\sum_{n=1}^{\infty} \left[ \displaystyle\frac{1}{n\pi}\cos\left( \displaystyle\frac{n\pi}{2}\right)-\displaystyle\frac{1}{n\pi}\right]}$

When I plot this on mathematica I get a line. So, I think I've made a mistake somewhere, but I don't know where the error is. Somehow I have to define the zero intervals, I think I should use the heaviside function.

Bye and thanks for 'ur help.

PS:I didn't know where to post this, so move it if it should be in another subforum.