Signals / complex Fourier series
Fourier Sketch
Draw a path. The browser samples it as a periodic complex signal, finds its Fourier coefficients, and rebuilds the drawing with rotating vectors.
Draw → decompose → trace
Drag one continuous stroke in the field. The cyan dashed source is closed before sampling; magenta is its retained Fourier reconstruction.
Signal controls
More components retain more detail; the largest amplitudes are added first.
Sampling ledger
Every component is one complex coefficient: a radius, a phase, and an integer rotation frequency. Their vector sum is the tracing point.
All 128 terms exactly reproduce this 128-sample signal. More than 128 terms would add no information unless the sketch is sampled more densely.
Dominant components
The circle radii in the canvas are coefficient amplitudes.
| rank | frequency | amplitude | phase | relative radius |
|---|---|---|---|---|
| 1 | -1 | 0.693 | 90° | |
| 2 | +2 | 0.094 | -90° | |
| 3 | -3 | 0.085 | -90° | |
| 4 | -2 | 0.066 | -90° | |
| 5 | -4 | 0.057 | -90° | |
| 6 | +1 | 0.042 | -90° | |
| 7 | +0 | 0.039 | 90° | |
| 8 | +4 | 0.031 | -90° |
The equation behind the pen
The direct discrete Fourier transform (DFT) computes the cₖ values from 128 evenly spaced samples. Using all 128 coefficients reconstructs that sampled periodic signal. A 1024-term version would need 1024 samples and a faster FFT, otherwise it would only duplicate frequency information.
A freehand path is not naturally periodic, so this demo closes the final point back to the first before taking the DFT. Try a loop for the cleanest reconstruction.