b2KIT

Fourier Series Visualizer

Build periodic waveforms from sine and cosine harmonics. Visualize square, sawtooth, and triangle wave approximations term by term.

Tested tool guide Tested browser tools Checked August 16, 2026

What Fourier Series Visualizer does and how it behaves

The Fourier Series Visualizer builds a periodic curve by adding a finite number of sine and cosine harmonics. Square, sawtooth, and triangle presets expose how each additional term changes the partial sum, including its edges, symmetry, and fine detail. Harmonics occur at integer multiples of the fundamental frequency, while their coefficients determine amplitude and sign. The most common surprise appears near a square or sawtooth discontinuity: adding terms makes the affected region narrower, but the peak overshoot does not shrink to zero. This is the Gibbs phenomenon.

How the result is produced

1

Finite harmonic sum

At each horizontal coordinate x, the visualizer evaluates a partial sum of the form S_N(x) = a0/2 + sum from n = 1 through N of [a_n cos(n x) + b_n sin(n x)]. The constant term sets the mean level. Each a_n or b_n controls the cosine or sine contribution at the nth multiple of the fundamental.

2

Preset coefficient patterns

The waveform presets differ in which harmonics they include and how quickly their coefficients decrease. In the usual centered forms, square and triangle waves use odd harmonics, while a sawtooth uses every positive integer harmonic. Square and sawtooth magnitudes decrease like 1/n; triangle magnitudes decrease like 1/n^2. Signs and sine-versus-cosine placement depend on the chosen phase origin.

Good uses

  • Show why a square wave can be synthesized from odd harmonics by advancing from one included term to several and watching the edges become steeper.
  • Compare square, sawtooth, and triangle partial sums at similar harmonic limits to connect coefficient decay with visible smoothness and ringing.
  • Examine how adding a particular sine or cosine harmonic changes symmetry, peak shape, and small-scale detail in a periodic approximation.

Limits and checks

  • Check the period and phase convention before reusing coefficients. A period of 2*pi uses sin(n x) and cos(n x), while a time-domain period T uses arguments such as 2*pi*n*t/T. Moving the origin can change sine coefficients into cosine coefficients or alter their signs.
  • A finite partial sum is smooth even when the ideal preset contains corners or jumps. The plotted curve is therefore an approximation, not an exact square, sawtooth, or triangle wave. More terms improve the approximation but can also introduce increasingly fine oscillations.
  • For odd-only series, the largest harmonic index is not the number of contributing harmonics. Indices 1, 3, 5, 7, and 9 are five nonzero components even though the highest index is 9. Keep this distinction in mind when comparing term counts.

Common questions

Why do ripples remain near a square-wave edge?

Truncating a Fourier series produces oscillation near a discontinuity. Adding harmonics confines the strongest ripples to a narrower region and improves the approximation away from the jump, but the limiting overshoot remains a fixed fraction of the jump size. This Gibbs behavior is expected and does not, by itself, indicate incorrect harmonic coefficients.

Can this represent a nonperiodic signal?

No. A Fourier series represents a periodically repeated function. You can treat a finite interval as one period, but its left and right endpoints are then joined when the interval repeats. If those endpoints do not meet, the periodic extension contains a jump, and a finite partial sum will show ringing near that join.

References and verification

The behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools