How to calculate this fourier series?

227 Views Asked by At

So I've been asked to find the fourier series of the following function: enter image description here

The method I use is explained in this old post: Express in terms of Legendre polynomials (Method 2 in the top answer)

How does the method used here differ when f(x) is set out like it is in my question and how does the "f(x+4)) = f(x)" affect my working out/answer? Or is there a completely new method I should use to tackle a function set out like this?

Thanks in advance

1

There are 1 best solutions below

3
On BEST ANSWER

Your are over-complicating things. The fact that $f(x+4)=f(x)$ only implies that your fuction is $4$-periodic, and thus through a transformation of the variable

$$x\leftrightarrow \frac{2 x}{\pi}$$

you could consider the $2\pi$-periodic, piece-wise continuous function

$$g(x) = f\left(\frac{2 x}{\pi}\right),\quad x\in [-\pi,\pi]$$

on which you can apply the usual methods to calculate the Fourier coefficients. Note, of course, that the integrals should be split in two, given that $f$ is defined piece-wise.

Further explanation

The logic behind this variable transformation is that, for a $T$-periodic function defined on $[-\frac{T}{2}, \frac{T}{2}]$, you are looking for a $k$ satisfying $k \pi = \frac{T}{2}$ (so at $x = \pi$ you get $k x = \frac{T}{2}$). In your case $\frac{T}{2} = 2$ so $k = \frac{2}{\pi}$.

If your $n$th Fourier coefficient for a $2\pi$-periodic function $f$ is given by

$$c_n = \frac{1}{2\pi}\int_{-\pi}^\pi f(x)e^{-i n x} dx$$

then you can calculate it too for you $T$-periodic function $f$ thanks to the previous variable transformation and applying the corresponding change of variables to the integral:

$$c_n = \frac{1}{2\pi}\int_{-\pi}^\pi f\left(\frac{T}{2\pi}x\right)e^{-i n x} dx = \frac{1}{T}\int_{-T/2}^{T/2} f\left(s\right)e^{-i n s (2 \pi / T)} ds$$

where the change of variables was $\frac{T}{2 \pi} x \equiv s$. If it is not clear for you why we had to perform the transformation $x\leftrightarrow \frac{2 x}{\pi}$, think about the fact that the Fourier coefficient is calculated as an integral from $-\pi$ to $\pi$ for a function whose period, in your case, is defined on $[-2,2]$, so we need to "tweak" our function for it to be periodic over $[-\pi, \pi]$.