Finding the Sine Representation of an Odd Function Using Fourier Series

Click For Summary
SUMMARY

This discussion focuses on finding the sine representation of the function \( f(x) = \cos(2x) \) for \( x > 0 \) and \( f(x) = -\cos(2x) \) for \( x < 0 \), which is an odd function. The user calculates the Fourier sine coefficients using the formula \( b_n = \frac{2}{l} \int_0^\pi f(x) \sin\left(\frac{n\pi x}{l}\right)dx \) and derives \( b_n = \frac{2n}{\pi} \left( \frac{(-1)^n - 1}{4-n^2} \right) \). However, the user encounters discrepancies when plotting the series, primarily due to neglecting the first terms of the series, particularly \( b_1 \) and \( b_2 \), which must be calculated separately to achieve an accurate representation of \( \cos(2x) \).

PREREQUISITES
  • Understanding of Fourier series and sine representation
  • Knowledge of odd functions and their properties
  • Familiarity with integration techniques, particularly in the context of trigonometric functions
  • Experience with plotting functions and interpreting graphical results
NEXT STEPS
  • Review the calculation of Fourier coefficients for odd functions
  • Learn how to handle discontinuities in Fourier series
  • Study the convergence of Fourier series and the impact of term selection
  • Explore advanced plotting techniques for better visualization of Fourier series
USEFUL FOR

Mathematicians, physics students, and engineers working with Fourier analysis, particularly those interested in signal processing and wave functions.

Morbidly_Green
Messages
12
Reaction score
0
Homework Statement
Find the Fourier sine series of cos 2x on [0, π]
Relevant Equations
$$b_n = \dfrac{2}{l} \int^\pi _0 f(x) sin(\dfrac{n\pi x}{l})dx$$
I am attempting to find the sine representation of cos 2x by letting

$$f(x) = \cos2x, x>0$$ and $$-\cos2x, x<0$$

Which is an odd function. Hence using $$b_n = \dfrac{2}{l} \int^\pi _0 f(x) \sin(\dfrac{n\pi x}{l})dx$$ I obtain $$b_n = \dfrac{2n}{\pi} \left( \dfrac{(-1)^n - 1}{4-n^2} \right)$$

which when I plot the sine series

$$\sum^\infty _{n=3} \dfrac{2n}{\pi} \left( \dfrac{(-1)^n - 1}{4-n^2} \right) \sin(n x)$$

I don't get the fn of cos 2x on [0, π]. I don't understand where I went wrong any help would be great.
 
Physics news on Phys.org
Don't follow: you make an odd continuation of ##f(x)## but don't actually use it: your bounds are 0 and ##\pi##
 
BvU said:
Don't follow: you make an odd continuation of ##f(x)## but don't actually use it: your bounds are 0 and ##\pi##
Yes, this is true, but I used the formula for $$b_n$$ that assumes I do indeed have an odd function
 
So basically you have only forced ##\ f(0) = f(\pi)=0\ ## as is necessary with a sine series.

(and integrating from ##\pi## to ##2\pi## gives the same as from 0 to ##\pi## anyway)

I tried a cheat and got (for n up to 9):

241922

so it looks your result is fine. Why do you think otherwise ?
 
When I plotted the Fourier series on top of the function cos2x they did not match

BvU said:
So basically you have only forced ##\ f(0) = f(\pi)=0\ ## as is necessary with a sine series.

(and integrating from ##\pi## to ##2\pi## gives the same as from 0 to ##\pi## anyway)

I tried a cheat and got (for n up to 9):

View attachment 241922
so it looks your result is fine. Why do you think otherwise ?
 
Morbidly_Green said:
When I plotted the Fourier series on top of the function cos2x they did not match
Like 'not at all', 'not very well', 'not perfectly' ?

Did you check the link ? it has a plot too ...

To get a good match you need an awful lot of terms: the function has to jump from 0 to 1 in a step of 'size zero' at ##x=0##
 
Edit[added]: I didn't notice your sum started at n=3. Anyway here's a plot to compare with.

@Morbidly_Green: Your problem is your formula for ##b_n## when ##n=2##. You need to calculate ##b_2## separately, and when you do, you will find than ##b_2=0##. Once you fix that, your plot should look better. Here's what I get for the first 10 terms:
fs.jpg
 
LCKurtz said:
Edit[added]: I didn't notice your sum started at n=3. Anyway here's a plot to compare with.

@Morbidly_Green: Your problem is your formula for ##b_n## when ##n=2##. You need to calculate ##b_2## separately, and when you do, you will find than ##b_2=0##. Once you fix that, your plot should look better. Here's what I get for the first 10 terms:
View attachment 241924
Ah yes! Thank you, I completely forgot that you can't just ignore the first terms !
 
  • #10
In particular ##b_1## ! Why did you start at ##n=3## ?
 
  • #11
BvU said:
In particular ##b_1## ! Why did you start at ##n=3## ?
Since n=2 would yield a division by zero I started from the first calculable term, n=3, and as I said I forgot how important the terms before are
 
  • #12
OK, thanks. All in all: well done !
 
  • #13
Morbidly_Green said:
I am attempting to find the sine representation of cos 2x by letting

$$f(x) = \cos2x, x>0$$ and $$-\cos2x, x<0$$

Which is an odd function. Hence using $$b_n = \dfrac{2}{l} \int^\pi _0 f(x) \sin(\dfrac{n\pi x}{l})dx$$ I obtain $$b_n = \dfrac{2n}{\pi} \left( \dfrac{(-1)^n - 1}{4-n^2} \right)$$

which when I plot the sine series

$$\sum^\infty _{n=3} \dfrac{2n}{\pi} \left( \dfrac{(-1)^n - 1}{4-n^2} \right) \sin(n x)$$

I don't get the fn of cos 2x on [0, π]. I don't understand where I went wrong any help would be great.

You need to keep ##a_1, a_3, a_4, \ldots##. You could also include ##a_2##, but you cannot use the general form for ##a_n##: you need to put ##a_2=0## manually.
 

Similar threads

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