Signal Reconstruction with the Fourier Theorem

January 31, 2016

AIS1209

Description of the Application

  • Use a Fourier series to approximate a square wave of amplitude equal to 1 and period T plot of chunk unnamed-chunk-1
  • The user can change the number of terms used in the computation of the Fourier series, which is a sum of sine functions, and the number of cycles (periods) for displaying the function
  • The application computes the approximation of the square wave using its Fourier series and plots the reconstruction of the square wave and its frequency spectrum
  • The user has the option to download a CSV file containing the data
  • Potential applications include numerical simulations of systems (ex., electrical circuits) where a step input is needed

Some Theory

  • According to Fourier theory, almost any periodic function can be represented as an infinite sum of sinusoidal components (sine or cosine functios)
  • If the function is not periodic, it can be made periodic by repeating copies of the function
  • The sum is called the Fourier series of function f and it has the general form \[ f(x) = \frac{1}{2} a_0 + \sum_{i=1}^\infty a_n cos(nx) + \sum_{i=1}^\infty b_n sin(nx)\]
  • Fourier coefficients \(a_n\) and \(b_n\) depend on function f
  • The Fourier series of a square wave of amplitude 1 and period T is \[f(x) = \frac{4}{\pi} \sum_{n=1,3,5, \ldots}^\infty \frac{1}{n} sin\left(\frac{n\pi x}{T}\right) = \frac{4}{\pi} \sum_{n = 0}^\infty \frac{1}{2n+1} sin\left(\frac{(2n+1)\pi x}{T}\right) \]

Example 1: Approximation with Two Terms (N = 2)

  • Shown is the case with period T = 1 and one cycle (C = 1)
  • Notice the approximation/reconstruction could use some improvement; also notice the two peaks on the frequency spectrum corresponding to the two terms used in the reconstruction

plot of chunk unnamed-chunk-2

Example 2: Approximation with 50 Terms (N = 90)

  • Shown is the case with period T = 2 and three cycles (C = 3)
  • Notice the far better approximation/reconstruction of the square wave
  • A little bit of Gibbs phenomenon is seen at corners (oscillations of larger amplitude), which is due to the numerical reconstruction
  • Notice on the frequency spectrum plot that the height of the frequency components decreases which is consistent with the last equation on p. 2, where the coefficient of the sine function has n in the denominator

plot of chunk unnamed-chunk-3