Discrete Fourier Transform Calculator

Compute DFT and FFT of discrete signals. Visualize time and frequency domains with interactive graphs. Essential signal processing tool for engineers and students.

DFT Formula: For a sequence x[n] of length N, the DFT X[k] is:

X[k] = Σn=0N-1 x[n] · e-j2πkn/N

where k = 0, 1, ..., N-1, and j = √(-1) is the imaginary unit

Enter comma-separated real or complex values. For complex numbers, use format: real+imagj (e.g., 3+4j)
Sine Wave (8 samples)
Rectangular Pulse
Triangular
Cosine Wave
Alternating
Samples per second (affects frequency axis)
DFT is exact; FFT is faster for powers of 2
For FFT, powers of 2 are optimal
10 Hz
1.0
0.0
Select a Preset Signal
Pure Sine Wave

Single frequency sinusoid

Square Wave

Periodic on/off signal

Two-Tone Signal

Sum of two sine waves

Impulse Train

Periodic impulses

Chirp Signal

Frequency increases with time

Noisy Sine

Sine wave with added noise

Computing Transform...

Understanding the Discrete Fourier Transform

The Discrete Fourier Transform (DFT) converts a finite sequence of equally-spaced samples of a function into a same-length sequence of equally-spaced samples of the discrete-time Fourier transform (DTFT). It's a fundamental tool in digital signal processing.

DFT Definition:

For a sequence x[n] of length N, the DFT X[k] is defined as:

X[k] = Σn=0N-1 x[n] · e-j2πkn/N

where:

  • X[k] is the k-th frequency component (complex number)
  • x[n] is the n-th time domain sample
  • N is the total number of samples
  • j is the imaginary unit (√-1)
  • k = 0, 1, ..., N-1 (frequency index)
  • n = 0, 1, ..., N-1 (time index)

Inverse DFT (IDFT):

x[n] = (1/N) · Σk=0N-1 X[k] · ej2πkn/N

The IDFT reconstructs the original time-domain signal from its frequency components.

Properties of the DFT

Property Time Domain Frequency Domain
Linearity a·x[n] + b·y[n] a·X[k] + b·Y[k]
Time Shift x[n - m] X[k] · e-j2πkm/N
Frequency Shift x[n] · ej2πmn/N X[k - m]
Circular Convolution x[n] ⊛ y[n] X[k] · Y[k]
Parseval's Theorem Σ |x[n]|² (1/N) Σ |X[k]|²
Symmetry (Real x[n]) x[n] real X[k] = X*[N-k] (conjugate symmetric)

DFT vs. FFT

1

DFT (Discrete Fourier Transform): Direct implementation of the DFT formula. Computational complexity is O(N²), which makes it inefficient for large N.

2

FFT (Fast Fourier Transform): An algorithm that efficiently computes the DFT. Most common implementation is the Cooley-Tukey algorithm with complexity O(N log N). Requires N to be a power of 2 for optimal performance.

3

Comparison: FFT produces identical results to DFT but much faster. For N=1024 samples, DFT requires ~1 million operations while FFT requires only ~10,000 operations.

Interpretation of DFT Results

k = 0
DC Component (Average Value)
k = 1 to N/2 - 1
Positive Frequencies
k = N/2
Nyquist Frequency
k = N/2 + 1 to N-1
Negative Frequencies

Frequency Resolution: Δf = Fs / N

where Fs is the sampling rate and N is the number of samples.

The frequency at bin k is: fk = k · Δf for k = 0 to N/2, and fk = (k - N) · Δf for k = N/2+1 to N-1.

Applications of DFT/FFT

  • Audio Processing: Spectrum analysis, equalization, compression
  • Image Processing: Filtering, compression (JPEG), pattern recognition
  • Communications: OFDM, channel estimation, modulation
  • Radar/Sonar: Target detection, Doppler analysis
  • Medical Imaging: MRI, ultrasound, ECG analysis
  • Vibration Analysis: Machinery monitoring, structural analysis

Frequently Asked Questions

DFT refers to the mathematical transformation itself, while FFT is an algorithm to compute the DFT efficiently. The FFT is not a different transform but rather a fast method to compute the DFT. The most common FFT algorithm (Cooley-Tukey) requires the number of samples to be a power of 2 for maximum efficiency.

The Nyquist frequency is half the sampling rate (Fs/2). According to the Nyquist-Shannon sampling theorem, a continuous signal can be perfectly reconstructed from its samples if it contains no frequency components above the Nyquist frequency. Frequencies above the Nyquist frequency appear as aliases (false lower frequencies) in the DFT results.

Negative frequencies appear mathematically because the DFT decomposes signals into complex exponentials (ejωt). For real-valued signals, the negative frequency components are the complex conjugates of the positive frequency components. They contain the same information as positive frequencies and together represent amplitude and phase of sinusoidal components.

Zero-padding means adding zeros to the end of a signal before computing its DFT. This increases N and improves frequency resolution in the DFT result (smaller Δf). However, it doesn't add new information - it just interpolates between the existing frequency bins. Zero-padding is useful for obtaining smoother frequency plots and for making N a power of 2 for FFT efficiency.

The magnitude |X[k]| represents the amplitude of the frequency component at bin k. The phase ∠X[k] represents the phase shift of that component relative to a cosine wave at time 0. For real signals, the magnitude spectrum is symmetric about the Nyquist frequency, while the phase spectrum is antisymmetric.