65  Discrete-time systems and signal processing

Sampling, filtering, and recurrence

A sensor does not hand you a continuous function. It hands you numbers at intervals. A microphone gives a stream of samples. A controller updates once per cycle. Once time is sampled, the mathematics changes shape: derivatives become recurrences, spectra pick up aliasing, and filters become algorithms.

Upper-year engineering is full of systems that are modelled in continuous time but built in discrete time. A motor may obey a differential equation. The controller that stabilises it still runs on a clock. A seismic wave may be continuous in the ground. The data still arrives as a sampled trace.

Sampling turns a continuous object into a sequence, and once you have a sequence, the natural questions become delay, recurrence, convolution, spectrum, and stability. That structural shift — not signal processing vocabulary — is what this chapter is about.


65.1 What this chapter helps you do

Symbols to keep handy

These are the bits of notation you'll see a lot. If a line of symbols feels like a fence, read it out loud once, then keep going.

  • y[n] = _{k=0}^{M} b_k x[n-k]: y of n equals the weighted sum of present and past input samples

  • f_s = 1/T_s: f sub s equals one over T sub s — the sampling frequency

  • T_s: T sub s — the sampling period

Definitions to keep handy

These are the words we keep coming back to. If one feels slippery, come back here and steady it before you push on.

  • sampling: Turning a continuous-time signal into a sequence of numbers taken at regular time intervals.

  • aliasing: When you sample too slowly and high-frequency content masquerades as a lower frequency.

  • LTI system: Linear time-invariant: superposition holds, and the rule does not change over time.

  • FIR filter: A filter where the output uses only a finite number of past input samples.

  • frequency response: How a system amplifies or attenuates each frequency component.

Here is the main move this chapter is making, in plain terms. You do not need to be fast. You just need to keep the thread.

  • Coming in: Real sensors, controllers, and computers do not live in continuous time.

  • Leaving with: Sampling turns continuous mathematics into sequences, recurrences, spectra, and filters with their own stability and aliasing laws.

65.2 The discrete-time view

A continuous-time signal is written x(t). A discrete-time signal is written x[n], read “x of n.” The variable n is not time itself. It is an index. The physical time attached to sample n is

t_n = nT_s

How to read bracket notation

  • x[n] means “the value of x at step n” (a sample).
  • x[n+1] means “the next sample.”
  • x[n-3] means “three samples ago.”

The brackets are not multiplication, and they are not an exponent. They are just an index into a sequence.

where T_s is the sampling period. The sampling frequency is

f_s = \frac{1}{T_s}

The same physical system can therefore be described in two ways:

  • continuous-time: what the signal is doing between samples
  • discrete-time: what the sampled sequence records at the clock instants

This sounds like a harmless change of notation. It is not. Once the signal is a sequence, operations that looked infinitesimal in continuous time become difference equations and delay operators.

If a discrete-time system takes an input sequence x[n] and produces an output sequence y[n], the simplest and most important class is the linear time-invariant (LTI) discrete system. Linear means the system obeys superposition. Time-invariant means the rule does not change between steps — the coefficients are fixed constants, not functions of n. For those systems, present output depends on present and past samples in a fixed way.

One common form is a finite impulse response (FIR) filter:

FIR filter, in words

The rule

y[n] = \sum_{k=0}^{M} b_k x[n-k]

says: to compute the next output, take a small window of recent input samples, weight them, and add them up.

It is a sliding weighted average (not necessarily with positive weights). The weights b_k are the filter you are designing.

y[n] = \sum_{k=0}^{M} b_k x[n-k]

“Finite” here means the output depends on only a bounded window of M+1 past inputs, so the filter’s memory is bounded. The output at time step n is a weighted combination of current and previous input samples.

Filters that also feed back past outputs — so that y[n] depends on earlier y values as well as earlier x values — are called infinite impulse response (IIR) filters. Because the output feeds back into itself, a single impulse at the input can in principle affect every future output, giving the filter an unbounded memory. In stable IIR filters the impulse response decays geometrically, so the influence of distant past inputs becomes negligible in practice. IIR filters appear in the z-transform and state-space frameworks; the stability rules derived later in this chapter apply to them.

Use the controls to compare the real continuous oscillation with what the sampler can actually preserve.

65.3 Why sampling can lie to you

Suppose the continuous signal is

x(t) = \sin(2\pi f t)

and you sample it every T_s seconds. Then the discrete sequence is

x[n] = \sin(2\pi f nT_s) = \sin\left(2\pi \frac{f}{f_s} n\right)

The discrete sequence only sees the ratio f/f_s. Two different continuous frequencies can therefore produce sampled sequences that are indistinguishable, if the sampling frequency is too low. The samples no longer carry enough information to tell you which continuous oscillation was actually present. This means aliasing is not a small numerical error. It is a structural loss of information created at the moment of sampling.

Nyquist limit, in words

Sampling does not “record everything.” It can only resolve changes up to about half the sampling rate.

So if you sample at f_s, frequencies above f_s/2 do not disappear — they show up disguised as lower frequencies.

The Nyquist–Shannon sampling theorem states the safe condition:

  • to represent frequency content up to f_{\max}, sample faster than 2f_{\max}

That does not solve every practical problem, but it tells you where obvious failure begins. Sampling below that rate invites aliasing: high-frequency content reappears as a false lower-frequency pattern in the data.

This is one of the reasons discrete-time systems need their own mathematics. The sampled sequence is not a transparent window into the continuous signal. It is a transformed object with its own constraints.

65.4 Difference equations and recurrence

Continuous-time linear systems are often described by differential equations. Discrete-time linear systems are naturally described by difference equations.

A first-order example is

y[n+1] = ay[n] + bu[n]

This says: the next output is built from the current output and the current input. The constant a carries memory. The constant b tells you how strongly the input influences the update.

The stability rule for the homogeneous system

y[n+1] = ay[n]

is very simple:

  • if |a| < 1, the sequence decays to zero
  • if |a| > 1, the sequence grows in magnitude
  • if |a| = 1, the sequence neither decays nor grows and small modelling changes can matter a great deal

This is the discrete-time analogue of looking at pole location in continuous time. In one case you care about left-half-plane location. In the other you care about whether the relevant quantity sits inside the unit circle.

NoteWhy this works

In continuous time, a mode behaves like e^{st}, so the sign of \Re(s) decides whether it decays or grows. In discrete time, a mode behaves like a^n, so the magnitude of a decides whether repeated updates shrink or blow up. Exponentials become powers, and left-half-plane stability becomes unit-circle stability.

65.5 The core method

A first pass through a discrete-time systems problem usually goes like this:

  1. Identify the sampling period T_s and therefore the sampling frequency f_s.
  2. Decide whether the data is a sampled version of a continuous signal, a genuinely discrete process, or a digital controller state.
  3. Write the update rule or filter equation.
  4. Interpret every term as memory, delay, or input contribution.
  5. Check the relevant stability test: for the first-order case, the coefficient magnitude must be less than 1. For higher-order systems, stability requires all poles — the roots of the system’s characteristic equation — to lie inside the unit circle in the complex plane. This is the discrete-time counterpart of the left-half-plane test from continuous-time control.
  6. Connect the algebra back to behaviour: smoothing, lag, oscillation, alias, or amplification.

The habit is the same one from the control chapter: do not leave the recurrence as pure symbol manipulation. Ask what it means for the sequence the machine is actually computing.

65.6 Worked example 1: a moving-average sensor filter

A noisy sensor signal x[n] is filtered by

y[n] = \frac{1}{3}\bigl(x[n] + x[n-1] + x[n-2]\bigr)

This is a three-point moving average.

It smooths rapid sample-to-sample variation by replacing the present sample with the average of the present and previous two samples. If one sample spikes upward because of noise, the output spike is diluted by the neighbouring samples.

The price is delay. A filter that averages over time cannot react instantly to a real rapid change. This is the first recurring engineering tradeoff in discrete-time signal processing:

  • more smoothing usually means more lag
  • less lag usually means less smoothing

In embedded control, that tradeoff matters because a laggy filter can make an otherwise good controller feel slow or even unstable.

65.7 Worked example 2: discrete-time stability of a sampled update

Consider the update rule

y[n+1] = 0.6\,y[n] + u[n]

If the input is zero, then

y[n+1] = 0.6\,y[n]

Starting from y[0], repeated substitution gives

y[n] = 0.6^n y[0]

Because |0.6| < 1, the homogeneous response decays to zero. So the system’s memory fades over time.

Now compare with

y[n+1] = 1.1\,y[n] + u[n]

With zero input, the response is

y[n] = 1.1^n y[0]

and because |1.1| > 1, the sequence grows. A digital implementation with this update law is unstable.

In first-order discrete-time systems, the entire stability story is often carried by one number.

65.8 Worked example 3: aliasing in a seismic record

A geophysicist samples ground motion at f_s = 100 Hz. A strong sinusoidal component is present at f = 70 Hz.

This is above the Nyquist limit of

\frac{f_s}{2} = 50 \text{ Hz}

so the signal will alias. The discrete record cannot faithfully represent a 70 Hz oscillation at that sampling rate. Because the sampler runs at 100 Hz, a frequency f that exceeds the Nyquist limit folds back by the amount it overshoots the full sampling rate: the alias frequency is |f - f_s| = |70 - 100| = 30 Hz. In the sampled record, the 70 Hz component appears as a spurious 30 Hz oscillation.

The engineering lesson is not “compute a formula and move on.” It is that data collection itself is part of the mathematics. Sampling choices determine what questions the later analysis can answer honestly.

This is why signal processing belongs naturally beside estimation and inverse problems in Volume 8. If the measurement process already lost information, no later inference method can magically restore it.

65.9 Where this goes

The most direct continuation is Estimation, inverse problems, and filtering. Once a system is sampled, state estimation, filtering, and inference are usually carried out in discrete time. Kalman filtering, recursive estimation, and streaming data assimilation all inherit the language of recurrences, sampling, and noise that this chapter sets up.

This chapter sits beside control deliberately. Upper-year engineers constantly move between the continuous-time model of the plant and the discrete-time implementation of the controller. The control chapter is about shaping behaviour in continuous time. This one is about what happens when that shaping must be done on a clock.

TipApplications
  • digital filters for noisy sensors
  • sampled-data control in motors and robotics
  • audio and vibration signal analysis
  • seismic and geophysical trace processing
  • preprocessing streaming time-series data
  • telemetry, embedded systems, and real-time monitoring

65.10 Exercises

These are project-style exercises. Explain the behaviour as well as the calculation.

65.10.1 Exercise 1

A sensor is sampled every 0.01 s.

  1. Find the sampling frequency.
  2. Find the Nyquist frequency.
  3. Decide whether a 30 Hz sinusoid can be represented without aliasing.
  4. Decide whether a 70 Hz sinusoid can be represented without aliasing.

65.10.2 Exercise 2

Consider the discrete-time system

y[n+1] = 0.8\,y[n] + 2u[n]

  1. Determine whether the homogeneous system is stable.
  2. Starting from y[0] = 5 with u[n] = 0, compute y[1], y[2], and y[3].
  3. Explain what the sequence is doing physically.

65.10.3 Exercise 3

A noisy accelerometer is filtered using

y[n] = \frac{1}{4}\bigl(x[n] + x[n-1] + x[n-2] + x[n-3]\bigr)

Write a short engineering memo answering:

  1. What kind of behaviour this filter is trying to suppress
  2. Why it introduces lag
  3. Why that lag could matter in a feedback controller

65.10.4 Exercise 4

Choose one sampled-data setting from your field: a microphone, IMU, stock-price stream, satellite time series, or power-system sensor.

Prepare a one-page systems sketch naming:

  1. the physical quantity being sampled
  2. a plausible sampling frequency
  3. one source of aliasing or information loss
  4. one filter or recurrence you might apply
  5. one reason filtering helps
  6. one reason filtering can distort what you care about

Use the sandbox below to compare smoothing against delay directly.