Do I subtract the DC component (mean value) from the amplitude in my sine terms?
$f(t)=\left\{ \begin{array}{l l} 0 & \quad -5\le t\leq 0\\ 1 & \quad 0< t\leq 5 \end{array} \right.$
(I'd write it properly, but it won't let me upload pics of my graph due to low rep, nor use bigger than/smaller than operator... hope you understand!)
Period is $10$.
I see the mean value is $\frac{1}{2}$. that will be a term on it's own. I've aquired the $b_n$ term, but it's twice what the solution in my book says it should be.
I set the amplitude of my function to be $1$ ... should it be $\frac{1}{2}$, because I have to account for the DC component?
Form the definition of $a_n$: $$a_n = \frac{1}{\pi}\int_{-\pi}^\pi f(x) \cos(nx)\, dx, \quad n \ge 0$$ or For signals it is easier to use period of the signal ($2\pi=T$): $$a_n = \frac{2}{T}\int_{-\frac{T}{2}}^{\frac{T}{2}} f(x) \cos\left(\frac{2 \pi n x}{T}\right)\, dx, \quad n \ge 0$$ May be you loose the factor $2$ before the integral? Sometimes in some textbooks the answer is given as $\frac{a_n}{2}=\ldots, \quad \frac{b_n}{2}=\ldots$. $$b_n = \frac{2}{T}\int_{-\frac{T}{2}}^{\frac{T}{2}} f(t) \sin\left(\frac{2 \pi n t}{T}\right)\, dt=\frac{2}{T}\int_{-\frac{T}{2}}^{0} f(t) \sin\left(\frac{2 \pi n t}{T}\right)\, dt+\frac{2}{T}\int_{0}^{\frac{T}{2}} f(t) \sin\left(\frac{2 \pi n t}{T}\right)\, dt=\frac{2}{T}\int_{-\frac{T}{2}}^{0} 0 \ \sin\left(\frac{2 \pi n t}{T}\right)\, dt+\frac{2}{T}\int_{0}^{\frac{T}{2}} 1\ \sin\left(\frac{2 \pi n t}{T}\right)\, dt$$
$$b_n=\frac{2}{T}\int_{0}^{\frac{T}{2}} 1\ \sin\left(\frac{2 \pi n t}{T}\right)\, dt=\frac{2}{T}\frac{1}{\frac{2 \pi n}{T}}\left(-\cos\left(\frac{2 \pi n t}{T}\right)\right)\bigg|_0^\frac{T}{2}=\frac{1}{\pi n}\left(1-\cos\left(\pi n\right)\right)$$