Fourier series of a waveform

In summary: 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 specified in the original post.
  • #1
bizuputyi
42
1

Homework Statement



Sketch the waveform and develop its Fourier series.

[itex]
f(\omega t)=
\begin{cases}
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π
\end{cases}
[/itex]

Homework Equations


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.
 

Attachments

  • sine wave 1.jpg
    sine wave 1.jpg
    3.8 KB · Views: 794
  • sine wave 2.jpg
    sine wave 2.jpg
    3.4 KB · Views: 672
Last edited:
Physics news on Phys.org
  • #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?
 
  • #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.
 
  • #4
At least a0=0 for sure.
 
  • #5
bizuputyi said:
The first one ...
Right. But the periodic extension of that graph is neither an even or odd function.
 
  • #6
Exactly. The Fourier series must consist of both sine and cosine terms (i.e. an=something, bn=something), but with only odd harmonics.
 
  • #7
Let me just go back to this:
bizuputyi said:
If bn=0 that means the function is even ...
[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:
  • #8
milesyoung said:
Let me just go back to this:

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.

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.
 
  • #9
[STRIKE]Your Fourier coefficients look correct btw. So good job :thumbs:[/STRIKE]
 
Last edited:
  • #10
olivermsun said:
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.
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:
[tex]
p \Rightarrow q \qquad (1)
[/tex]
If (1) is always true, then that doesn't necessarily mean that:
[tex]
q \Rightarrow p
[/tex]
is always true.

[STRIKE]The piecewise function included in the OP is an example of this.[/STRIKE]
 
Last edited:
  • #11
milesyoung said:
Your Fourier coefficients look correct btw. So good job :thumbs:

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:
  • #12
gneill said:
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.
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:
  • #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:
  • #14
milesyoung said:
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##.
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.

Edit: I'm not entirely sure why you're considering ##b_0##.

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.
 
  • #15
gneill said:
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.
Hmm, I get the same values for ##a_n## as shown here:
http://www.wolframalpha.com/input/?i=Table%5Bint+1%2Fpi*Piecewise%5B%7B%7B0%2C0%3C%3Dx%3Cpi%2F2%7D%2C%7Bsin%28x%29%2Cpi%2F2%3C%3Dx%3Cpi%7D%2C%7B0%2Cpi%3C%3Dx%3C3*pi%2F2%7D%2C%7Bsin%28x%29%2C3*pi%2F2%3C%3Dx%3C2*pi%7D%7D%5D*cos%28n*x%29+from+x+%3D+0+to+2*pi%2C%7Bn%2C1%2C10%7D%5D

Which matches with those from the OP:
http://www.wolframalpha.com/input/?i=limit+1/pi*2*sin(n*pi/2)*(-n+sin(n*pi/2))/(-1+n^2)+as+n->1
http://www.wolframalpha.com/input/?i=Table[1/pi*2*sin(n*pi/2)*(-n+sin(n*pi/2))/(-1+n^2),{n,2,10}]

You get something different? I haven't tried plotting it.
 
  • #16
milesyoung said:

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.
 
  • #17
gneill said:
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.
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!
 
  • #18
Here's a plot:

attachment.php?attachmentid=72229&stc=1&d=1408308723.png
 

Attachments

  • FourierTriac.png
    FourierTriac.png
    6.3 KB · Views: 1,301
  • #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
Unfortunately this is beyond my mathematics knowledge, I just plugged in n=1 for which denominator becomes zero.
 
  • #22
bizuputyi said:
... I just plugged in n=1 for which denominator becomes zero.
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.
 
  • #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.
 
  • #24
Nothing to be sorry about. Glad to be of help.
 
  • #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?
 
  • #26
Gremlin said:
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?

Anyone?

I'm struggling to collapse that any further. The opening poster obviously arrived at the correct answer so i can see what i am aiming for, am i on track to hit it?
 
  • #27
cos α - cos ß = -2 sin ((α+ß)/2) sin ((α-ß)/2)

is what i need so for:

( (2 cos(nπ) ) / (1-n2) ) - ( (2 cos(n π/2) ) / (1-n2) )

I'd end up with

2/1-n2 ((cos nπ) - cos(n π/2))

2/1-n2 (-2 sin((nπ + n π/2) /2) x sin ((nπ - n π/2) /2) )

2/1-n2 (-2 sin ((nπ + n π/2) /2) x ((nπ - n π/2) /2) )

I'm struggling at that point but i don't think I'm far away from the correct answer.
 
Last edited:
  • #28
Gremlin said:
cos α - cos ß = -2 sin ((α+ß)/2) sin ((α-ß)/2)

is what i need so for:

( (2 cos(nπ) ) / (1-n2) ) - ( (2 cos(n π/2) ) / (1-n2) )

I'd end up with

2/1-n2 ((cos nπ) - cos(n π/2))

2/1-n2 (-2 sin((nπ + n π/2) /2) x sin ((nπ - n π/2) /2) )

2/1-n2 (-2 sin ((nπ + n π/2) /2) x ((nπ - n π/2) /2) )

I'm struggling at that point but i don't think I'm far away from the correct answer.

Without the code, that's very hard to follow. My working is attached.
 

Attachments

  • FS003.jpg
    FS003.jpg
    41.7 KB · Views: 660
  • #29
In post#15 milesyoung gave a link to a WolframAlpha calculation of a table of coefficients. Have you confirmed that your expression can match the given values? It would be unproductive to continue hammering away at trig identities if the initial expression is not correct.
 
  • #30
I am trying to generate an expression for an - that's what I'm halfway through.

It looks to be in the right ballpark, but I've hit an impasse collapsing the expression. My working out is in post #28. I think i am losing the will to live!
 
  • #31
Sorry i see what you're saying now. I shall try n=3 in what i have now and hope for 1/pi
 
  • #32
No it doesnt.
 
  • #33
I'm still trying, and failing, to nail this.

Can someone tell me where the attached goes off course please? There's not a lot to it, but already if n=3 i don't get 1/pi.

1001.jpg
 
  • #34
You're having problems with the integration. The arguments of the sine functions are not simple x's, so dx is not the differential element for them to be integrated as just a sine function. In other words,

##\int sin(u) du = -cos(u) + C## which is fine since du is the differential element of u.

but if ##u = (n+1) x##, then ##du = (n + 1) dx##

You need to modify the integral so that the correct differential element is accounted for.
 
  • #35
Ok thanks, i shall have another look.
 

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
0
Views
508
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
19
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
9
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
953
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
989
  • Calculus and Beyond Homework Help
Replies
1
Views
341
Replies
4
Views
287
Back
Top