Fast Fourier Transformation: Fourier series

Directly to the input form

 
  • This application demonstrates the expansion of a function over [0,2*π] into a finite section of a fourier series using the Fast Fourier Transform.
  • The Fourier series of f reads
    f(x) = a0/2 + ∑{i=1 to infinity} { ai cos(i*x) + bi sin(i*x) }
    ai =(2/π) 02 π f(x)cos(i*x) dx
    bi =(2/π) 02 π f(x)sin(i*x) dx

  • Pointwise convergence of this infinite sum requires some regularity of f, for example piecewise continuity, with the meanvalue of the left and right hand limit at its points of discontinuity as function value.
  • We use now trigonometric interpolation of an equidistant grid of (x,f)-values in order to approximate the integrals representing the coefficients. That means we interpolate n+1 data points (xi,yi) with xi = 2*π*i/(n+1), i=0,..,n in order to evaluate those integrals approximately.
  • Because of its special form and the implicitly assumed periodicity of the function (i.e. for the interpolation it is assumed that yn+1=y0) this corresponds to evaluate these integrals via the trapezoidal rule, which is optimal for integration of a periodic function over the full interval of its periodicity (why?).
  • The Fourier sum is obtained in the form
    azero+∑i=1 to m{ aicos(i*x)+bisin(i*x)}+(a(m+1)cos((m+1)*x))
    azero corresponds to a0/2.
  • The data points are obtained by the function f which you specify.
 

Input

 
  • You specify f. Either you choose from two predefined ones or write your own piece of code to compute it.
  • The interval of evaluation of f. you can specify that only data of f from a subinterval should be used for defining the interpolating trigonometric sum. (In this case the relation to quadrature of the Fourier integrals is lost of course.)
  • The scaling type of the y-axis for the graphical output.
  • The number of grid points n+1.
  • Attention: n+1 must have prime factors 2,3 and 5 only!
 

Output

 
  • You get a table with the Fourier coefficients and a plot.
  • The plot shows:
    1. The original function and its
    2. Fourier-approximation
  • Remark: If the function is well behaved and you specify a large value for n+1 then you might see one curve only, since the approximation error is very small.
 

Questions?!

 
  • What can you observe with respect to the graph of the Fourier sum?
  • Which type of function is suited best for this type of approximation?
  • Which effect can be observed if f is not periodic over [0,2*π]?
 

To the input form

 
 
Back to the top!

12.07.2010