1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Fourier series of a waveform

  1. Aug 16, 2014 #1
    1. The problem statement, all variables and given/known data

    Sketch the waveform and develop its Fourier series.

    f(\omega t)=
    0 & if & 0 \leq \omega t \leq \frac{π}{2} \\
    V*sin(\omega t) & if & \frac{π}{2} \leq \omega t \leq π\\
    0 & if & π \leq \omega t \leq \frac{3π}{2} \\
    V*sin(\omega t) & if & \frac{3π}{2} \leq \omega t \leq 2π

    2. Relevant equations

    3. The attempt at a solution

    I drew two sketches, please see attachment, I'm wondering which one is correct.

    Calculating coefficients with V=1 just to see what the F.S. should look like, I've got:
    [itex] a_0=0 [/itex]
    [itex] a_n=\frac{1}{π}\left(\frac{2*sin\frac{nπ}{2}(-n+sin\frac{nπ}{2})}{-1+n^2} \right) [/itex]

    [itex] b_n=0 [/itex]

    Now, if a0=0 that implies that the first sketch is correct. If bn=0 that means the function is even, well, none of my sketches is an even function, something is definitely wrong here. Also, I found even harmonics zero, so [itex] f(\omega t)=f(\omega t+π) [/itex] which is true for the second sketch.

    What did I do wrong? Thank you for looking into that.

    Attached Files:

    Last edited: Aug 16, 2014
  2. jcsd
  3. Aug 17, 2014 #2
    If you just sketched [itex]\sin(x)[/itex], where [itex]0 \le x \le 2\pi[/itex], and superimposed it on your graphs, then which one is a match?
  4. Aug 17, 2014 #3
    The first one. That means bn can't be zero since this is not an even function, also it has half-wave symmetry, so [itex] f(\omega t)=-f(\omega t+π) [/itex], my an calculation is wrong, so is bn.
  5. Aug 17, 2014 #4
    At least a0=0 for sure.
  6. Aug 17, 2014 #5
    Right. But the periodic extension of that graph is neither an even or odd function.
  7. Aug 17, 2014 #6
    Exactly. The fourier series must consist of both sine and cosine terms (i.e. an=something, bn=something), but with only odd harmonics.
  8. Aug 17, 2014 #7
    Let me just go back to this:
    [STRIKE]It's true that an even function only has cosine terms in its Fourier expansion, but the converse statement isn't necessarily true, i.e. the Fourier expansion of a function can consist only of cosine terms without the function being even.[/STRIKE]

    You just had an error in your Fourier coefficients. See below.
    Last edited: Aug 17, 2014
  9. Aug 17, 2014 #8


    User Avatar
    Science Advisor

    Are you talking about functions which are even "almost everywhere"? I can't recall any "physical" functions which are odd but have only nonzero cosine terms, but I'd love to be reminded of an example.
  10. Aug 17, 2014 #9
    [STRIKE]Your Fourier coefficients look correct btw. So good job :thumbs:[/STRIKE]
    Last edited: Aug 17, 2014
  11. Aug 17, 2014 #10
    An odd function has only sine terms in its Fourier expansion, we can definitely agree on that :smile:

    What I'm saying is that, if a function is odd, then that implies it only has sine terms in its Fourier expansion. That kind of statement is of the type:
    p \Rightarrow q \qquad (1)
    If (1) is always true, then that doesn't necessarily mean that:
    q \Rightarrow p
    is always true.

    [STRIKE]The piecewise function included in the OP is an example of this.[/STRIKE]
    Last edited: Aug 17, 2014
  12. Aug 17, 2014 #11


    User Avatar

    Staff: Mentor

    Hmm. My own tinkering with the problem would indicate that there is a non-zero ##b_0##, and the ##a_n## expression for n ≠ 0 looks suspicious to me. This is assuming that we're looking at the expressions in the first post.

    Hint: You may need to use limits and L'Hopital to evaluate the coefficients when n = 1.

    EDIT: That should be ##b_1## above, not ##b_0##; Of course there's no 0-term for the b's.
    Last edited: Aug 17, 2014
  13. Aug 17, 2014 #12
    Doh, you're absolutely right. ##b_1## is non-zero. I can't find a problem with the expression for ##a_n## though or that ##b_0 \neq 0##.

    Edit: I'm not entirely sure why you're considering ##b_0##.
    Last edited: Aug 17, 2014
  14. Aug 17, 2014 #13
    Well, I've certainly put my foot in my mouth this time. I was racking my brain trying to find an example of how you could have only cosine terms in the Fourier series and for it not to be an even function.

    Then I remembered that I'm an idiot and the sum of two even functions is even. Apologies to the OP and olivermsun.
    Last edited: Aug 17, 2014
  15. Aug 17, 2014 #14


    User Avatar

    Staff: Mentor

    Besides not matching what I derived myself, if I set the ##a_n## terms as given above and generate and plot f(x) it doesn't resemble the specified function at all. If I use my own derived terms I get a satisfying match to the function.

    That was just me typing faster than I was thinking :redface:

    Of course there's no ##b_0##. It's ##b_1## that's nonzero. I apologize for any confusion I may have stirred up.
  16. Aug 17, 2014 #15
    Hmm, I get the same values for ##a_n## as shown here:

    Which matches with those from the OP:

    You get something different? I haven't tried plotting it.
  17. Aug 17, 2014 #16


    User Avatar

    Staff: Mentor

    I retract my claim! While my expression for ##a_n## is different, they do yield the same values. No doubt we took a different trig-identity path somewhere along the line. I was fooled when the plotted results looked way off. However, when I plotted the OP's I failed to include the ##b_1## term! So yes, I goofed there.
  18. Aug 17, 2014 #17
    I tried plotting it and forgot to include the ##a_1## term. That was 30 min well spent staring at a graph. All's well that ends well!
  19. Aug 17, 2014 #18

    The Electrician

    User Avatar
    Gold Member

    Here's a plot:


    Attached Files:

  20. Aug 18, 2014 #19
    Thank you everyone for your comments.

    It turns out my calculation was correct, however I keep getting b1=zero.

    [itex] \frac{1}{π}\int_{\frac{π}{2}}^{π} sin(x)sin(nx)dx + \frac{1}{π}\int_{\frac{3π}{2}}^{2π} sin(x)sin(nx)dx = \frac{1}{π}\left( \frac{(-1+2cos(nπ)+2nsin(\frac{nπ}{2}))sin(nπ))}{-1+n^2}\right) [/itex]
  21. Aug 18, 2014 #20
    Last edited by a moderator: May 6, 2017
  22. Aug 18, 2014 #21
    Unfortunately this is beyond my mathematics knowledge, I just plugged in n=1 for which denominator becomes zero.
  23. Aug 18, 2014 #22
    Ah, but the expression you arrive at for ##b_n## is undefined for ##n = 1## (division by zero is undefined). That denominator probably comes from the use of some trigonometric identity in evaluating the integral.

    Try plugging in ##n = 1## before you evaluate the integral.
  24. Aug 18, 2014 #23
    Oh, I see, in that case I most certainly get b1=1/2. I'm sorry for my blindness, it's distance learning when I get stuck I'm on my very own.
    I appreciate your help.
  25. Aug 18, 2014 #24
    Nothing to be sorry about. Glad to be of help.
  26. Jun 13, 2015 #25
    I have calculated a0 = 0, which i found straight forward, and i have the calculation for an down the following:

    an = 1/2π x[ [ ( (2 cos(nπ) ) / (1-n2) ) - ( (2 cos(n π/2) ) / (1-n2) )] + [ ( (2 cos(n 2π) ) / (1-n2) ) - ( (2 cos(n 3π/2) ) / (1-n2) )] ]

    Does that look correct thus far can someone tell me?
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted