QiLing Tools

∿Fourier Series & FFT Visualizer - Gibbs, Epicycles, Spectrum

Three classic Fourier scenes in one place. Fourier series: pick a square, sawtooth, triangle or pulse wave (adjustable duty cycle) or type any f(x) to expand on [−L, L]. Presets use exact formulas for aₙ and bₙ; custom functions are integrated numerically with adaptive Gauss–Kronrod. Drag the number of terms N or press play to watch the partial sum approach the function term by term — the roughly 9% Gibbs overshoot next to a jump is plain to see and measured live — with a stem chart of the coefficients and a link that sends the partial sum to the grapher. Epicycles: press and drag to draw any closed shape (or pick a heart, star or square); the path is resampled to 256 points by arc length and transformed with a complex DFT, so each frequency becomes a circle spinning at a constant rate, and chaining them largest first makes the tip retrace your drawing. Change the number of circles to watch detail appear. FFT spectrum: enter a synthetic signal (sample rate, length and reproducible Gaussian noise) or paste samples, choose a rectangular, Hann, Hamming or Blackman window, and get the single-sided amplitude spectrum (linear or dB), the phase spectrum and a list of the main components. Power-of-two lengths use a radix-2 FFT; any other length gets an exact DFT via Bluestein’s algorithm.

Free · No sign-up · Runs in your browserLast updated:

Loading tool...

How to use Fourier Series & FFT Visualizer

  1. 1Choose a panel: Fourier series, epicycle drawing or FFT spectrum
  2. 2Pick a waveform or enter a function or signal; set the terms, circles, sample rate or window
  3. 3Watch the partial sums and coefficients, the epicycle reconstruction, or read off the peak frequencies, amplitudes and phases

FAQ

What is the Gibbs phenomenon, and do more terms remove it?
When a function has a jump, its Fourier partial sums overshoot and ripple on both sides of the jump. Adding terms squeezes the ripples closer to the discontinuity, but the largest overshoot never shrinks: it stays at about 8.95% of the jump (a square wave jumping from −1 to 1 peaks near 1.179). It’s the unavoidable price of building a discontinuous function from smooth sines; at the jump itself the series converges to the average of the two one-sided limits.
Why doesn’t the FFT amplitude match my signal’s amplitude?
The single-sided spectrum is already doubled and divided by the window’s coherent gain, so a sine whose frequency falls exactly on a bin (k·fs/N) reads its peak amplitude. When the frequency falls between bins, energy leaks into neighbouring bins and the peak reads low — spectral leakage. Windows such as Hann or Blackman reduce the leakage side lobes at the cost of a wider main peak. For finer frequency resolution you need a longer recording (Δf = fs/N).
How do epicycles redraw a shape?
The closed path is treated as complex numbers z = x + iy, and its discrete Fourier transform gives coefficients c_k with z(t) = Σ c_k·e^(ikt): each term is a circle of radius |c_k| turning k times per cycle. Chain the circles largest first and the tip of the last one traces the shape over time. A few big circles give a smooth outline; more circles add detail, and with all 256 the sampled points are reproduced exactly.
How are aₙ and bₙ computed?
A function with period 2L is expanded as f(x) ≈ a₀/2 + Σ[aₙcos(nπx/L) + bₙsin(nπx/L)], with aₙ = (1/L)∫f(x)cos(nπx/L)dx and bₙ = (1/L)∫f(x)sin(nπx/L)dx over [−L, L]. Preset waves use closed forms (for a square wave bₙ = 4/(nπ) for odd n); custom functions are integrated over 16 sub-intervals with adaptive Gauss–Kronrod to about 1e−10. Odd functions have all aₙ = 0 and even functions all bₙ = 0.