Let us define function $$V(t) = \begin{cases}3,& \text{for $0\leq t < 6$}\\ 4,& \text{for $6\leq t < 12$} \\ 3,& \text{for $12\leq t < 18$} \\ 0,& \text{otherwise}. \end{cases}$$
What is the Fourier Series for $V?$
Will the usual formulas i.e $$a_n = \frac{1}{2\pi} \int _{-\pi}^{\pi}V(t)\cos(nt)dt,\quad b_n = \frac{1}{2\pi} \int _{-\pi}^{\pi}V(t)\sin(nt)dt$$ work ?
Any hint will be appreciated.
Yes, they will work if you want to calculate the series on $(-\pi;\pi)$. If you want to calculate it on interval $(0;18)$ things are getting harder. First, you need to extend the function on $(-18;18)$. The simplest way is to define a new function called $U$:
$$U(t)=V(t)+V(t+18)$$
Where $V$ is your function, modified to fulfill Dirichlet's conditions[1]. And then use the formulas
$$a_0=\frac{1}{2l}\int_{-l}^l U(u)du$$ $$a_n=\frac1l\int_{-l}^lU(u)\cos\frac{\pi nu}{l} du, \quad b_n=\frac1l\int_{-l}^lU(u)\sin\frac{\pi nu}{l} du$$
where $l=18$. Of course $b_n=0$ for all $n$ because $U(t)$ is even. You use then the summation
$$a_0+\sum_{n=1}^\infty\left( a_n\cos\frac{\pi n x}{l}+b_n\sin\frac{\pi n x}{l} \right)$$
For example calculating $a_2$ we get:
$$a_2=\frac{1}{18}\int_{-18}^{18}U(u)\cos\frac{2\pi u}{18} du$$ $$=\frac{1}{18}\left( 3I_{-18}^{-12}+ 4I_{-12}^{-6}+ 3I_{-6}^{0} + 3I_{0}^{6}+ 4I_{6}^{12}+ 3I_{12}^{18} \right)$$
where $I_a^b=\int_a^b\cos\frac{\pi u}{9} du$. Mathematica gives the answer $a_2=-\frac{\sqrt 3}{\pi}$. You can see the plot of partial sums. Also, I wrote the following Mathematica code to get $a_n$:
[1] values of the function at points of discontinuity will be equal to an average of one sided limits at this point