# Fourier series of a waveform

1. Aug 16, 2014

### bizuputyi

1. The problem statement, all variables and given/known data

Sketch the waveform and develop its Fourier series.

$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}$

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:
$a_0=0$
$a_n=\frac{1}{π}\left(\frac{2*sin\frac{nπ}{2}(-n+sin\frac{nπ}{2})}{-1+n^2} \right)$

$b_n=0$

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 $f(\omega t)=f(\omega t+π)$ which is true for the second sketch.

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

#### Attached Files:

File size:
3.8 KB
Views:
260
• ###### sine wave 2.jpg
File size:
3.4 KB
Views:
180
Last edited: Aug 16, 2014
2. Aug 17, 2014

### milesyoung

If you just sketched $\sin(x)$, where $0 \le x \le 2\pi$, and superimposed it on your graphs, then which one is a match?

3. Aug 17, 2014

### bizuputyi

The first one. That means bn can't be zero since this is not an even function, also it has half-wave symmetry, so $f(\omega t)=-f(\omega t+π)$, my an calculation is wrong, so is bn.

4. Aug 17, 2014

### bizuputyi

At least a0=0 for sure.

5. Aug 17, 2014

### milesyoung

Right. But the periodic extension of that graph is neither an even or odd function.

6. Aug 17, 2014

### bizuputyi

Exactly. The fourier series must consist of both sine and cosine terms (i.e. an=something, bn=something), but with only odd harmonics.

7. Aug 17, 2014

### milesyoung

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]

Last edited: Aug 17, 2014
8. Aug 17, 2014

### olivermsun

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. Aug 17, 2014

### milesyoung

[STRIKE]Your Fourier coefficients look correct btw. So good job :thumbs:[/STRIKE]

Last edited: Aug 17, 2014
10. Aug 17, 2014

### milesyoung

An odd function has only sine terms in its Fourier expansion, we can definitely agree on that

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
11. Aug 17, 2014

### 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
12. Aug 17, 2014

### milesyoung

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
13. Aug 17, 2014

### milesyoung

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
14. Aug 17, 2014

### 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

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. Aug 17, 2014

### milesyoung

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. Aug 17, 2014

### 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.

17. Aug 17, 2014

### milesyoung

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. Aug 17, 2014

### The Electrician

Here's a plot:

#### Attached Files:

• ###### FourierTriac.png
File size:
6.4 KB
Views:
770
19. Aug 18, 2014

### bizuputyi

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

$\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)$

20. Aug 18, 2014

### milesyoung

Last edited by a moderator: May 6, 2017