Skip to content
ComputeVerse.ai

Signals & SystemsDesign workbench

Fourier Series Calculator

Harmonic coefficients of the standard periodic waveforms with a live N-harmonic partial-sum reconstruction against the ideal — the Gibbs overshoot visible as you add terms.

About this calculator

The Fourier series expresses any periodic signal as a sum of harmonics: a DC term plus sines and cosines at integer multiples of the fundamental frequency. This calculator gives the exact closed-form coefficients for the classic waveforms — square, triangle, sawtooth, and a rectangular pulse train — and reconstructs the signal from the first N harmonics so you can watch the partial sum approach the ideal as you add terms.

The teaching payoff is the reconstruction plot. Slide the harmonic count and the partial sum sharpens: the triangle wave (continuous) converges smoothly and quickly because its coefficients fall off as 1/n², while the square and sawtooth (with jump discontinuities) fall off only as 1/n and never stop overshooting at the jump — the Gibbs phenomenon, which settles at about a 9% overshoot of the jump no matter how many harmonics you keep. Seeing that overshoot refuse to disappear is the whole point.

The harmonic spectrum stem plot shows which harmonics carry the energy: only odd harmonics for the square and triangle, all harmonics for the sawtooth, and a sinc-shaped envelope for the pulse train whose nulls depend on the duty cycle. Every coefficient is the exact textbook value; the reconstruction is those coefficients summed, not a fit.

Design notes & common mistakes

  • Discontinuous waveforms (square, sawtooth) → 1/n coefficient decay and permanent Gibbs overshoot; continuous ones (triangle) → 1/n² decay and clean convergence.
  • Half-wave symmetric waveforms (square, triangle) contain only odd harmonics; the sawtooth breaks that symmetry and contains all of them.
  • The Gibbs overshoot is about 9% of the jump height and does not shrink with more harmonics — it only gets narrower.
  • a₀ is the signal's average; it is zero for the symmetric waveforms and equals A·d for the pulse train.

Assumptions

  • Ideal, exactly periodic waveforms with the stated symmetry (square is ±A, 50% duty; triangle and sawtooth peak at ±A).
  • Coefficients are the exact closed forms; the reconstruction is the truncated series, not a numerical fit.
  • The pulse train is centered and even; a₀ = A·d is its average.
  • Convergence at a jump is to the midpoint value (Dirichlet), which is why the reconstruction crosses through the discontinuity.

When to use this calculator

Appropriate for

  • Getting the harmonic coefficients of a standard periodic waveform
  • Teaching Fourier-series convergence, the Gibbs phenomenon, and harmonic content
  • Seeing which harmonics a waveform contains and how fast the series converges

Not suitable for

  • Arbitrary or measured periodic signals (use the DFT spectrum analyzer)
  • Non-periodic signals, which need the Fourier transform, not a series
  • Precise harmonic-distortion compliance work without a full measured spectrum

What this calculator does not cover

  • Standard waveforms only (square, triangle, sawtooth, pulse) — arbitrary user-defined periodic functions are not supported.
  • Real trigonometric series; the complex exponential form and two-sided spectrum are not shown here.
  • No convergence beyond truncation control — this illustrates partial sums, it does not accelerate convergence (no σ-approximation / Lanczos smoothing).
  • Continuous-time series only; this is not the DFT of a sampled signal (use the spectrum analyzer for that).
  • As with every calculator on this site: results are preliminary and educational, are not verified for any specific installation, and must be reviewed against the applicable code edition and stamped by a licensed Professional Engineer before real-world use.

Frequently asked questions

Why does the square-wave reconstruction always overshoot at the edges?

That is the Gibbs phenomenon. Near a jump discontinuity the truncated Fourier series overshoots by about 9% of the jump height, and that overshoot does not shrink as you add harmonics — it only gets narrower. It is inherent to representing a discontinuity with smooth sinusoids.

Why does the triangle wave converge so much faster than the square wave?

The triangle wave is continuous, so its Fourier coefficients decay as 1/n², while the square wave's jump makes them decay only as 1/n. Faster coefficient decay means fewer harmonics are needed and there is no Gibbs overshoot.

Why do the square and triangle waves have only odd harmonics?

Both have half-wave symmetry: shifting by half a period negates the waveform, x(t ± T/2) = −x(t). That symmetry forces all even-harmonic coefficients to zero, leaving only odd harmonics. The sawtooth lacks this symmetry and contains all harmonics.

References

  • Oppenheim, A. V. & Willsky, A. S., Signals and Systems, 2nd ed., Ch. 3 (Fourier series, convergence, Gibbs)
  • Lathi, B. P., Linear Systems and Signals, 2nd ed., Ch. 6 (Fourier series of standard waveforms)
  • Kreyszig, E., Advanced Engineering Mathematics, 10th ed., Ch. 11 (Fourier series, Gibbs phenomenon)

Related calculators

Get the ComputeVerse.ai quick reference

A free engineering quick-reference PDF, plus a note when new calculators launch across the library — one or two emails a month, nothing else.