# Computing Coefficients of Complex Form Fourier Series

I am having some trouble knowing how to correctly start a problem of finding the Fourier Coefficients using complex exponential form. The problem is given below:

$$g_1(t)=\begin{cases} 1,~~\qquad t<1\\2-t,\quad t\ge 1\end{cases}$$

and

$$g_2(t)=\begin{cases} 1+2t, \qquad -0.5<t\le 0.5\\\tfrac{(7-2t)}{3},~~~\,\qquad0.5<t<3.5\\0,~~~\qquad\qquad \mbox{elsewhere}\end{cases}$$

over the interval of $0\le t\le2$.

General complex Fourier series representation is: $g(t)=\displaystyle\sum_{n=-\infty}^{\infty} C_ne^{int}$

I tried using the formula to compute the DC term or zeroth term from the following:

$C_0=\displaystyle\frac{1}{T_0}\int_{<T_0>} x(t)e^{int}\,\mathrm{d}t$, where $n=0$. (zero coefficient, DC term)

The result I get for $g_1(t)$ from this is: $C_0=\displaystyle \frac{1}{2}\int_0^2 1\,\mathrm{d}t+\frac{1}{2}\int_0^2 (2-t)\,\mathrm{d}t=2$, where $T_0$ is the interval in which it runs from $[0,2]$, but not sure if its correct and how to go about setting up for the $C_n$ term.

I have seen different forms of how to compute the coefficients and the general series representation in books, but I do not know which ones to appropriately apply to this problem. The other problem is defining a period for the constant function such as $1$ in the case of $g_1(t)$. Being that this is needed to computer coefficients of the series.

-

First, you need to fix your limits of integration. For $g_1$, you should have
$$C_0 = \frac{1}{2} \int_0^1 dt + \frac{1}{2} \int_1^2 (2-t) dt$$
Second, your definition of $C_n$ (which you cited for the $n=0$ case) isn't quite right. This doesn't effect the $n=0$ case, but for general $C_n$ you should use
$$C_n = \frac{1}{|T|} \int_T g(t) e^{-2\pi i n t/|T|} \, dt$$
where $|T|$ is the length of the interval $T$ over which your function is defined.
Just to add to that, because it can be confusing that people sometimes define T (or L) differently. You can sometimes see it in the form $$C_n = \frac{1}{2T} \int_{-T}^T f(t) e^{-\frac{\pi int}{T}} dt$$ with T being half the period over the functions definition too. – Magpie Aug 8 '12 at 20:54