Find the fourier series of a piecewise continuous function

413 Views Asked by At

Consider the function $f(x) = \begin{cases} 0 & & x \in [-\pi, 0) \\ 1 & & x \in [0, \frac{\pi}{2})\\ 0 & & x \in [\frac{\pi}{2}, \pi)\\ \end{cases}$ Calculate its fourier series

I am unsure if this is correct but i have:

$a_0=\frac{1}{2\pi} \int_{-\pi}^{\pi}f(x)dx=\frac{1}{2\pi} \int_{0}^{\frac{\pi}{2}}1dx=\frac{1}{2\pi}[x]_{0}^{\frac{\pi}{2}}=\frac{1}{4}$

$a_n=\frac{1}{\pi} \int_{-\pi}^{\pi}f(x)\cos(nx)dx=\frac{1}{\pi} \int_{0}^{\frac{\pi}{2}}\cos(nx)dx=\frac{1}{\pi}[\frac{1}{n}\sin(nx)]_{0}^{\frac{\pi}{2}}=\frac{1}{n\pi}$

$b_n=\frac{1}{\pi} \int_{-\pi}^{\pi}f(x)\sin(nx)dx=\frac{1}{\pi} \int_{0}^{\frac{\pi}{2}}\sin(nx)dx=\frac{1}{\pi}[\frac{1}{n}(-\cos(nx))]_{0}^{\frac{\pi}{2}}=\frac{-1}{n\pi}$

So we have $f(x)=\frac{1}{4}+\sum_{n=0}^{\infty}[\frac{1}{n\pi} \cos(nx) - \frac{1}{\pi} \sin(nx)]$

Is this correct?


3

There are 3 best solutions below

0
On

Looks OK to me, although you lost the 1/n term in the sine series.

As long as you can do the integration, you can find the Fourier series of any piecewise continuous function exactly as you have done here.

0
On

The setup is alright but the evaluations are not correct. For example $$ \dfrac{1}{\pi} \int_0^{\pi/2} \sin(nx) \; dx = \dfrac{1 - \cos(n \pi/2)}{n \pi} \neq - \dfrac{1}{n \pi} $$

0
On

It should be $$\\ { a }_{ 0 }=\frac { 1 }{ 2 } \\ { a }_{ n }=\frac { \sin { \left( \frac { \pi n }{ 2 } \right) } }{ n\pi } \\ { b }_{ n }=\frac { 1-\cos { \left( \frac { \pi n }{ 2 } \right) } }{ n\pi } \\ \\ \\ $$