Fourier Transform Calculator
Analyze signals in time and frequency domains with Fourier transforms, spectra, and visual step-by-step solutions.
Background
A Fourier transform rewrites a signal as a combination of frequencies. This calculator helps students connect the time-domain graph with the magnitude spectrum, phase spectrum, dominant frequencies, Nyquist limit, and common transform patterns.
How to use this calculator
- Choose Preset signal, Sample data / DFT, or Compare signals.
- Set the sample rate and number of samples, or paste your own sample data.
- Click Calculate Fourier Transform.
- Use the time-domain waveform, magnitude spectrum, phase spectrum, dominant frequency badges, and Nyquist marker to interpret the result.
How this calculator works
- For preset signals, the calculator generates evenly spaced samples and computes a numeric DFT.
- For pasted sample data, it uses the direct DFT formula to compute real, imaginary, magnitude, and phase values for each frequency bin.
- It plots only the nonnegative frequency bins from 0 to the Nyquist frequency.
- The formula lookup explains the corresponding continuous transform pattern when a common signal has a standard transform pair.
Formula & Equations Used
Continuous Fourier transform: X(f) = ∫ x(t)e−i2πftdt
Inverse transform: x(t) = ∫ X(f)ei2πftdf
Discrete Fourier transform: X[k] = Σ x[n]e−i2πkn/N
Frequency bin: fk = kfs/N
Nyquist frequency: fN = fs/2
Example Problems & Step-by-Step Solutions
Example 1: Sine wave with a clear spectrum peak
Given: A sine wave with frequency f₀ = 8 Hz, sample rate fs = 64 Hz, and N = 64 samples.
Step 1: Find the frequency-bin spacing:
Δf = fs / N = 64 / 64 = 1 Hz
Step 2: Find the matching frequency bin:
k = f₀ / Δf = 8 / 1 = 8
Step 3: Interpret the spectrum. The magnitude spectrum should show a strong peak near 8 Hz.
Answer: The dominant frequency is about 8 Hz, which matches the sine wave frequency.
Example 2: Narrow pulse and spectrum width
Given: Compare a narrow rectangular pulse with a wider rectangular pulse using the same sample rate and sample count.
Step 1: A narrow pulse changes quickly in time, meaning it has sharp edges.
Step 2: Sharp edges require many frequency components to reconstruct the signal.
Step 3: The Fourier transform of a rectangular pulse has a sinc-like spectrum.
Interpretation: Narrower pulse in time → wider spread in frequency.
Answer: The narrow pulse produces a broader magnitude spectrum than the wide pulse.
Example 3: Time shift and phase change
Given: A signal is shifted in time while keeping the same general shape.
Step 1: Compare the original signal and the shifted signal in the time-domain graph.
Step 2: Check the magnitude spectrum. For many time shifts, the magnitude pattern stays similar.
Step 3: Check the phase spectrum. A time shift changes phase across frequency bins.
Interpretation: Magnitude tells how much of each frequency is present; phase helps tell where those frequency components line up in time.
Answer: A time shift may leave magnitude mostly unchanged, but it changes phase.
Common mistakes to avoid
- Do not ignore the sample rate. The frequency axis depends on fs.
- Do not treat DFT bin number as frequency. Use fk = kfs/N.
- Do not sample too slowly. Frequencies above Nyquist can appear as lower false frequencies.
- Do not use magnitude only when phase is important. Time shifts can change phase even when magnitude stays similar.
Frequently Asked Questions
What is a Fourier transform?
A Fourier transform rewrites a signal in terms of frequencies, showing how much of each frequency is present.
What is the difference between FT, DFT, and FFT?
The Fourier transform is the continuous idea, the DFT is the discrete sampled calculation, and the FFT is a fast algorithm for computing the DFT.
Why does the calculator show a Nyquist marker?
The Nyquist frequency is half the sample rate. Frequencies above it can alias, meaning they can appear as incorrect lower frequencies in sampled data.
Why are frequency bins spaced apart?
Frequency spacing equals sample rate divided by number of samples, so using more samples or a lower sample rate makes the frequency bins closer together.