Skip to content
Calcumatix

Fourier Series Calculator

Compute the Fourier series of a square wave: amplitude A, odd harmonics n = 1, 3, 5, .... Enter amplitude and harmonic count to get each bₙ coefficient listed.

Result

b1 = 1.2732

The square wave Fourier series has 5 odd harmonics, with b1 = 1.2732

Quick Answer

A Fourier series calculator for a square wave computes bₙ = 4A/(nπ) for n = 1, 3, 5, ... (odd harmonics only). For a square wave with amplitude A = 1 and the first 3 harmonics: b₁ = 4/π ≈ 1.2732, b₃ = 4/(3π) ≈ 0.4244, b₅ = 4/(5π) ≈ 0.2546. The partial sum approximates the square wave shape, with each additional harmonic reducing the Gibbs phenomenon ripple near the discontinuities.

What This Calculator Computes: Square Wave Only, Not General Fourier Transforms

This calculator finds the Fourier series coefficients for a symmetric square wave of amplitude A and period 2π. It is not a general numerical Fourier transform tool and does not accept an arbitrary function as input. It uses the closed-form result specific to the square wave: all cosine coefficients (aₙ) are zero by symmetry, and only odd sine harmonics (n = 1, 3, 5, ...) contribute.

The Square Wave Fourier Series Formula

f(t) = Σ [4A/(nπ)] × sin(nt), n = 1, 3, 5, ... bₙ = 4A/(nπ) (odd harmonics only) aₙ = 0, a₀ = 0

  • f(t) = Σ [4A/(nπ)] × sin(nt), summed over n = 1, 3, 5, ...
  • Sine coefficients: bₙ = 4A/(nπ) for odd n
  • Cosine coefficients: aₙ = 0 for all n
  • DC offset: a₀ = 0

How To Use the Fourier Series Calculator

Inputs

  • Amplitude A: the peak value of the square wave
  • Number of harmonics: the count of odd harmonics to include (e.g. 3 = n=1,3,5)

Steps

  1. Enter the amplitude A of the square wave.
  2. Enter the number of odd harmonics to compute.
  3. Read the list of bₙ coefficients.
  4. The partial sum approximating the square wave is f(t) ≈ Σ bₙ sin(nt).

Fourier Series Worked Example: A = 2, First 5 Odd Harmonics

Computing the first 5 odd harmonics (n = 1, 3, 5, 7, 9) for amplitude A = 2.

  1. n = 1: b₁ = 8/π ≈ 2.5465.
  2. n = 3: b₃ = 8/(3π) ≈ 0.8488.
  3. n = 5: b₅ = 8/(5π) ≈ 0.5093.
  4. n = 7: b₇ = 8/(7π) ≈ 0.3638.
  5. n = 9: b₉ = 8/(9π) ≈ 0.2829.

Partial sum f(t) ≈ 2.5465 sin(t) + 0.8488 sin(3t) + 0.5093 sin(5t) + 0.3638 sin(7t) + 0.2829 sin(9t).

When This Fourier Series Calculator Applies and When It Does Not

Use this calculator when studying Fourier analysis, signal processing theory, or electronics for square wave signals. It does not apply to triangle waves, sawtooth waves, or user-defined functions.

Assumptions

  • The square wave is symmetric (odd function) with amplitude A and period 2π.
  • Only odd harmonics (n = 1, 3, 5, ...) appear.
  • No DC offset.

Limitations

  • Handles standard symmetric square waves only.
  • Does not compute the partial sum value at a specific t.
  • Does not perform numerical Fourier analysis on measured data.

In Practice

In electronics, a square wave signal contains energy at the fundamental frequency and all odd harmonics. When a square wave passes through a low-pass filter, higher harmonics are attenuated, making the output progressively more sinusoidal. The Fourier series coefficients (bₙ) directly show how much energy each harmonic contributes: b₁ is the largest, and higher harmonics decrease as 1/n.

Related Guides

Frequently Asked Questions: Fourier Series Calculator

Why does the square wave only have odd harmonics?

A symmetric square wave is an odd function with half-wave symmetry: the second half of each period is the negative of the first half. This symmetry eliminates all even harmonics and all cosine terms. Only odd sine harmonics (n = 1, 3, 5, ...) are non-zero.

What is the Gibbs phenomenon?

The Gibbs phenomenon is the persistent overshoot near a jump discontinuity in a Fourier series partial sum. No matter how many harmonics you include, the partial sum overshoots the true value by approximately 9% of the jump height near the discontinuity.

What is the difference between a Fourier series and a Fourier transform?

A Fourier series represents a periodic function as a sum of sinusoids at discrete harmonically related frequencies. A Fourier transform decomposes a signal into a continuous spectrum of frequencies and applies to non-periodic or finite-length signals.

How many harmonics are enough to approximate a square wave?

The number depends on the required accuracy. With 10 harmonics, the plateaus of the square wave are approximated to within a few percent. With 100 harmonics, the approximation is visually indistinguishable except for a narrow overshoot band at each edge.

Can I use this to find coefficients for a rectangular pulse (duty cycle ≠ 50%)?

No. The 4A/(nπ) formula applies only to the symmetric 50% duty cycle square wave. A rectangular pulse with duty cycle D has a different formula: bₙ = (2A/nπ) sin(nπD), and it includes even harmonics.

Sources

Last updated: . Reviewed for accuracy against the formula shown above.