Sampling Theory
Convert between continuous and discrete-time signals.
Nyquist-Shannon Sampling Theorem
A bandlimited signal with maximum frequency $f_{max}$ can be perfectly reconstructed if:
$$ f_s \geq 2f_{max} $$
Reconstruction
Ideal (Sinc Interpolation)
$$ x(t) = \sum_{n=-\infty}^{\infty} x[n] \cdot \text{sinc}\left(\frac{t - nT_s}{T_s}\right) $$
Where $\text{sinc}(x) = \frac{\sin(\pi x)}{\pi x}$.
Practical (Linear Interpolation)
1from scipy import interpolate
2
3# Linear interpolation
4f = interpolate.interp1d(t_samples, x_samples, kind='linear')
5x_interp = f(t_new)
6
7# Cubic spline
8f = interpolate.interp1d(t_samples, x_samples, kind='cubic')
Upsampling & Downsampling
1from scipy import signal
2
3# Upsample by factor of L
4x_up = signal.resample(x, len(x) * L)
5
6# Downsample by factor of M (with anti-aliasing)
7x_down = signal.decimate(x, M)
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 - Signal Theory Basics
Fundamental concepts in signal processing - Window Functions
Spectral leakage reduction for FFT analysis