Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.6K Views
|
2 Replies
|
1 Total Like
View groups...
Share
Share this post:

Plotting a Fourier series.

Posted 10 years ago

Hello there. I was given the task on trying to find a way to plot a Fourier series with n= 5, 10, 15 and so for f(x)= x. I know that this is not the most complicated thing to do but short of creating a numerous amount of functions each with a different Fourier coefficient and then plotting them all on the same graph I do not know how to do this. Can anyone help please?

Thank you very much. Andrew.

POSTED BY: Andrew Meador
2 Replies
Posted 10 years ago

Gianluca,

If I ever have the pleasure of meeting you in person... Please do not be offended if my first reaction is to just hug you and then kiss your forehead.

Thank you.

Sincerely,

Your soon to return customer,

Andrew.

POSTED BY: Andrew Meador

Something like this:

f[x_] = x; 
fcap[0] = 
  With[{n = 0}, Integrate[f[t]/E^(I*n*t), {t, -Pi, Pi}]/(2*Pi)]; 
fcap[n_ /; n != 0] = 
  Simplify[Integrate[f[t]/E^(I*n*t), {t, -Pi, Pi}]/(2*Pi), 
       Element[n, Integers]]; 
partialSum[n_, x_] = 0 + Sum[2*Re[fcap[k]*E^(I*k*x)], {k, 1, n}]; 
Manipulate[Plot[partialSum[n, x], {x, -Pi, Pi}], {n, 0, 15, 1}]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard