Elysia Tools

Navigation

Math

Fourier Series Simulator for Square, Sawtooth and Triangle Waves

Build Fourier partial sums for four waveforms. Compare signed coefficients, observe the Gibbs effect and see what the DC term does to a rectified sine.

Open static visualization

Tool usage guide

Learn when to use this tool, what it supports, and how real users apply it.

Overview

How does adding a third or fifth harmonic change the shape of a square wave? Make the comparison on the same pair of periods, then try the triangle and the half-wave rectified sine to see where cosine terms and a constant enter the expansion.

Set up a fair comparison

Leave amplitude at 1 while comparing the number of terms. The red curve is the target, the blue curve is the sum and the thin green curves show individual terms.

Set up a fair comparison
Control or readoutWhat to watch
Wave Type and Number of termsPick one of four targets and keep 1–50 nonzero terms. A constant, when present, counts as one term.
Animate Approximation ProcessStarts with one term across both periods. Speed changes the delay before each addition, and Pause holds the current sum.
Amplitude Spectrum and coefficient tableBar heights represent magnitudes. Use the table to check the sign and frequency of every coefficient.

Read the error and the coefficient decay

Approximation Error is the mean squared difference from the target at 1,000 equally spaced samples. It uses all the terms selected on the slider, even while the animation is showing an earlier partial sum.

The square and sawtooth coefficients fall in magnitude as 1/n. The odd cosine coefficients of this triangle fall as 1/n², so fewer terms describe most of its shape. Near a square-wave jump, a small MSE can coexist with a visible overshoot.

How it works

  1. Select Square Wave and set amplitude to 1.
  2. Move Number of terms from 1 to 25 and compare the edges and the MSE.
  3. Switch to Triangle Wave, then check the signs and orders in the coefficient table.

Edge cases & common failures

  • Compare at the same amplitude

    Doubling the amplitude scales both curves by two and multiplies MSE by four. The formula and coefficient table are for unit amplitude.

  • Find a label on a small screen

    At high term counts the spectrum skips some labels so they remain legible. The table still lists every selected term.

Examples

1. See the Gibbs overshoot

How to use

Select Square Wave. Compare 1 and 25 terms with the target visible and the individual harmonics hidden.

Outcome

The plateau becomes flatter and the oscillations are concentrated near the jump. The overshoot remains visible.

2. Build the even triangle

How to use

Select Triangle Wave, keep amplitude 1 and compare 1 and 10 terms. Read the first three rows.

Outcome

The cosine coefficients at 1ω, 3ω and 5ω are about −0.8106, −0.0901 and −0.0324. The blue curve approaches the triangle’s trough at the left edge.

3. Isolate the DC term

How to use

Select Half-Wave Rectifier, set 3 terms and turn on progressive animation. Pause before the second term for a clear view of the first frame.

Outcome

The first frame is a horizontal line at 1/π. The next terms add the fundamental sine and the 2ω cosine.

FAQ

Why is the 25th term of the square wave at 49ω?

Even orders vanish. Counting the 25 retained odd orders gives 1, 3, 5 and so on through 49.

Does adding terms remove the overshoot at a jump?

It narrows the region of oscillation. The limiting overshoot remains close to 9% of the jump height, measured from the plateau.

Related

Related tools and workflows

Format Conversion

AsciiMath LaTeX MathML Equation Converter

Convert equations between AsciiMath, LaTeX and MathML: auto-detect the input format, produce canonical LaTeX, presentation MathML with an embedded TeX annotation, a best-effort AsciiMath back-translation, a screen-reader aria-label snippet (role=math), and a KaTeX HTML preview.

Math & Numbers

Series Convergence Tester (Ratio/Root/Integral/Comparison)

Numeric convergence tests for Σ aₙ: nth-term, ratio, root, p-series comparison, and integral test; alternating series classified by Leibniz with a sum estimate.

Math & Numbers

Fourier Series Calculator

Calculate Fourier series coefficients for common waveforms

Math & Numbers

Sum Of Series Calculator

Sum arithmetic series, geometric series, or a custom list of terms

Next

More visualizations nearby

Cookie settings

Essential cookies keep the site running. Analytics and personalized ads are optional.

Cookie policy