Skip to content
    Engineering / Discrete Fourier Transform Signal Matrix

    Discrete Fourier Transform (DFT) Calculator

    Compute the DFT spectrum of a signal with selectable windows, FFT cross-check and Parseval energy validation. Free, runs in your browser, no signup.

    ToolCalculatorExecutionIn browserCategoryEngineering
    ZorvLabs Signal LabFFT / DFT / Parseval

    Discrete Fourier Transform Signal Analysis

    Sample Count
    64
    Windowed record length
    Dominant Bin
    6.000 Hz
    |X[k]| peak: 15.7511
    Parseval Error
    <1e-12
    Energy consistency check
    FFT vs DFT Delta
    <1e-12
    Max complex deviation
    Time Domain

    Original vs windowed vs reconstructed

    09182736455463-1.6-0.800.81.6
    • Original
    • Windowed
    • Reconstructed
    Frequency Domain

    Magnitude spectrum in DFT bins

    32.00-20.00-8.004.0016.0028.000.004.008.0012.0016.00
    • Magnitude
    Diagnostics

    Transform integrity metrics

    Energy Time
    15.3854
    Energy Freq
    15.3854
    FFT RMS Delta
    <1e-12
    Reconstruction RMSE
    <1e-12
    Equation set in use
    X[k] = Σn=0N−1 x[n] · e−j2πkn/N
    x[n] = (1/N) Σk=0N−1 X[k] · e+j2πkn/N
    f[k] = fftfreq(N, Δt) / fftshift for centered display
    Parseval: Σ|x[n]|² = (1/N) Σ|X[k]|²
    Dominant: 6.000 HzCentroid: 8.493 Hz90% Bandwidth: 13.000 HzNyquist: 32.000 Hz
    DFT Matrix

    Twiddle-factor preview (first 8×8)

    W[0,0]
    1.00 + 0.00i
    W[0,1]
    1.00 + 0.00i
    W[0,2]
    1.00 + 0.00i
    W[0,3]
    1.00 + 0.00i
    W[0,4]
    1.00 + 0.00i
    W[0,5]
    1.00 + 0.00i
    W[0,6]
    1.00 + 0.00i
    W[0,7]
    1.00 + 0.00i
    W[1,0]
    1.00 + 0.00i
    W[1,1]
    1.00 -0.10i
    W[1,2]
    0.98 -0.20i
    W[1,3]
    0.96 -0.29i
    W[1,4]
    0.92 -0.38i
    W[1,5]
    0.88 -0.47i
    W[1,6]
    0.83 -0.56i
    W[1,7]
    0.77 -0.63i
    W[2,0]
    1.00 + 0.00i
    W[2,1]
    0.98 -0.20i
    W[2,2]
    0.92 -0.38i
    W[2,3]
    0.83 -0.56i
    W[2,4]
    0.71 -0.71i
    W[2,5]
    0.56 -0.83i
    W[2,6]
    0.38 -0.92i
    W[2,7]
    0.20 -0.98i
    W[3,0]
    1.00 + 0.00i
    W[3,1]
    0.96 -0.29i
    W[3,2]
    0.83 -0.56i
    W[3,3]
    0.63 -0.77i
    W[3,4]
    0.38 -0.92i
    W[3,5]
    0.10 -1.00i
    W[3,6]
    -0.20 -0.98i
    W[3,7]
    -0.47 -0.88i
    W[4,0]
    1.00 + 0.00i
    W[4,1]
    0.92 -0.38i
    W[4,2]
    0.71 -0.71i
    W[4,3]
    0.38 -0.92i
    W[4,4]
    0.00 -1.00i
    W[4,5]
    -0.38 -0.92i
    W[4,6]
    -0.71 -0.71i
    W[4,7]
    -0.92 -0.38i
    W[5,0]
    1.00 + 0.00i
    W[5,1]
    0.88 -0.47i
    W[5,2]
    0.56 -0.83i
    W[5,3]
    0.10 -1.00i
    W[5,4]
    -0.38 -0.92i
    W[5,5]
    -0.77 -0.63i
    W[5,6]
    -0.98 -0.20i
    W[5,7]
    -0.96 + 0.29i
    W[6,0]
    1.00 + 0.00i
    W[6,1]
    0.83 -0.56i
    W[6,2]
    0.38 -0.92i
    W[6,3]
    -0.20 -0.98i
    W[6,4]
    -0.71 -0.71i
    W[6,5]
    -0.98 -0.20i
    W[6,6]
    -0.92 + 0.38i
    W[6,7]
    -0.56 + 0.83i
    W[7,0]
    1.00 + 0.00i
    W[7,1]
    0.77 -0.63i
    W[7,2]
    0.20 -0.98i
    W[7,3]
    -0.47 -0.88i
    W[7,4]
    -0.92 -0.38i
    W[7,5]
    -0.96 + 0.29i
    W[7,6]
    -0.56 + 0.83i
    W[7,7]
    0.10 + 1.00i
    Window Peak
    0.9994
    Max coefficient in selected window
    Input Peak
    1.5432
    Maximum absolute sample amplitude
    kf[k]|X[k]|∠X[k]
    16.000 Hz15.751076-1.5708 rad
    2-6.000 Hz15.7510761.5708 rad
    3-13.000 Hz8.6668990.9427 rad
    413.000 Hz8.666899-0.9427 rad
    5-5.000 Hz8.059690-1.5218 rad
    65.000 Hz8.0596901.5218 rad
    77.000 Hz8.0573581.6199 rad
    8-7.000 Hz8.057358-1.6199 rad
    Reference Samples

    First 12 record points

    ntx[n]w[n]xw[n]x̂[n]e[n]
    00.000000.3232820.0000000.0000000.0000001.67e-16
    10.015631.0752140.0024850.0026710.0026716.81e-15
    20.031250.9022870.0099140.0089450.0089457.28e-15
    30.046880.4486060.0222140.0099650.0099651.07e-15
    40.062500.4197330.0392620.0164790.016479-3.75e-15
    50.078130.5604290.0608890.0341240.034124-6.83e-15
    60.093750.1167950.0868810.0101470.0101471.84e-16
    70.10938-0.9068260.116978-0.106079-0.1060796.66e-16
    80.12500-1.5432290.150882-0.232845-0.2328459.99e-16
    90.14063-1.0714950.188255-0.201714-0.2017141.55e-15
    100.156250.0211940.2287270.0048480.0048482.02e-15
    110.171880.6695940.2718950.1820590.1820593.16e-15
    ●DFT matrix model//N = 64//Δt = 0.01563 s//fs = 64.000 Hz//Direct DFT = authoritative//FFT = validation path//Parseval err <1e-12
    engineering methodology

    A clear path from inputs to results.

    See exactly which frequencies make up a sampled signal. This tool takes a time-domain record — built-in tones, chirps, impulses, or your own pasted samples — applies an optional window, and computes its discrete Fourier transform spectrum, cross-checked against a fast Fourier transform and against Parseval's energy theorem so you can trust every bin.

    Step-by-step methodWorked exampleAssumptions explained

    How to use

    1. Pick a signal preset (two-tone superposition, chirp, impulse, step, square, Gaussian burst) or choose Custom and paste your own comma- or space-separated real samples.
    2. Set the sample count N (it snaps to 16, 32, 64, 128, or 256 so the radix-2 FFT cross-check stays exact) and the sample spacing Δt, which fixes the sample rate fs = 1/Δt and the bin spacing fs/N.
    3. For the tone presets, set the two frequencies, amplitudes, phases, and any DC offset; for chirp set the sweep rate, for the Gaussian set its width.
    4. Choose a window — rectangular, Hann, Hamming, or Blackman — to trade frequency resolution against spectral leakage.
    5. Read the magnitude spectrum, the dominant bin, the spectral centroid, and the 90% bandwidth; toggle fftshift to center zero frequency, and watch the Parseval error and FFT-vs-DFT delta confirm the transform is numerically exact.

    The formula

    Reference: Oppenheim & Schafer, Discrete-Time Signal Processing (DFT, Parseval's relation); Cooley–Tukey radix-2 FFT (Math. Comp. 19, 1965); window definitions from Harris, "On the use of windows", Proc. IEEE 66 (1978).

    Worked example

    Single 6 Hz tone, 64 samples, rectangular window

    Inputs
    • Tone preset with one sine: f1 = 6 Hz, amplitude A1 = 1, phase 0; second tone amplitude 0; DC offset 0; N = 64 samples; sample spacing Δt = 1/64 s (sample rate 64 Hz, record length 1 s); rectangular window.
    Calculation path
    1. 1

      The 1-second record holds exactly 6 cycles of the sine, so the tone lands precisely on bin k = 6 because the bin spacing is fs/N = 64/64 = 1 Hz. Evaluating X[k] = Σ x[n] e^(−j2πkn/N) concentrates all the energy into the two conjugate bins k = 6 and k = N−6 = 58. For a real sine of amplitude 1 each of those bins has magnitude A·N/2 = 1 × 64 / 2 = 32, while every other bin is zero apart from floating-point rounding of order 1e−13. Parseval's theorem checks out: the time-domain energy Σ|x[n]|² = 32 equals (1/N)Σ|X[k]|² = (32² + 32²)/64 = 32.

    Result

    |X[6]| = |X[58]| = 32.0, sitting at ±6 Hz; all other bins ≈ 0. The energy is 32 in both domains (Parseval error ~1e−15), and the FFT validation path matches the direct DFT to better than 1e−12.

    Interpreting the result

    Each bin k corresponds to frequency k·fs/N up to the Nyquist frequency fs/2; bins above N/2 represent negative frequencies, which is why fftshift centers the display. A real tone always shows as a conjugate pair, and a tone that completes a whole number of cycles in the record falls on a single bin at magnitude A·N/2. When a tone sits between bins, its energy spreads into neighboring bins (spectral leakage) — that is what the Hann, Hamming, and Blackman windows suppress, at the cost of a slightly wider main lobe and lower resolution.

    Assumptions & limitations

    • The input is treated as a finite, uniformly sampled, real-valued sequence; the transform assumes it repeats periodically, so discontinuities between the last and first sample create leakage.
    • Sample count is restricted to 16, 32, 64, 128, or 256 so the radix-2 FFT used for the cross-check is exact; the authoritative result is the direct matrix DFT.
    • Frequencies above the Nyquist limit fs/2 alias to lower bins; the tool does not anti-alias the preset generators, so choose Δt small enough for your highest frequency.
    • Windowing multiplies the samples before the transform, so reported magnitudes of windowed signals are scaled by the window and are not directly comparable to the un-windowed amplitude A·N/2.
    • Reconstruction via the inverse DFT returns the windowed samples, not the original un-windowed signal, when a non-rectangular window is applied.

    Frequently asked questions

    Why does a single tone show up as two spikes?

    A real-valued sine is mathematically a sum of a positive and a negative frequency, e^(+jωt) and e^(−jωt). The DFT of a real signal is therefore conjugate-symmetric, so a 6 Hz tone appears at both +6 Hz (bin 6) and −6 Hz (bin 58 of 64). Each carries magnitude A·N/2, so a unit-amplitude tone over 64 samples gives 32 in each bin.

    When should I use a window instead of rectangular?

    Use a window whenever your signal does not complete a whole number of cycles in the record — which is almost always true for real measured data. The rectangular window gives the sharpest frequency resolution but leaks energy into nearby bins when a tone falls between bins. Hann and Hamming reduce that leakage; Blackman reduces it further. The trade-off is a wider main lobe, so closely spaced tones become harder to separate.

    How do I read the frequency axis?

    Bin k maps to frequency k·fs/N, where fs = 1/Δt is the sample rate. The maximum unambiguous frequency is the Nyquist frequency fs/2. With fftshift enabled the axis runs from −fs/2 to +fs/2 with zero frequency (DC) in the middle; with it disabled, bins 0 to N/2 are positive frequencies and the rest are negative frequencies wrapped to the top of the array.

    What is the difference between the DFT and the FFT here?

    They compute the same thing. The direct DFT evaluates the full matrix sum X[k] = Σ x[n] e^(−j2πkn/N) and is the authoritative result shown. The FFT is a radix-2 Cooley–Tukey algorithm that produces the identical spectrum far faster; the tool runs both and reports their maximum difference, which stays below 1e−12, as an internal correctness check.

    What does the Parseval error tell me?

    Parseval's theorem says the signal's energy is the same whether measured in time or frequency: Σ|x[n]|² = (1/N)Σ|X[k]|². The tool computes both sides and reports their relative difference. A value near machine precision (below 1e-12) confirms the transform conserved energy and nothing was lost or fabricated numerically.

    Methodology last reviewed 2026-10-06. Results are informational and not financial or engineering advice — see our disclaimer.