Window Functions
Reduce spectral leakage in FFT analysis.
Common Windows
Rectangular (No Window)
$$w[n] = 1$$
Hanning
$$w[n] = 0.5 \left(1 - \cos\left(\frac{2\pi n}{N-1}\right)\right)$$
Hamming
$$w[n] = 0.54 - 0.46\cos\left(\frac{2\pi n}{N-1}\right)$$
Blackman
$$w[n] = 0.42 - 0.5\cos\left(\frac{2\pi n}{N-1}\right) + 0.08\cos\left(\frac{4\pi n}{N-1}\right)$$
Implementation
1import numpy as np
2
3# Built-in windows
4window = np.hanning(N)
5window = np.hamming(N)
6window = np.blackman(N)
7
8# Apply window
9windowed_signal = signal * window
10
11# Then FFT
12fft_result = np.fft.fft(windowed_signal)
Window Selection
| Window | Main Lobe Width | Side Lobe Level | Use Case |
|---|---|---|---|
| Rectangular | Narrow | High (-13 dB) | Known periodic signals |
| Hanning | Medium | Medium (-32 dB) | General purpose |
| Hamming | Medium | Medium (-43 dB) | General purpose |
| Blackman | Wide | Low (-58 dB) | High dynamic range |
Further Reading
Related Snippets
- Convolution
Linear systems and filtering operations - Correlation
Signal similarity and pattern matching - Fourier Transform
DFT, FFT, and frequency analysis - Laplace Transform
S-domain analysis and transfer functions - Sampling Theory
Nyquist theorem, reconstruction, and interpolation - Signal Theory Basics
Fundamental concepts in signal processing