Fourier Series Explorer Interactive Lab

Deconstruct arbitrary data points into fundamental and harmonic sinusoids

Presets:
Sparse (8) Standard (64) Dense (256)
12
Fundamental (1) Rich (25) Max (50)
Speed
1

Sampled Discrete Signal: $y_k = f(x_k)$

Uniformly spaced sample points across $[0, 2\pi]$ with step $\Delta x = \frac{2\pi}{M}$. Click or drag to sculpt values.

Discrete Points Continuous Curve M = 64 samples
💡 Drag or draw to modify sample values. Adjust the Samples ($M$) slider to observe resolution effects.
2

Fourier Series Synthesis: Reconstructed Wave $S_N(x)$

Sum of DC offset $a_0/2$ plus the first $N$ harmonics superimposed over your sampled points.

$S_N(x)$ Sum
Mean Sq Err: 0.0000
3

Harmonic Decomposition: Fundamental ($n=1$) & Overtones

Every constituent sinusoidal term $y_n(x) = a_n \cos(nx) + b_n \sin(nx) = c_n \cos(nx - \phi_n)$ computed via numerical integration.

View format:
DC Component (n=0) Average signal value:
$\frac{a_0}{2} = \frac{1}{M}\sum_{k=0}^{M-1} y_k =$ 0.000

📚 Educational Theory: Sampling Density & Discrete Fourier Approximations

How numerical discrete samples $M$ approximate continuous integrals and introduce Nyquist limits.

1. Discrete Summation Approximation (Trapezoidal Rule)

When dealing with $M$ discrete data points sampled at $x_k = \frac{2\pi k}{M}$, we approximate continuous Fourier integrals using discrete Riemann / trapezoidal sums:

$$a_0 \approx \frac{2}{M} \sum_{k=0}^{M-1} y_k$$
$$a_n \approx \frac{2}{M} \sum_{k=0}^{M-1} y_k \cos(n x_k), \quad b_n \approx \frac{2}{M} \sum_{k=0}^{M-1} y_k \sin(n x_k)$$

As the number of data points $M \to \infty$, this approximation converges directly to the exact continuous Fourier series coefficients.

2. The Nyquist-Shannon Sampling Constraint & Aliasing

By the Nyquist-Shannon sampling theorem, to resolve a harmonic of frequency $n$, your discrete sampling frequency must be at least twice the frequency of that harmonic:

$$f_{\text{sampling}} \ge 2 f_{\max} \implies M \ge 2N$$

Try lowering the sample slider to $M = 16$ while requesting $N = 25$ harmonics. Notice how higher harmonics fail to resolve or alias into spurious lower frequencies.