DFT definition:
$$X[k]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi kn/N}$$Frequency resolution: $\Delta f = f_s / N$
Windowing reduces spectral leakage
Compose up to 5 sinusoidal components and analyze the FFT frequency spectrum in real time. Understand windowing effects, spectral leakage, THD, and frequency resolution interactively.
DFT definition:
$$X[k]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi kn/N}$$Frequency resolution: $\Delta f = f_s / N$
Windowing reduces spectral leakage
The core mathematical operation is the Discrete Fourier Transform (DFT). It converts a sequence of N time-domain samples into N complex numbers representing the amplitude and phase at different frequencies.
$$X[k]=\sum_{n=0}^{N-1}x[n] \cdot e^{-j2\pi kn/N}$$Here, $x[n]$ is the n-th time sample, $X[k]$ is the k-th frequency bin (complex value), $N$ is the total number of samples (FFT Size), and $j$ is the imaginary unit. The FFT is just a super-fast way to compute this DFT.
The practical performance is governed by frequency resolution and the effect of windowing. Windowing multiplies the raw signal by a shaping function to minimize discontinuities at the edges of the analysis window.
$$x_{\text{windowed}}[n] = x[n] \cdot w[n]$$ $$\Delta f = \frac{f_s}{N}$$$w[n]$ is the window function (e.g., Hanning, Hamming). $f_s$ is the sampling frequency (samples per second). $\Delta f$ is the frequency resolution in Hz/bin—the smallest frequency separation you can reliably see. A smaller $\Delta f$ means finer resolution.
Vibration & Noise (NVH) Analysis: In automotive and aerospace engineering, microphones and accelerometers record sound and vibration. Engineers use FFT to pinpoint the exact frequencies of annoying rattles or cabin boom, which often correspond to specific engine orders or structural resonances. Choosing the right window is critical for accurate amplitude readings.
Rotating Machinery Diagnostics: The vibration spectrum of a pump, turbine, or fan is its health fingerprint. A growing spike at the shaft rotation frequency (1x) often indicates imbalance. A spike at blade-pass frequency might show wear. Engineers monitor these spectra over time for predictive maintenance, using high resolution to separate closely spaced harmonics.
Modal Testing: To understand how a bridge, airplane wing, or smartphone vibrates naturally, engineers hit it with an impact hammer or shaker. The FFT of the response signal reveals the structure's resonant frequencies (modes). Windowing is essential here to manage the leakage from the transient impact response.
Audio & Communications Engineering: From identifying feedback squeal in a sound system to analyzing the spectrum of a radio signal, FFT is the fundamental tool. In audio codecs like MP3, it's used to identify which frequency components are perceptually important. The SNR (Signal-to-Noise Ratio) control in the simulator mimics the real challenge of picking out signals from background noise.
When you first start FFT analysis, there are pitfalls that many people, myself included, often fall into. The first one is the misconception that a higher sampling frequency increases resolution. In reality, the resolution $\Delta f$ is given by $f_s / N$, so merely increasing $f_s$ actually worsens the resolution (makes $\Delta f$ larger). For example, with $f_s=1$kHz and $N=1024$, $\Delta f \approx 0.98$Hz, but if you increase $f_s$ to 2kHz, $\Delta f \approx 1.95$Hz. To improve resolution, you need to either increase $N$ or decrease $f_s$. However, $f_s$ must be at least twice the maximum frequency of the signal you want to measure (the Nyquist frequency, $f_s/2$), otherwise you can't capture those components. Striking this balance is key in practical work.
The second pitfall is overconfidence that using a window function solves everything. The Hanning window is indeed useful, but it makes amplitudes appear smaller, so you need to apply a correction factor (e.g., about 1.63 for RMS) to estimate the true amplitude. Also, applying a window can reduce time resolution. For instance, when capturing transient phenomena like impacts, a rectangular window might actually capture the timing more accurately. The professional skill is choosing the right window for the phenomenon, not just defaulting to "Hanning for everything."
Finally, the belief that the FFT point count N must be a power of two. While computational efficiency is highest this way, modern libraries and hardware are often fast enough with any number of points. More importantly, you should think backwards from your required frequency resolution $\Delta f$ and available data length to determine $N$. Even if you only have 8000 data points, you can set $f_s=8000$Hz to achieve 1Hz resolution. Try changing $N$ in this simulator to values like 512 or 1000 (non-powers of two) and see how the results change.