Fourier Series Approximation of a Square Wave

Fourier Series Approximation of a Square Wave
Loading the math board and drawing, please wait…
2012-06-19 09:15
This GeoGebra example demonstrates how a square wave (periodic rectangular wave) is dynamically approximated by summing sine wave harmonics in a Fourier series. The core mathematical concepts covered include Fourier series, trigonometric superposition, periodic functions, series convergence, the Gibbs phenomenon, and function approximation in the time domain. Construction highlights: the example uses the If command to define the piecewise square wave function f over the interval [xa, xb]; Sequence generates harmonic indices; Sum accumulates odd harmonics to form the partial Fourier sum. Key objects include N_max (maximum number of terms), p (period), k (harmonic index), a and b (Fourier coefficients), N (current term count), Even and Odd (parity checks), a0 (DC component), and the resulting Fourier approximation curve. It is suitable for high school advanced mathematics, university calculus, differential equations, and signals and systems courses, serving as a classroom demonstration or interactive exploration tool for frequency-domain analysis and Fourier analysis.

GeoGebra Commands & Parameters

  1. If(x < 0, 0, 3) → f
  2. Sequence(2 / p * Integral[f(x) * cos(n * k * x), xa, xb], n, 1, 25) → a
  3. Sum(Sequence[Element[a, n] * cos(n * k * x), n, 1, N]) → Even
  4. Sequence(2 / p * Integral[f(x) * sin(n * k * x), xa, xb], n, 1, 25) → b
  5. Sum(Sequence[Element[b, n] * sin(n * k * x), n, 1, N]) → Odd

AI Drawing Prompt Reference

Draw a square wave function f(x) with a period of p, and approximate it using a Fourier series as a sum of sine waves. First, define f(x) as 0 for x < 0 and 3 for x ≥ 0. Then, calculate the Fourier coefficients a and b for the first 25 harmonics, which will be used to generate the even and odd parts of the Fourier series. Finally, sum these parts to obtain the Fourier approximation of the square wave.
The prompt above was compiled from the original drawing commands and is for reference only.