# Fourier Series of a piecewise function

I've been given the task to find the Fourier Series Representation. All I'm given is this $$x(t)= \begin{cases}-t & \text { for } 0 \leq t<1 \\ 1 & \text { for } 1 \leq t<2 \\ 0 & \text { for } 2 \leq t<4\end{cases}$$ and I have no idea as to how to go about it. In the lectures we were shown $$x(t)=\sum_{k=-\infty}^{+\infty} a_{k} e^{j k \omega_{0} t}$$ and $$a_{k}=\frac{1}{T} \int_{T} x(t) e^{-j k \omega_{0} t} d t$$ but I simply do not understand what they mean or how to use them on the given $$x(t)$$. My confusion mainly comes from the fact that I need $$x(t)$$ in the calculation of $$a_k$$, but I don't see how that's possible with the given. I might also be on the entirely wrong track. Please help me.

EDIT: The period is given as $$T=4$$. Pardon for the exclusion.

• This problem seems incomplete. What is $x(t)$ outside the interval [0,4] ? Is it zero or is there periodic repetition? The use of the Fourier Series would imply that it is periodic but that should be stated somewhere explicitly. Step 1: draw x(t) on a piece of paper. Jan 10 at 14:16
• @Hilmar I believe the Fourier Series can also be applied to any time limited analytic function such as from $0$ to $T$, and then implied periodic over that interval if you extend beyond that. Basically saying if we have a function defined from $0$ to $T$, we can use the FSE to describe that function over that interval as an infinite sum of sines and cosines over that same interval. Jan 10 at 14:42

If you have a piecewise function, you need to separate the integral over that function into the same number of (sub-)intervals:

\begin{align}\int_0^4x(t)e^{-jk\omega_0t}dt&=\int_0^1x(t)e^{-jk\omega_0t}dt+\int_1^2x(t)e^{-jk\omega_0t}dt+\int_2^4x(t)e^{-jk\omega_0t}dt\\&=\int_0^1(-t)e^{-jk\omega_0t}dt+\int_1^2e^{-jk\omega_0t}dt\end{align}

with $$\omega_0=2\pi/T=\pi/2$$.

I trust that you can take it from here.

• and importantly $\omega_0$ is given by the total time duration as $\omega_0 = 1/(2\pi 4)$ Jan 10 at 14:48
• @DanBoschen: Thanks for the addition, I'll add it to my answer. But it should be $\omega_0=2\pi /T=2\pi /4=\pi/2$. Jan 10 at 14:59
• yes - of course! (I figured that might have been the sticking point) Jan 10 at 15:14
• I really wish I could take it from there, but I won't pester you lot with more of my stupidity. Thanks for the answer though
– ian
Jan 10 at 17:12
• @ian: So what exactly is the problem? You don't know how to integrate those functions? Jan 10 at 17:48