Fourier series of this aperiodic piecewise function

240 Views Asked by At

I am trying to get Fourier sine series for $$ f(x) = \left\{ \begin{array}{lr} 3 & : 0\le x\le 6\\ 3-x & : 6\le x \le 9 \end{array} \right. $$

So far I know that the function is aperiodic, therefore I would have to construct what is called a "odd helper function" (at least in my native language), so that the helper function $$\varphi(x)=\left\{ \begin{array}{lr} f(x) &, if \quad x\in[0;l]\\ -f(-x) &, if \quad x\in[-l;0] \end{array} \right.$$ ,where $l=9$.

So my $\varphi(x)$ would look like: $$\varphi(x)=\left\{ \begin{array}{lr} 3 &, if \quad x\in[0;6]\\ 3-x&, if \quad x\in[6;9]\\ -3 &, if \quad x\in[-6;0]\\ -3-x &, if \quad x\in[-9;-6] \end{array} \right.$$ Then I assume that I need to evaluate $$b_n=\frac{2}{l}*\int_0^l{\varphi(x)*\sin{\frac{n*\pi*x}{l}}dx}$$ And the Fourier series would be $$f(x)=\sum_{n=1}^{\infty}{b_n \cdot \sin{\frac{n\cdot\pi\cdot x}{l}}}$$ But when I try to plot this sum up to $n=5$, this does not look anything like my initial piecewise function. What am I doing wrong?

1

There are 1 best solutions below

4
On BEST ANSWER

Original answer

You need to integrate from $-l$ to $l$ when calculating $b_n$ in order to cover the complete "helper function". Also, when expanding the integration interval, the $2$ in the nominator should be changed to $1$.

$$b_n=\frac{1}{l}\int_{\color{red}{-l}}^l{\varphi(x)\sin{\frac{n\pi x}{l}}dx}$$


Edit in response to original poster's own answer

I deleted the above because I realized that this is the same expression as you have for $b_n$ in the question. This is true since $\varphi(x)$ is odd:

$$\begin{align} b_n&=\frac1l\int_l^lf(x)\;\mathrm dx\\ &=\frac1l\int_{-l}^0f(x)\;\mathrm dx+\frac1l\int_0^lf(x)\;\mathrm dx\\ &=\frac1l\int_{0}^{l}-f(-x)\;\mathrm dx+\frac1l\int_0^lf(x)\;\mathrm dx\\ &=\{\text{ f is odd }\}\\ &=\frac2l\int_0^lf(x)\;\mathrm dx \end{align}$$

And since $f(x)=\varphi(x)\sin\frac{n\pi x}{l}$ is indeed odd, your expression for $b_n$ in the question should be ok. You might have made an error calculating the $b_n$ using this expression.