1

I am having some trouble calculating the fourier series of $x(t)=|A\sin(wt)|$. I have thought that the period is $T'=\frac{T}{2}=\frac{\pi}{w}$ so the result that i ended up was $c[n]=\dfrac{-A}{\pi} \dfrac{(-1)^n+1}{(n+1)(n-1)}$ but i thing it's wrong. I tried ploting $x(t)$ using this $c[n]$ in Matlab for $n=25$, $50$ or $100$ but the results were "correct" only when i ploted using plot(A-abs(x)), otherwise there were upside down. Any suggestions?

1 Answers1

0

You messed up some factors of $2$: check the formula for cosine series.

I get the series $$\frac{2|A|}{\pi} -\frac{4|A|}{\pi} \sum_{n\ge 2, \text{ even}} \frac{1}{n^2-1}\cos nwt$$ With $A=1$ and $w=1$, the partial sum computed in Sage with

2/pi+sum([-4/(pi*((2*k)^2-1))*cos(2*k*x) for k in range(1,5)])

matched the function pretty well:

partial

  • why n>2 even must be even? – Bill Skiadas Jun 11 '13 at 13:18
  • @BillSkiadas There is $(-1)^n+1$ in the formula for $c_n$. This is zero when $n$ is odd, and $2$ when $n$ is even. I decided to save the computer the trouble of multiplying things by zero. This is why I replaced $n$ with $2k$ in my Sage command. – ˈjuː.zɚ79365 Jun 11 '13 at 13:22