How Do You Calculate the Fourier Series of a Piecewise Function with Period 4?

Click For Summary

Homework Help Overview

The problem involves calculating the Fourier series of a piecewise function with a period of 4, defined as f(x) = 2 + x for -2 < x ≤ 0 and f(x) = 2 for 0 < x < 2. Participants are tasked with sketching the graph and deriving the Fourier series representation.

Discussion Character

  • Mixed

Approaches and Questions Raised

  • Participants discuss the correct setup for the Fourier coefficients, questioning the use of half-range formulas due to the function's properties. There are attempts to derive the coefficients a0, an, and bn, with some participants expressing uncertainty about their calculations and the implications of the function's periodicity.

Discussion Status

Several participants have provided different expressions for the Fourier coefficients, with some acknowledging errors in their previous calculations. There is ongoing exploration of the correct formulas for an and bn, and some participants have confirmed the value of a0. The discussion reflects a collaborative effort to clarify misunderstandings and refine the approach to the problem.

Contextual Notes

Participants note the importance of correctly interpreting the piecewise nature of the function and the implications for the Fourier series coefficients. There is mention of potential confusion regarding the periodicity and symmetry of the function, which affects the calculations.

Nallyfish
Messages
6
Reaction score
0

Homework Statement



The function f has period 4 and is such that
f(x)=2+x, -2<x\leq0
f(x)=2, 0<x<2

Sketch the graph of f for x∈[−4, 4] and obtain its Fourier series.


Homework Equations





The Attempt at a Solution



Okay so I've pretty much sketched the graph, but I've been thrown by the 2+x and I'm not sure what to do from this point onwards.

So a0=\frac{1}{2}\int^{2}_{0}2dx=2

an=\frac{1}{2}\int^{2}_{0}2*cosnxdx

So
an=\frac{sin2n}{n}

And
bn=\frac{-(cos(2n)-1)}{n}

Am I on the right lines...?
 
Last edited:
Physics news on Phys.org
Nallyfish said:

Homework Statement



The function f has period 4 and is such that
f(x)=2+x, -2<x\leq0
f(x)=2, 0<x<2Okay so I've pretty much sketched the graph, but I've been thrown by the 2+x and I'm not sure what to do from this point onwards.

So a0=\frac{1}{2}\int^{2}_{0}2dx=2

an=\frac{1}{2}\int^{2}_{0}2*cosnxdx

So
an=\frac{sin2n}{n}

And
bn=\frac{-(cos(2n)-1)}{n}

Am I on the right lines...?

No, you aren't. You are given one period of a function whose period is 4. That is a two piece function defined on (-2,2). If you have graphed it you will know that it is neither even nor odd so you may not use the half-range formulas for the coefficients. The formula for an in this problem is

a_n = \frac{1}{2}\int_{-2}^{2}f(x)\cos(\frac{n\pi}{2}x)\, dx

and similarly for bn. You have to break these intgrals up into (-2,0) and (0,2) and use the appropriate formula for f(x) in each.
 
Oh god, I'm an idiot. Thank you for that! Can't believe I did that.

So I now have

an=\frac{1}{2}\int^{0}_{-2}(2+x)cos(\frac{n\pi}{2})xdx+\frac{1}{2}\int^{2}_{0}2cos(\frac{n\pi}{2})xdx

= \frac{4sin(n\pi)}{n\pi}

and bn= \frac{-2(ncos(n\pi))(\pi-sin(n\pi))}{n<sup>2</sup>\pi<sup>2</sup>}
 
Sorry, I forgot to take the sines and cosines out

an=\frac{2}{n^{2}\pi^{2}}

and

bn= 0

Is what I've got which I HOPE is correct.
This would make the Fourier series

f(x)=\frac{3}{2}*\sum^{\infty}_{n=1}\frac{2}{n^{2}\pi^{2}}cos(\frac{(n\pi)x}{2})
 
Nallyfish said:
Sorry, I forgot to take the sines and cosines out

an=\frac{2}{n^{2}\pi^{2}}

and

bn= 0

Is what I've got which I HOPE is correct.
This would make the Fourier series

f(x)=\frac{3}{2}*\sum^{\infty}_{n=1}\frac{2}{n^{2}\pi^{2}}cos(\frac{(n\pi)x}{2})

That can't be correct because your original f(x) is neither even nor odd, and this answer is an even function. You can't have all the bn be zero.
 
I keep reaching different answers for my an and bn

My latest answers are

an= \frac{2(n+1)}{n^{2}\pi^{2}}

and

bn= \frac{2(n\pi^{2}+\pi^{2}-1)}{n\pi}
 
Nallyfish said:
I keep reaching different answers for my an and bn

My latest answers are

an= \frac{2(n+1)}{n^{2}\pi^{2}}

and

bn= \frac{2(n\pi^{2}+\pi^{2}-1)}{n\pi}

Those are both wrong and you haven't calculated a0. Here's what you should get for your constants:

a_n=\frac{(-1)^{n+1}+1}{\pi n^2}
b_n=\frac{(-1)^{n+1}}{n}
a_0=2-\frac{\pi}{4}

Keep trying.
 
Those aren't correct. You should get
\begin{align*}
a_n &= (1+(-1)^{n+1})\frac{2}{n^2\pi^2} \\
b_n &= (-1)^{n+1}\frac{2}{n\pi}
\end{align*}
I think you dropped a factor of pi somewhere, LCKurtz.
 
I got a0= \frac{3}{2}

Because I thought the formula was

\frac{1}{2L}\int^{L}_{-L}f(x)dx

and L is 2 so

a0= \frac{1}{4}[\int^{0}_{-2}(2+x) dx + \int^{2}_{0}2 dx]

Which would give \frac{3}{2}
 
  • #10
vela said:
Those aren't correct. You should get
\begin{align*}
a_n &= (1+(-1)^{n+1})\frac{2}{n^2\pi^2} \\
b_n &= (-1)^{n+1}\frac{2}{n\pi}
\end{align*}
I think you dropped a factor of pi somewhere, LCKurtz.

Nallyfish said:
I got a0= \frac{3}{2}

Because I thought the formula was

\frac{1}{2L}\int^{L}_{-L}f(x)dx

and L is 2 so

a0= \frac{1}{4}[\int^{0}_{-2}(2+x) dx + \int^{2}_{0}2 dx]

Which would give \frac{3}{2}

Yes, 3/2 is correct for a0. Vela's formulas for the coefficients are correct. I inadvertently used L = pi instead of L = 2 when I calculated the coefficients.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
3
Views
2K
Replies
3
Views
2K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K