Fourier coefficients of a triangle function

277 Views Asked by At

I'm trying to find the Fourier coefficients ($c_n$), of the following function :

for $x$ in $[-\pi/2;\pi/2[$ $f(x)=x$

for $x$ in $[\pi/2;3\pi/2[$ $f(x)=\pi-x$

I think its not that hard, but I keep having different solutions and none of them match with my friend responses. A clear solution would be much appreciated.

1

There are 1 best solutions below

2
On BEST ANSWER

Don't mix up $x's$ and $t's$. $f(x) = x$, and $f(x) = \pi-x.$

$f(x)$ is an odd function. We only are going to need sin terms.

$\int_{-\pi/2}^{\pi/2} x \sin nx \,dx\\ = (-1/n) \cos nx + (1/n^2) sin nx |_{-pi/2}^{pi/2}$

$\cos n\pi/2 - \cos -n\pi/2 = 0$

if n is even, $\sin n\pi/2 - \sin(-n\pi/2) = 0$

If $n \equiv 1 (mod4), (1/n^2)(\sin n\pi/2 - \sin(-n\pi/2)) = (2/n^2)$

if $n \equiv 3 (mod4), (1/n^2)(\sin n\pi/2 - \sin(-n\pi/2))=(-2/n^2)$

$\int_{\pi/2}^{3\pi/2} (\pi-x) \sin nx \,dx$

$(-\pi/n)\cos nx + (1/n)\cos nx - (1/n^2) sin nx |_{pi/2}^{3pi/2}$

If $n \equiv 1 (mod4), (1/n^2)(\sin n\pi/2 - \sin(-n\pi/2)) = (2/n^2)$

if $n \equiv 3 (mod4), (1/n^2)(\sin n\pi/2 - \sin(-n\pi/2))=(-2/n^2)$

$f(x) = \frac{4}{\pi}\sum_0^\infty \dfrac{(-1)^n \sin ((2n+1)x)}{(2n+1)^2}$