PhysSandbox
Classical MechanicsWaves & SoundElectricity & MagnetismOptics & LightGravity & OrbitsLabs
🌙Astronomy & The Sky🌡️Thermodynamics🌍Biophysics, Fluids & Geoscience📐Math Visualization🔧Engineering🧪Chemistry

More from Math Visualization

Other simulators in this category — or see all 61.

View category →
NewUniversity / research

2D Phase Portrait (ODE)

Direction field and click-to-trace trajectories for planar systems: harmonic, damped, saddle, nodes, foci, pendulum (RK4).

Launch Simulator
School

Lissajous Curves

Beautiful patterns from two frequencies with adjustable ratio.

Launch Simulator
NewKids

Harmonograph

Two damped harmonic sums in x and y: decaying rosette trace vs Lissajous loops.

Launch Simulator
NewKids

Spirograph (Trochoids)

Hypo- or epitrochoid: fixed R, rolling r, pen d; hue trail and period hints.

Launch Simulator
NewKids

Sorting Algorithms (parallel)

Bubble, insertion, merge, quicksort, and heapsort on the same shuffled permutation — five bar rows advance in lockstep so you can compare how each method moves values.

Launch Simulator
NewSchool

SIR Epidemic Model

S + I + R = 1: βSI and γI; ℛ₀ ≈ β/γ, herd threshold 1 − 1/ℛ₀; RK4 time plot.

Launch Simulator
PhysSandbox

Interactive physics, chemistry, and engineering simulators for students, teachers, and curious minds.

Physics

  • Classical Mechanics
  • Waves & Sound
  • Electricity & Magnetism

Science

  • Optics & Light
  • Gravity & Orbits
  • Astronomy & The Sky

More

  • Thermodynamics
  • Biophysics, Fluids & Geoscience
  • Math Visualization
  • Engineering
  • Chemistry

© 2026 PhysSandbox. Free interactive science simulators.

PrivacyTermsContact
Home/Math Visualization/FFT Magnitude Spectrum

FFT Magnitude Spectrum

The discrete Fourier transform (DFT) reveals how much of each sinusoidal frequency is present in a finite sequence of samples. This simulator fixes N = 256 real-valued samples x[n], computes a radix-2 fast Fourier transform (FFT) in software, and plots the magnitudes |X[k]| for frequency bins k = 0 through N/2, covering the DC component, positive-frequency bins, and the Nyquist bin. The time-domain view shows the sample sequence as a polyline; users can load presets (pure sine with an integer number of cycles in the window, two-tone mixture, band-limited square wave, centered impulse, or uniform noise) or paint the waveform directly, which switches to a custom buffer. Peak normalization in the spectrum panel emphasizes relative energy distribution. The companion Fourier Series page builds periodic waveforms by adding harmonics in the time domain; this page performs the complementary frequency-domain analysis on a fixed-length window, foreshadowing the continuous Fourier transform, windowing effects, and spectral leakage when a non-integer number of cycles is captured.

Who it's for: Undergraduate students in signals and systems, numerical analysis, or physics labs introducing spectral analysis, and anyone who already saw Fourier series and wants the discrete transform picture.

Key terms

  • Discrete Fourier Transform (DFT)
  • Fast Fourier Transform (FFT)
  • Frequency bin
  • DC component
  • Nyquist frequency
  • Magnitude spectrum
  • Time–frequency intuition
  • Spectral leakage

Signal presets

12

Discrete Fourier transform: X[k] = Σ_n x[n] e^{-2π i kn/N}. Magnitude bars use peak normalization. Draw only in the upper (time) panel — that switches to custom; pick a preset to regenerate. Click Noise again for a new sample. R resets to sine with k = 12.

Shortcuts

  • •R — sine preset, k = 12

Measured values

|X[0]| (DC)3.804e-15
Strongest k (1…N/2−1)12
|X[N/2]| (Nyquist)2.340e-14

How it works

Sample a real signal on N = 256 points, then take a radix-2 FFT. The lower panel shows magnitude |X[k]| for bins k = 0 … N/2 (DC, positive frequencies, Nyquist). A single sine with an integer number of cycles in the window gives a narrow peak; a pulse spreads energy across bins—time–bandwidth intuition before the continuous Fourier transform.

Key equations

X[k] = Σ_{n=0}^{N−1} x[n] · e^{−2π i kn/N}
|X[k]| = √(Re² + Im²) · k = 0 … N/2

Frequently asked questions

Why does the sine preset give a tall bar at one bin?
When the sine completes an integer number of full cycles across exactly N samples, its energy aligns with a single DFT basis vector (up to the conjugate symmetry mirror at N−k). That produces a concentrated peak. If you painted a sine-like wave with a non-integer number of cycles, energy would spread across neighboring bins—an example of leakage tied to implicit rectangular windowing.
Why is the impulse preset’s spectrum spread out instead of a single spike?
A single nonzero sample is the discrete analogue of a very short pulse. In the frequency domain, short time localization forces a broad spectral footprint. Conversely, a narrowband tone in frequency requires many oscillations across the window—illustrating the reciprocal relationship between duration and bandwidth.
Are the green bars power, amplitude, or something else?
They show the magnitude |X[k]| = √(Re(X[k])² + Im(X[k])²) of each complex coefficient. The display scales bars by the largest magnitude so peaks are easy to compare; absolute numbers appear in the sidebar for DC, the strongest interior bin, and Nyquist.
Does this replace a full FFT library for real engineering work?
No. It is a teaching FFT with a fixed length, no window functions beyond the implicit rectangle, no zero-padding controls, and no phase plot. Production spectrum analyzers add windowing, overlap, calibration, and often use hardware-accelerated transforms.