Digital signal processing (source code)

= Digital signal processing

<Digital signal processing> transforms or analyzes signals represented by numerical sequences. A physical input commonly passes through <signal sampling> and <quantization (signal processing)> before an algorithm filters or transforms it. Sampling chooses times; quantization chooses a finite set of representable values. A <discrete-time signal> is a sequence indexed by integers, whereas a digital implementation also has finite precision.<What the Nyquist Criterion Means to Your Sampled Data System Design by Walt Kester>[MT-002, introductory sampling chain and sampled spectra]{ref}

An elementary digital filter averages adjacent samples:
$$
y[n]=\frac{x[n]+x[n-1]}2.
$$
For a constant sequence it preserves the value. For an alternating sequence $x[n]=(-1)^n$ it gives zero. If the input noise samples are independent with variance $\sigma^2$, the output noise variance is $\sigma^2/2$, but neighboring output samples are now correlated because they share an input sample. Smoothing changes both the signal and its noise statistics.

Sampling can also erase distinctions before any algorithm runs. At sampling frequency $1000\,\mathrm{Hz}$,
$$
\cos\left(2\pi\frac{600n}{1000}\right)=\cos\left(2\pi\frac{400n}{1000}\right)\qquad(n\in\mathbb Z).
$$
These distinct analog frequencies produce the same samples. An <anti-aliasing filter> limits unwanted input frequencies before conversion; later computation cannot uniquely recover which of these unrestricted inputs produced the sequence.<What the Nyquist Criterion Means to Your Sampled Data System Design by Walt Kester>[MT-002, Nyquist-zone folding and anti-aliasing discussion]{ref}

<Fourier analysis> and the <discrete Fourier transform> help reveal frequency content, while finite-word arithmetic introduces an additional error budget. The sampling rate, numerical representation and intended physical bandwidth are therefore part of the processing design.