Fourier Series for a piecewise function help

In summary, the conversation discusses finding a Fourier series for a piecewise function with different intervals and using the equations for a and b coefficients. The attempt at a solution is shown and the mistake is found. The correct summations for a and b coefficients are given, and the final function is provided.
  • #1
dinospamoni
92
0

Homework Statement



I'm trying to find a Fourier series for the piecewise function where f(x)=

[itex] 0 \in -\pi \leq x \leq 0 [/itex]
[itex] -1 \in 0 \leq x \leq \frac{\pi}{2} [/itex]
[itex] 1 \in \frac{\pi}{2} \leq x \leq \pi [/itex]

Homework Equations



[tex]a_{n} = \frac{1}{\pi} \int_{0}^{2\pi}\cos(nx)y(x)\,dx[/tex]
[tex]b_{n} = \frac{1}{\pi} \int_{0}^{2\pi}\sin(nx)y(x)\,dx[/tex]

The Attempt at a Solution



I found the pattern that every even a is 0, so that becomes
[tex]a_{m} = \sum_{m=1}^{\infty}\frac{(-1)^{m}2}{(2m-1)\pi}[/tex]

and the b coefficients are 0 when n is odd and 0 for every other even n, so that becomes
[tex]b_{m} = \sum_{m=1}^{\infty}\frac{-2}{\frac{4m-2}{2}\pi}[/tex]

however when I plot this, the plot between -pi and -pi/2 is switched with the plot between pi/2 and pi

I attached a picture for reference along with a plot of f(x)

Any ideas of where i went wrong?
 

Attachments

  • Screen capture00000000000000000 2013-04-24 at 4.01.46 PM.JPG
    Screen capture00000000000000000 2013-04-24 at 4.01.46 PM.JPG
    17.1 KB · Views: 476
  • Screen capture00000000000000000 2013-04-24 at 4.02.58 PM.JPG
    Screen capture00000000000000000 2013-04-24 at 4.02.58 PM.JPG
    8 KB · Views: 389
Last edited:
Physics news on Phys.org
  • #2
dinospamoni said:
Any ideas of where i went wrong?
Not really since you didn't show your work. Just posting your final, probably wrong answer isn't very helpful.
 
  • #3
Whoops sorry, I forgot I didn't do this all in mathematica:

[itex]a_{0} = 0 [/itex]

[itex]a_{1} = \frac{-2}{\pi}[/itex]

[itex]a_{2} = 0[/itex]

[itex]a_{3} = \frac{2}{3\pi}[/itex]

[itex]a_{4} = 0[/itex]

[itex]a_{5} = \frac{-2}{5\pi}[/itex]

[itex]a_{6} = 0 [/itex][itex]b_{1} = 0 [/itex]

[itex]b_{2} = \frac{-2}{\pi}[/itex]

[itex]b_{3} = 0 [/itex]

[itex]b_{4} = 0 [/itex]

[itex]b_{5} = 0 [/itex]

[itex]b_{6} =\frac{-2}{3\pi}[/itex]

[itex]b_{7} = 0 [/itex]

[itex]b_{8} = 0 [/itex]

[itex]b_{9} = 0 [/itex]

[itex]b_{10} =\frac{-2}{5\pi}[/itex]

[itex]b_{11} = 0 [/itex]

[itex]b_{12} = 0 [/itex]

[itex]b_{13} = 0 [/itex]

[itex]b_{14} = \frac{-2}{7\pi}[/itex]
 
Last edited:
  • #4
And I figured out the summations from just looking at these in terms of n:

[itex]a_{n} = \sum\frac{(-1)^{n}2}{n\pi}[/itex]

[itex]b_{n} = \sum\frac{-2}{\frac{n}{2}\pi}[/itex]

and then to get rid of the 0s I made it in terms of m:

[itex]a_{m} = \sum\frac{(-1)^{m}2}{(2m-1)\pi}[/itex]

[itex]b_{m} = \sum\frac{-2}{\frac{4m-2}{2}\pi}[/itex]

The function is then:

[tex]g(x) = \sum_{m=1}^{\infty} a_m Cos((2m-1)x) + \sum_{m=1}^{\infty} b_m Sin((2m-1)x)[/tex]
 
Last edited:
  • #5
I figured out what I did wrong, but thanks!
 

1. What is a piecewise function?

A piecewise function is a mathematical function that is defined by different equations or rules for different intervals or pieces of the domain. This allows for a more specific and accurate representation of a function that may have different behaviors or characteristics in different parts of its domain.

2. How is a piecewise function different from a regular function?

A regular function is defined by a single equation or rule for the entire domain. A piecewise function, on the other hand, has different equations or rules for different parts of the domain, making it more versatile and able to accurately represent complex behaviors.

3. How can Fourier series be used for a piecewise function?

Fourier series can be used to represent a piecewise function by breaking it down into simpler, periodic functions and combining them using a series of sine and cosine terms. This allows for a more efficient and accurate representation of the piecewise function.

4. What are the benefits of using Fourier series for a piecewise function?

Using Fourier series for a piecewise function can provide a more accurate and efficient representation, as well as allow for easier analysis and manipulation of the function. It can also help to identify patterns and trends within the function.

5. Are there any limitations to using Fourier series for a piecewise function?

While Fourier series can be a powerful tool for representing piecewise functions, it may not always provide an exact representation of the function. Additionally, the process of finding the coefficients for the series can be complex and time-consuming for some functions.

Similar threads

  • Calculus and Beyond Homework Help
Replies
3
Views
413
  • Calculus and Beyond Homework Help
Replies
3
Views
279
  • Calculus and Beyond Homework Help
Replies
1
Views
340
  • Calculus and Beyond Homework Help
Replies
1
Views
212
  • Calculus and Beyond Homework Help
Replies
1
Views
534
  • Calculus and Beyond Homework Help
Replies
2
Views
1K
  • Calculus and Beyond Homework Help
Replies
16
Views
558
  • Calculus and Beyond Homework Help
Replies
5
Views
352
  • Calculus and Beyond Homework Help
Replies
2
Views
711
  • Calculus and Beyond Homework Help
Replies
6
Views
2K
Back
Top