Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

DSP: spectral estimation, windows, resampling and multirate processing

The previous chapter shaped signals with filters. This one measures them and changes their sampling rate. Spectral estimation asks how a signal’s power is distributed over frequency: the periodogram and Welch’s average, the spectrogram for signals that change, the Lomb-Scargle periodogram for irregular samples, models that resolve finer than the DFT allows, and wavelets that analyse many scales at once. Windows control the leakage that every finite record suffers. Multirate processing changes the sampling rate efficiently and splits signals into channels.

The central questions

  • Resolution or dynamic range? A window’s main lobe sets how close two components can be; its side lobes set how weak one can be next to a strong one. Parametric methods buy resolution with assumptions.
  • Bias or variance? Longer segments give finer frequency resolution; more segments give steadier estimates. The record length fixes the product.
  • Time or frequency? A spectrogram trades one for the other uniformly; wavelets trade them differently at each scale; the analytic signal gives an instantaneous frequency for narrow-band signals.
  • How to change the rate cheaply? Compute only the samples that are kept, from only the samples that are not zero: polyphase filters, half-band stages and multiplier-free CIC filters.

Testing against SciPy

Every window function, in symmetric and periodic forms, is compared with scipy.signal.windows in the window entry. The other computations:

Table 15.1. Spectral routines against SciPy.

SciPy function and caselargest difference ÷ largest value
periodogram hann density2.0e-16
welch hann 64/32 linear spectrum5.2e-17
hilbert 642.4e-16
czt 20 points2.6e-15
lombscargle unnormalized3.8e-15
upfirdn up 30.0e0
upfirdn up 3 down 20.0e0
levinson order 84.1e-15
stft hann 64/162.1e-16
spectrogram hann 64/16 density4.3e-16
square period 80.0e0
find_peaks all0.0e0
find_peaks height 0.80.0e0
find_peaks threshold 0.40.0e0
find_peaks distance 120.0e0
find_peaks prominence 10.0e0
find_peaks prominence 1 wlen 150.0e0
find_peaks width 2-60.0e0
find_peaks width 3 rel_height 10.0e0
find_peaks plateau_size 2 (rounded signal)0.0e0

In the library

All of these are in lib_jsl_dsp (API reference): windows in discrete::windows, spectral methods in discrete::spectral, resamplers in discrete::resampling, and Fourier integrals in continuous::spectral.

You needUseEntry
A taper for spectral analysis or filter designgenerate_window, WindowType, hann, kaiser, chebwin, dpss, …Window functions
A power spectrum, a spectrogram, or a spectrum of irregular samplesperiodogram, welch, stft, istft, spectrogram, lomb_scarglePower spectra
A few DFT bins, a zoomed band, or a Fourier integralgoertzel, chirpz, fourier_integralSpectra at chosen frequencies
An envelope or instantaneous frequencyanalytic_signal, hilbert_transform, instantaneous_attributesHilbert transform
Resolution beyond the DFT; a linear-prediction modellevinson_durbin, linear_predictive_coding, burg, musicParametric spectra
The peaks of a signal or spectrum, with their prominences and widthsfind_peaks, peak_prominences, peak_widthsPeak finding
Group delay, minimum phase, least-squares FIR design, decimation, FFT resampling, median filtering, cross spectra and coherencegroup_delay, minimum_phase, firls, decimate, resample, medfilt, csd, coherenceSignal-processing utilities
Partial fractions of a transfer function; deconvolution; zero-pole-gain conversionsresidue, residuez, deconvolve, tf2zpk, ss2zpkPartial fractions, zoom FFT and waveforms
A finely spaced spectrum on a narrow bandzoom_fftPartial fractions, zoom FFT and waveforms
Chirps, Gaussian pulses, sawtooth and square test signalschirp, sweep_poly, gausspulse, sawtooth, square_wavePartial fractions, zoom FFT and waveforms
Multiscale analysis, compression or denoisingdwt, wavedec, waverec, continuous_wavelet_transformWavelet transforms
A different sampling ratePolyphaseIntegerResampler, PolyphaseArbitraryResampler, HalfBandDecimator, CicDecimatorResampling
Many frequency channels, and recombining them*PolyphaseAnalysisFilterBank, *PolyphaseSynthesisFilterBankPolyphase filter banks