01 · Draw and reconstruct

512 samples · one repeating period

Your signal x(t)

Drawing locked
Choose a drawing tool to edit the signal with a pointer or the arrow keys.

Choose a drawing tool to edit. Select the active tool again to lock the signal.

The approximation x̂(t)

TargetSum
The target and its sinusoidal approximation share these time axes.

Move the sinusoidal-terms slider to improve the sum. Dashed blue is the target.

Each added term keeps its measured amplitude and phase. Some frequency bins have zero amplitude.

of 256 + DC offset
0 · offset only256 · all sample detail
RMS error—Lower is closer
Signal energy retained—Includes the DC offset
DC offset—The mean of your signal
Sharp edges need higher frequencies.

02 · Read the FFT spectrum

Amplitude + phase

One bar per frequency

IncludedDC shown above
Each bar shows the amplitude of a cosine component in the input signal.

Phase (degrees)

Dots for nonzero amplitudes
Phase shifts each sinusoid in time.
Amplitude Phase

Frequency k means k cycles per period, or k/T Hz when the period T is in seconds. Select a bar to inspect it.

Learning guide · from a drawing to a Fourier transform

What is being decomposed?

Your drawing defines 512 equally spaced samples of one period T. The FFT computes their discrete Fourier transform (DFT). Each frequency bin supplies an amplitude and phase for a sinusoid.

The DC term is the signal’s mean. It stays in every approximation. The slider adds frequency terms from low to high, including any bins whose amplitude is zero.

Why does the sum improve?

The sampled sinusoids are orthogonal. Adding their measured contributions preserves more signal energy and reduces the RMS error.

At 256 terms, the sum reproduces every stored sample to numerical precision. The curves between samples show the periodic sinusoidal interpolation.

Amplitude and phase work together

Aₖ sets a cosine’s height. φₖ sets its horizontal shift. Both are required to recover the signal. Colored bars and phase dots appear as their terms enter the sum. Enable “Show expected FFT” to also see the remaining components in gray.

Why do sharp edges ring?

A finite sum of smooth sinusoids rounds sharp corners and can overshoot near jumps (the Gibbs phenomenon). More terms narrow the ringing region; error at each individual time need not decrease.

The drawing repeats. A mismatch between its ends creates a jump at the boundary. The highest frequency is 256 cycles per period, the Nyquist limit for these 512 samples. Its amplitude uses a single bin; lower positive frequencies combine conjugate pairs.

For a nonperiodic continuous signal, the Fourier transform uses a continuous frequency spectrum. This simulator demonstrates its sampled, finite-record counterpart.

DFT and FFT conventions · NumPy documentation