Finding a function with Fourier expansion

79 Views Asked by At

I have to find the function for a sawtooth wave form, and using that the line has these conditions:

$$ f(x)= \left\{ \begin{array}{rcr} x & 0\leq x \leq 1 \\ x-0.5 & 1 \leq x \leq 2 \\ x -1 & 2 \leq x \leq 3 \\ \end{array} \right. $$ After $x=3$ the function just repeats itself. I compute the integrals for the coefficients $a_n$ and $b_n$ and get the following for the full Fourier expansion. $$F(x)=\frac{a_0}{2}+\sum_{n=1}^\infty \frac{(0.5n\sin(2n)+0.5n\sin(n)+2n\sin(3n)+\cos(3n)-1)\cos(nx)+(\sin(3n)-0.5n\cos(2n)-0.5n\cos(n)-2n\cos(3n))\sin(nx)}{n^2}$$

when I plot this I get the following function: enter image description here

Why doesn't the function repeat after $x=3$? My function also seems quite complicated, is it possible theres a simpler method?

1

There are 1 best solutions below

0
On BEST ANSWER

So I solved my problem with the help of 'Semiclassical' in the comments and I get the correct periodic function now when I plot it. My mistake was using a $2\pi$ periodic function instead of a $3$-periodic function. To solve this I only had to add $2\pi$ to the sine and cosine in the Fourier expansion. The correct form of the series for my case was:

$$ f(x)=C+\sum_{n=1}^{\infty }\left( a_{n}\cos \frac{2{\pi}nx}{T}+b_{n}\sin \frac{2{\pi}nx}{T}\right), \tag{1} $$

and the Integrals for the coefficients had the same change to the cosine and sine: $$ a_{n} =\frac{1}{\pi }\int_{-\pi }^{\pi }f(x)\cos \left(\frac{2{\pi}nx}{T}\right) $$

the same applies to $b_{n}$ and $a_{0}$.