Chapter 00

Prerequisites: Notation, Signals & the Algebra of the Delay Operator

What MIDA2 reads, writes and computes with from its first slide and never stops to teach — summation, set and quantifier notation and the conditioning bar; the plant, its sampling interval and the linear combinations that define it; polynomial long division in the delay operator; white noise, stochastic processes and AR(1); least squares, the prediction error and argmin; and white-box modelling. Twelve of the seventeen are MIDA1's, and the other five are taught by nobody.

Reading: ~50 min Interactive: 6 widgets Source: docs/course-intake/mida2/prereq-audit.json — the derived evidence every section below is built from; each ledger row cites the chapter line that spends it · Polimi MIDA2 2025/26 — assumed background, not lectured in any deck · PoliStudy MIDA1 — the Module 1 course this one continues; 12 of the 17 findings are taught there · S. Bittanti — Model Identification and Data Analysis (Wiley, 2019), mathematical appendices

01 · Motivation

What MIDA2 assumes on day one

A MIDA2 paper is five questions — three numerical exercises and two theory questions, some of them in MATLAB. None of the five can be started without the material on this page, and no lecture stops to teach it. Module 2 opens where Module 1 closed and simply carries on: of the seventeen prerequisites the audit found, twelve are taught by MIDA1 and the remaining five are pure notation that no course in the curriculum lists at all.

This chapter carries no exam weight of its own, and correctly shows no weight meter — no past paper asks you to “take a gradient” for marks. Every past paper depends on your being able to.

Every row below is evidence, not a generic syllabus: each prerequisite is here because a later chapter spends it, and the audit cites the line where that first happens.

you need to be able to…first spent ingraded by
read k\sum_k over an indexed set — the convolution sumch.01 system-representationsState space to TF and impulse response
use \in, \subseteq, a modulus λ\lvert\lambda\rvert and the conditioning barch.01 system-representationsObservability and reachability
state a property i\forall i and chase a \Rightarrow chainch.01 system-representationsControllable canonical form
recognise a dynamical system — memory, state, orderch.01 system-representationsRealization non-uniqueness
form a linear combination of past inputs and outputsch.01 system-representationsControllable canonical form
divide one polynomial in z1z^{-1} by anotherch.01 system-representationsState space to TF and impulse response
solve an over-determined system in the least-squares sensech.02 subspace-identification4SID; Hankel rank and system order
turn a sampling frequency into a sampling time ΔT\Delta Tch.02 subspace-identificationMATLAB for identification
minimise an objective — θ^=argminθJ(θ)\hat\theta=\arg\min_\theta J(\theta)ch.03 frequency-domain-identificationFrequency-domain experiment design
take a gradient J/θ\partial J/\partial\theta and set it to zeroch.03 frequency-domain-identificationSinusoid amplitude and phase estimation
run the parametric-identification recipe end to endch.03 frequency-domain-identificationFrequency-domain experiment design
design an excitation experimentch.03 frequency-domain-identificationFrequency-domain experiment design
characterise white noise — zero mean, variance λ2\lambda^2, uncorrelatedch.04 kalman-filterColoured noise and model extension
compute the variance of an AR(1) processch.04 kalman-filterColoured noise and model extension
define a prediction error and its variancech.04 kalman-filterOutput prediction error variance
build a white-box model from a physical lawch.07 graybox-identificationGray-box identification
treat a signal as a stochastic process, not a data recordch.08 minimum-variance-controlMVC derivation
key

How to read this chapter

Skim the ledger. Anything you can already do, skip — each section stands alone. Anything you cannot, read in full and do its exercise; the chapter that spends it will not slow down for you. If you have just finished MIDA1, sections 02 and 04 are the ones that will still be new.

The running example: an e-scooter speed loop

One object runs through every section, chosen because it is the kind of plant MIDA2 exists to identify and control. A small electric scooter is commanded by a normalised throttle u(t)[0,1]u(t)\in[0,1] and its speed y(t)y(t), in km/h, is read from a wheel encoder every ΔT=0.5\Delta T = 0.5 s. The vehicle has inertia — it forgets a throttle change only gradually — so the simplest honest model is first order:

The scooter model

y(t)=0.8y(t1)+5u(t1)+disturbance.y(t) = 0.8\,y(t-1) + 5\,u(t-1) + \text{disturbance}.

The y(t1)y(t-1) term is the memory that makes it dynamic; the u(t1)u(t-1) term is the one-step delay between commanding throttle and seeing speed.

Two numbers fall straight out and will be reused all chapter. The steady-state gain is μ=5/(10.8)=25\mu = 5/(1-0.8) = 25 km/h at full throttle, and the time constant is τ=ΔT/ln0.82.2\tau = -\Delta T/\ln 0.8 \approx 2.2 s. By the end you will have written this plant as a transfer function and divided it out into an impulse response, given its disturbance a stochastic description, estimated the two coefficients 0.80.8 and 55 from data by least squares, and derived the whole model from Newton’s second law.

×

The prerequisite errors that cost the most marks

  1. Treating z1z^{-1} as a number. It is the delay operator, z1y(t)=y(t1)z^{-1}y(t)=y(t-1) — not “one over zz” to be cancelled at will. Mishandle it and every transfer function in chapter 01, every predictor in chapter 08 and the whole of the division identity comes out wrong.
  2. Confusing sampling frequency with sampling time. At 50 Hz the sampling time is ΔT=1/50=0.02\Delta T = 1/50 = 0.02 s, not 5050. Chapter 02 flags this as a MATLAB exam trap in its own right, and it silently corrupts every identified model rather than throwing an error.
  3. Reading y^(t+kt)\hat y(t+k\mid t) as a product or a probability. The bar means given the data up to time tt — it names the information you are allowed to use. Chapters 04 through 08 are almost entirely about what changes when that information set changes.

02 · Notation

The notation you read in

Four pieces of notation appear on nearly every MIDA2 slide and none is ever defined: the summation, the set-and-modulus, the quantifier, and the conditioning bar. They are not decoration. A stability theorem is one short sentence in this language and a confusing paragraph without it, and the audit found all four used across four or more chapters while no course in the curriculum lists them as concepts.

Summation

k=0+ω(k)u(tk)\sum_{k=0}^{+\infty} \omega(k)\,u(t-k) adds one term per index value. The index and its range are part of the meaning — an infinite upper limit is a claim that the sum converges, which for an impulse response is exactly the claim that the system is stable.

Set membership and modulus

λC\lambda \in \mathbb{C} says λ\lambda is a complex number; λ\lvert\lambda\rvert is its modulus, the distance from the origin. In discrete time the unit circle z=1\lvert z\rvert = 1 is the stability boundary, so a modulus is a stability verdict.

Quantifiers and implication

\forall (“for every”), \exists (“there exists”), \Rightarrow (“implies”). Derivations in chapter 01 are chains of implications; the definitions of observability and reachability are single sentences built from \forall and \exists, and swapping the two changes the meaning.

The conditioning bar

y^(t+kt)\hat y(t+k\mid t) — “the estimate of yy at time t+kt+k, given everything measured up to time tt”. The bar is not division. It names the information set, and MIDA2 is largely the study of what happens as that set changes.

Summation: the convolution sum

The first place chapter 01 uses a summation is the third representation of a linear system. If you know how the plant responds to a single unit kick — its impulse response ω(0),ω(1),ω(2),\omega(0), \omega(1), \omega(2), \dots — then its response to any input at all is a weighted sum of delayed kicks:

Convolution

y(t)=ω(0)u(t)+ω(1)u(t1)+ω(2)u(t2)+=k=0+ω(k)u(tk).y(t)=\omega(0)u(t)+\omega(1)u(t-1)+\omega(2)u(t-2)+\cdots=\sum_{k=0}^{+\infty}\omega(k)\,u(t-k).

Read the index as “how far back”: ω(k)\omega(k) is how much the input from kk steps ago still matters now.

tip

The scooter's convolution sum

Kick the scooter with one step of throttle and its impulse response turns out to be 0,5,4,3.2,2.56,0, 5, 4, 3.2, 2.56, \dots — each term 0.80.8 times the last. Section 04 derives those numbers by division. The convolution sum then says the speed now is 55 times the throttle half a second ago, plus 44 times the throttle a second ago, plus 3.23.2 times the throttle before that, and so on: the plant remembers, with a memory that fades geometrically.

Modulus and quantifier: the stability test

Chapter 01 states asymptotic stability as a condition on the eigenvalues of the state matrix FF. In continuous time the test is on the sign of the real part; in discrete time — MIDA2’s world throughout — it is on the modulus:

Discrete-time stability

asymptotically stable    λi(F)<1i.\text{asymptotically stable}\iff \lvert\lambda_i(F)\rvert < 1 \quad \forall i.

The i\forall i is load-bearing: one eigenvalue outside the unit circle is enough to destabilise the system, no matter how well-behaved the rest are.

So an eigenvalue of 0.9-0.9 is stable — it oscillates while decaying — and an eigenvalue of 22 is not. The scooter’s single pole is 0.80.8, comfortably inside.

×

Sign versus modulus

Carrying the continuous-time reflex “negative real part means stable” into discrete time marks 0.9-0.9 as stable for the wrong reason and 0.50.5 as unstable outright. In discrete time nothing depends on the sign — only on the distance from the origin.

The conditioning bar

Chapter 04 opens by separating three problems that look almost identical and are not. The only thing distinguishing them is what stands on each side of the bar:

problemwantedwhy it differs
kk-step output predictiony^(N+kN)\hat y(N+k\lvert N)not new — MIDA1 already solves this with ARMA models
kk-step state predictionx^(N+kN)\hat x(N+k\lvert N)new — the state is never measured at all
state filteringx^(NN)\hat x(N\lvert N)the software sensor: estimate now, using now’s reading

The gap between the last two is a single sample of data, and that one sample is the entire difference between a predictor and a filter — a distinction chapter 04 grades directly.

Q

Where this is graded

The audit ties this notation to Observability and reachability and Controllable canonical form in chapter 01, and to Predictor vs filter in chapter 04. Papers do not award marks for defining the bar; they award marks for answers that use the right information set, and lose them for answers that quietly use a measurement they were not given.

A discrete-time system has eigenvalues 0.95, −0.99 and 1.01. Is it asymptotically stable?

03 · Core idea

The plant, its clock and its linear combinations

Before any identification can happen you need to be fluent with the object being identified: a dynamical system, sampled on a clock, whose next output is a linear combination of what came before. All three ideas are used in chapter 01 and chapter 02 without introduction, and MIDA1 is where they were taught.

Dynamical system

A system with memory: the output now depends not only on the input now but on the past. The minimum number of numbers you must carry to summarise that past is the state, and how many of them there are is the order.

Sampling time

ΔT\Delta T, the interval between two consecutive measurements, in seconds. Its reciprocal is the sampling frequency in Hz. Discrete time tt counts samples, so wall-clock time is tΔTt\,\Delta T.

Linear combination

c1v1++cnvnc_1 v_1 + \cdots + c_n v_n — scale each term and add. A difference equation is a linear combination of past outputs and past inputs, and the coefficients are exactly what identification estimates.

Memory is what makes it dynamic

A static system computes y(t)y(t) from u(t)u(t) and nothing else. The scooter cannot: open the throttle and the speed rises over a couple of seconds rather than jumping. That lag is memory, and the whole of MIDA2 exists because of it. Writing that memory down as a linear combination gives the general nn-th order difference equation:

Difference equation

y(t)=a1y(t1)++any(tn)+b1u(t1)++bnu(tn).y(t) = a_1 y(t-1) + \cdots + a_n y(t-n) + b_1 u(t-1) + \cdots + b_n u(t-n).

Chapter 01 reads exactly these coefficients off into the controllable canonical form; the count nn is the order.

The scooter is the case n=1n=1 with a1=0.8a_1 = 0.8 and b1=5b_1 = 5. Nothing about identification is conceptually different at n=4n=4 — there are simply more coefficients to estimate.

The clock

Every discrete model is a model of a sampling interval. Change ΔT\Delta T and the coefficients change with it, because a1a_1 is really eΔT/τe^{-\Delta T/\tau} in disguise — a fact section 07 derives and chapter 08 leans on heavily. Two consequences are worth internalising now:

  • Halving ΔT\Delta T does not halve a1a_1. It moves the pole towards 11, since eΔT/τ1e^{-\Delta T/\tau} \to 1 as ΔT0\Delta T \to 0. Sample the scooter at 50 Hz instead of 2 Hz and its pole moves from 0.80.8 to about 0.9910.991.
  • Sampling too slowly loses the dynamics entirely. The Nyquist frequency π/ΔT\pi/\Delta T is the fastest thing the model can represent; anything quicker folds back and is indistinguishable.
×

Frequency where a time belongs

Chapter 02 records this as a live MATLAB exam trap: at 1000 Hz, Ts is 1/1000, not 1000. It throws no error. It produces a model whose time axis is off by six orders of magnitude, whose poles are meaningless, and whose plots look superficially plausible.

tip

The scooter's clock

At ΔT=0.5\Delta T = 0.5 s, the scooter’s pole 0.80.8 corresponds to τ=0.5/ln0.82.2\tau = -0.5/\ln 0.8 \approx 2.2 s. Five time constants is about 11 s, or 22 samples — so an identification experiment that logs 10 samples has not seen the plant settle even once, and no amount of clever estimation will recover what was never excited.

The scooter is re-sampled at 10 Hz instead of 2 Hz, with the physical vehicle unchanged. What happens to the pole?

04 · Mechanics

Dividing polynomials in the delay operator

This is the one section with no MIDA1 equivalent, and the one that pays for the most marks. Chapter 01 divides a transfer function to recover an impulse response; chapter 08 divides with a remainder to build the kk-step predictor that minimum-variance control is derived from. Both are the same school long division, run on polynomials in z1z^{-1} instead of on digits.

C(z)/A(z) — everything the noise does to the output divide, stop after k terms, and the two pieces mean different things C(z)/A(z) = E(z) + z⁻ᵏ · R̃(z)/A(z) cut after k terms E(z) e(t), e(t−1), … already seen z⁻ᵏ · R̃(z)/A(z) e(t+1), … has not happened computable ⟹ the prediction ŷ(t+k | t) unpredictable ⟹ the error its variance is the floor

The cut moves with kk: predict further ahead and more of the bar becomes unpredictable. Nothing else changes.

That picture is what the mechanics below are for. Everything on the green side of the cut is arithmetic you can do; everything on the red side is noise that has not happened yet. Keep it in mind — chapters 01, 05 and 08 each read it differently.

Delay operator

z1z^{-1}, defined by z1y(t)=y(t1)z^{-1}y(t)=y(t-1). It is an operator, not a number, but it obeys the ordinary rules of polynomial algebra, which is precisely why long division works on it.

Transfer function

G(z)=B(z)/A(z)G(z)=B(z)/A(z), a ratio of two polynomials in z1z^{-1}. Multiplying a signal by GG means running it through the plant.

Division to a power series: the impulse response

Write the scooter’s model with every yy on the left and factor out the operator:

y(t)0.8y(t1)=5u(t1)    (10.8z1)y(t)=5z1u(t),y(t) - 0.8\,y(t-1) = 5\,u(t-1) \;\Longrightarrow\; (1 - 0.8z^{-1})\,y(t) = 5z^{-1}u(t),

so its transfer function is G(z)=5z110.8z1G(z) = \dfrac{5z^{-1}}{1 - 0.8z^{-1}}. Negative powers are the natural convention here precisely because they make this division come out as a series in how far back you look, which is what an impulse response is.

Algorithm Long division

Set it up

Divide the numerator 5z15z^{-1} by the denominator 10.8z11 - 0.8z^{-1}, lowest power of z1z^{-1} first — the mirror image of ordinary long division, which works highest power first.

Match the leading term

The leading term of the remainder is 5z15z^{-1}; the leading term of the divisor is 11. So the next quotient term is 5z15z^{-1}. That is ω(1)=5\omega(1) = 5.

Multiply back and subtract

5z1(10.8z1)=5z14z25z^{-1}\cdot(1 - 0.8z^{-1}) = 5z^{-1} - 4z^{-2}. Subtracting leaves a remainder of 4z24z^{-2}.

Repeat

4z24z^{-2} over 11 gives ω(2)=4\omega(2) = 4; subtracting leaves 3.2z33.2z^{-3}, so ω(3)=3.2\omega(3) = 3.2. The pattern is now visible — each coefficient is 0.80.8 times the last.

Read off the answer

G(z)=5z1+4z2+3.2z3+2.56z4+G(z) = 5z^{-1} + 4z^{-2} + 3.2z^{-3} + 2.56z^{-4} + \cdots, so the impulse response is ω(0)=0, ω(1)=5, ω(2)=4, ω(3)=3.2, \omega(0)=0,\ \omega(1)=5,\ \omega(2)=4,\ \omega(3)=3.2,\ \dots — the sequence section 02 used.

The general pattern for a first-order plant is ω(k)=bak1\omega(k) = b\,a^{k-1} for k1k \ge 1, and the ω(0)=0\omega(0)=0 is the one-step input delay showing up as a leading zero. A system whose ω(0)\omega(0) is non-zero has direct feedthrough; chapter 01 splits that off before building canonical forms.

Convergence is stability

The series terminates only if the plant is stable. With a<1\lvert a\rvert < 1 the coefficients decay geometrically and the infinite sum converges; with a>1\lvert a\rvert > 1 they grow without bound, and the “impulse response” is a formal series describing a system that blows up. The convergence question of section 02 and the stability question are the same question.

Division with a remainder: the kk-step predictor

Chapter 08 needs something subtler. Rather than an infinite series it wants the division stopped after exactly kk terms, with whatever is left over kept as an explicit remainder. Dividing a polynomial C(z)C(z) by A(z)A(z) and halting after kk steps gives the identity:

The division identity

C(z)=E(z)A(z)+R~(z)zk,degE=k1.C(z) = E(z)A(z) + \tilde R(z)\,z^{-k}, \qquad \deg E = k-1.

EE is the quotient after kk steps and R~zk\tilde R z^{-k} is the remainder. The degree condition is not a side note — it is what makes the split unique.

The reason chapter 08 cares is that EE collects exactly the noise terms arriving within the next kk steps, which no predictor can know, while R~\tilde R collects what is already determined by the past and therefore is predictable. The split of CC into “unknowable now” and “already decided” is performed by long division and nothing else.

Proof Why the degree condition makes the split unique

Suppose two pairs satisfied the identity: C=EA+R~zkC = EA + \tilde Rz^{-k} and C=EA+R~zkC = E'A + \tilde R'z^{-k}, both with quotient degree k1k-1. Subtracting,

(EE)A=(R~R~)zk.(E - E')A = (\tilde R' - \tilde R)\,z^{-k}.

Every term on the right carries zkz^{-k} or a higher delay. Now suppose EEE - E' were not zero, and let djzjd_j z^{-j} be its lowest-order non-zero term; since deg(EE)k1\deg(E-E')\le k-1 we have jk1j \le k-1. Because AA starts at z0z^0 with coefficient 11, the lowest-order term of the product (EE)A(E-E')A is exactly djzjd_j z^{-j} — nothing can cancel it. But jk1<kj \le k-1 \lt k, so the left-hand side has a term the right-hand side cannot match. Contradiction, so E=EE = E', and then R~=R~\tilde R' = \tilde R too.

The pair is unique, which is what lets chapter 08 speak of the kk-step predictor rather than a kk-step predictor.

Q

Where this is graded

The audit records long division as first spent in chapter 01 — graded under State space to TF and impulse response — and spent four more times in chapter 08, whose exam topics include MVC derivation and k-step predictor and MVC. Chapter 08 is the heaviest chapter in the course by exam weight, and this division is the first move in almost every one of its derivations.

Dividing C(z) by A(z) and stopping after k steps gives C = EA + R̃z^(−k). What is the degree of E?

05 · Core idea

Signals that are random, and the one that is purely random

From chapter 04 onwards nothing in MIDA2 is deterministic. The Kalman filter, software sensing and minimum-variance control are all built on a description of disturbance as a stochastic process, with white noise as the irreducible atom. MIDA1 taught all three ideas; MIDA2 uses them from its first noise term without restating them.

Stochastic process

A family of random variables indexed by time, {v(t)}\{v(t)\}. The crucial mental shift: v(3)v(3) is not a number you have not measured yet — it is a random variable with a distribution. A data record is one realisation of the process, not the process.

White noise

e(t)WN(0,λ2)e(t) \sim \mathrm{WN}(0, \lambda^2): zero mean, constant variance λ2\lambda^2, and uncorrelated across timeE[e(t)e(s)]=0E[e(t)e(s)] = 0 for tst \neq s. It is the part of a signal that no model, however good, can predict.

AR(1) process

d(t)=ad(t1)+ξ(t)d(t) = a\,d(t-1) + \xi(t) with ξ\xi white. White noise passed through a one-pole filter: correlated with its own past, and therefore partly predictable.

Why white noise is the atom

White noise is defined by what it lacks. Zero mean means it adds no bias; constant variance means it does not change character over time; being uncorrelated means yesterday’s value tells you exactly nothing about today’s. That last property is the important one, because it is what makes white noise the unpredictable residue: the best possible prediction of e(t)e(t) from all of history is 00.

Every model in chapters 04–08 is therefore built the same way — an explicable part driven by data, plus a white part that is conceded rather than modelled. When chapter 08 computes the irreducible variance of a controlled system, it is counting exactly how much white noise the controller cannot reach in time.

AR(1): correlated disturbance

The scooter’s disturbance is not white. Road slope, headwind and rider posture change slowly, so a disturbance now resembles the disturbance a moment ago. The simplest description with that property is AR(1):

AR(1) and its variance

d(t)=0.9d(t1)+ξ(t),ξWN(0,λξ2)    Var[d]=λξ210.92=λξ20.19.d(t) = 0.9\,d(t-1) + \xi(t), \qquad \xi \sim \mathrm{WN}(0,\lambda_\xi^2) \;\Longrightarrow\; \mathrm{Var}[d] = \frac{\lambda_\xi^2}{1 - 0.9^2} = \frac{\lambda_\xi^2}{0.19}.

The variance formula λ2/(1a2)\lambda^2/(1-a^2) requires a<1\lvert a\rvert<1 — the same stability condition again, now as the condition for the process to have finite variance at all.

So a mild white input, recycled through a pole at 0.90.9, produces a disturbance with more than five times its variance. This amplification is why coloured disturbance cannot simply be ignored, and it is the direct motivation for chapter 04’s model extension: the trick of enlarging the state so that a coloured disturbance becomes white again in the enlarged description.

tip

Two noises on one scooter

The encoder contributes white measurement noise — a fresh, independent quantisation error each sample. The road contributes an AR(1) process — a slope that persists for many samples. Chapter 04 treats them completely differently: the white one is absorbed into the measurement equation, and the coloured one forces the state to be extended. Telling them apart is the first step of every Kalman exercise.

Q

Where this is graded

The audit ties white noise and AR(1) to chapter 04, whose exam topics include Coloured noise and model extension and Output prediction error variance. Papers ask for the extension explicitly, and it can only be built by someone who can say which parts of the disturbance are white.

A disturbance is modelled as d(t) = 0.9 d(t−1) + ξ(t) with ξ white of variance 1. What is Var[d]?

06 · Mechanics

Least squares, argmin and the prediction error

Three chapters — 02, 03 and 06 — solve their central problem by writing down an objective and minimising it, and chapter 03 states the recipe outright as the standard four-step parametric procedure. The audit found least squares used eight times, the argmin\arg\min notation in four chapters, and the gradient in two, none of them defined here.

Prediction error

ε(t)=y(t)y^(tt1)\varepsilon(t) = y(t) - \hat y(t\mid t-1) — what the plant did, minus what your model said it would do. Every identification method in this course is a rule for making these small.

Objective function

J(θ)J(\theta), a single number scoring how badly parameter vector θ\theta explains the data. Almost always the mean squared prediction error.

argmin

θ^=argminθJ(θ)\hat\theta = \arg\min_\theta J(\theta) — not the minimum value of JJ, but the θ\theta at which it occurs. The distinction matters: identification wants the parameters, not the score.

Gradient

J/θ\partial J/\partial\theta, the vector of partial derivatives, one per parameter. Setting it to zero is the first-order condition for a minimum.

The four-step recipe

Chapter 03 lays out the procedure that every parametric method in the course instantiates:

1 · Experiment

Design the excitation, collect u(1..N)u(1..N) and y(1..N)y(1..N), pre-process.

2 · Model family

Choose a parametric family M(θ)M(\theta) — the structure, with the numbers left free.

3 · Performance index

Define J(θ)J(\theta), the score to be minimised.

4 · Optimisation

Solve θ^=argminθJ(θ)\hat\theta = \arg\min_\theta J(\theta).

Methods differ only in the choices they make at steps 2 and 3. Chapter 03 picks a frequency-domain index; chapter 06 picks a neural family; chapter 02 sidesteps the whole loop with a direct algebraic construction. Recognising the shared skeleton is what makes them feel like one course.

Least squares, worked on the scooter

Suppose you have logged throttle and speed and want the two coefficients. Write the model as an inner product of a regressor and a parameter vector:

Regression form

y(t)=φ(t)θ+ε(t),φ(t)=[y(t1)u(t1)],θ=[ab].y(t) = \varphi(t)^{\top}\theta + \varepsilon(t), \qquad \varphi(t) = \begin{bmatrix} y(t-1) \\ u(t-1) \end{bmatrix}, \qquad \theta = \begin{bmatrix} a \\ b \end{bmatrix}.

Everything known goes in φ\varphi; everything unknown goes in θ\theta. That the model is linear in θ\theta — not in the data — is what makes least squares applicable.

Now score a candidate θ\theta by its mean squared prediction error, and minimise:

J(θ)=1Nt=1Nε(t)2=1Nt=1N(y(t)φ(t)θ)2,θ^=argminθJ(θ).J(\theta) = \frac{1}{N}\sum_{t=1}^{N}\varepsilon(t)^2 = \frac{1}{N}\sum_{t=1}^{N}\big(y(t) - \varphi(t)^{\top}\theta\big)^2, \qquad \hat\theta = \arg\min_\theta J(\theta).

JJ is quadratic in θ\theta and therefore has one minimum, found where the gradient vanishes. Differentiating and setting to zero produces the normal equations, whose solution is the least-squares estimate:

Normal equations

Jθ=0    (tφ(t)φ(t))θ^=tφ(t)y(t)    θ^=(ΦΦ)1ΦY.\frac{\partial J}{\partial\theta} = 0 \;\Longrightarrow\; \Big(\sum_t \varphi(t)\varphi(t)^{\top}\Big)\hat\theta = \sum_t \varphi(t)y(t) \;\Longrightarrow\; \hat\theta = \big(\Phi^{\top}\Phi\big)^{-1}\Phi^{\top}Y.

Chapter 02 applies this exact formula to an over-determined shift-invariance relation, where the matrix has hundreds of rows and a handful of columns.

When the inverse fails, the experiment failed

ΦΦ\Phi^{\top}\Phi is singular exactly when the regressors are linearly dependent — when the data never varied enough to distinguish the parameters. Drive the scooter at constant throttle and y(t1)y(t-1) and u(t1)u(t-1) move together, so no amount of data separates aa from bb. This is persistent excitation, and it is why step 1 of the recipe comes first rather than last.

×

The prediction error is not the noise

ε(t)\varepsilon(t) is a residual you can compute; the noise e(t)e(t) is a quantity you cannot. They coincide only when θ\theta is exactly right. Chapters 04 and 08 both hinge on this: the whole point of an optimal predictor is that it drives the residual down until nothing is left but the noise, and that is the floor no method beats.

You identify the scooter from a log recorded at a perfectly constant throttle. Why does the least-squares estimate fail?

07 · Worked example

Where the model came from in the first place

Every number used so far was handed to you. This section earns them: it derives the scooter model from Newton’s second law, names the three ways a model can be obtained, and shows what experiment would be needed to pin down the parts physics cannot supply.

White-box modelling

Deriving the model from physical laws, with every parameter carrying units and meaning. Natural in continuous time, so you derive first and discretise afterwards.

Parametric identification

Choosing a model family M(θ)M(\theta) and estimating θ\theta from data — the recipe of section 06, with the structure fixed in advance and only the numbers unknown.

Experiment design

Choosing what to inject and for how long, so the data actually contains the information the estimator needs.

White box: from Newton to a difference equation

The scooter obeys a force balance — motor thrust minus the drag and friction that grow with speed:

mv˙(t)=1rT(t)βv(t),m\,\dot v(t) = \frac{1}{r}T(t) - \beta\,v(t),

with mm the combined mass of vehicle and rider, rr the wheel radius, TT the motor torque and β\beta an aggregate drag coefficient. Rearranged, this is a first-order linear ODE with time constant τ=m/β\tau = m/\beta. Sampling it with a zero-order hold — the input held constant between samples — gives a discrete model whose coefficients are not free at all:

Sampled first-order plant

v(t)=av(t1)+bu(t1),a=eΔT/τ=eβΔT/m,b=μ(1a).v(t) = a\,v(t-1) + b\,u(t-1), \qquad a = e^{-\Delta T/\tau} = e^{-\beta\Delta T/m}, \qquad b = \mu\,(1-a).

Every discrete coefficient is a physical group in disguise. This is the mapping chapter 08 relies on when it maps continuous poles to discrete ones by λF=eλAΔT\lambda_F = e^{\lambda_A \Delta T}.

Check it against the running example: with τ2.2\tau \approx 2.2 s and ΔT=0.5\Delta T = 0.5 s, a=e0.5/2.20.80a = e^{-0.5/2.2} \approx 0.80, and with a top speed of μ=25\mu = 25 km/h, b=25×0.2=5b = 25 \times 0.2 = 5. The two numbers used since section 01 were never arbitrary.

Three colours of model

White box

Structure and parameters both from physics. Fully interpretable, and only as good as your knowledge of β\beta.

Black box

Structure chosen for convenience, all parameters from data. No physical meaning, often the best fit — chapter 06’s territory.

Gray box

Physical structure, but some parameters unknown and estimated from data. Chapter 07 does this, and this chapter deliberately stops short of it.

The scooter is the natural gray-box case, and it shows why the category exists. The structure is solid Newtonian physics, rr is measurable with a ruler and ΔT\Delta T is a setting — but mm includes the rider, so it changes every trip, and β\beta depends on posture, tyre pressure and wind. Chapter 07 handles exactly this by treating the unknown parameter as an extra state and letting an extended Kalman filter estimate it alongside the speed. That machinery is chapter 07’s to teach; all you need here is to see why physics alone could not finish the job.

The experiment that would pin it down

Section 06 showed that a constant throttle identifies nothing. What does work follows directly from what the estimator needs — enough independent variation to separate the parameters, sustained long enough for the plant to reveal its memory:

  • Vary the input richly. A step gives one time constant’s worth of information; a square wave or a pseudo-random binary sequence gives many, at many frequencies.
  • Log for several time constants. For the scooter, τ2.2\tau \approx 2.2 s, so a run of 30 s at ΔT=0.5\Delta T = 0.5 s gives about 60 samples spanning some 13 time constants.
  • Excite what you intend to model. Chapter 03 makes this literal: to identify a frequency response at a given frequency, inject a sinusoid at that frequency.
Q

Where this is graded

The audit ties white-box modelling to chapter 07, graded under Gray-box identification, and experiment design to chapter 03, graded under Frequency-domain experiment design. Both are open theory questions in the papers — they ask you to justify a modelling choice, not to compute a number.

A scooter model has known structure from Newton's laws, but the rider's mass is unknown and must come from data. What kind of model is this?

08 · Practice

Work these before chapter 1

Six exercises, one per prerequisite cluster, each shaped like the chapter that will spend it. Attempt each before opening the solution — recognition is not the same skill as production, and the exam tests the second.

Try it 1 · Read the notation

A system is described by y(t)=k=0+ω(k)u(tk)y(t)=\sum_{k=0}^{+\infty}\omega(k)u(t-k) with ω(k)=3(0.5)k\omega(k)=3\cdot(-0.5)^{k}. (a) Is it asymptotically stable? (b) What is y^(t+2t)\hat y(t+2\mid t) asking for, in words? (c) What is the steady-state gain?

Solution. (a) Yes. The impulse response decays geometrically because 0.5<1\lvert -0.5\rvert < 1; the negative sign makes it alternate while decaying, which is stable. The modulus is what counts, never the sign. (b) The estimate of the output two steps into the future, using only measurements up to and including time tt — nothing from t+1t+1 or t+2t+2 may appear in the answer. (c) The steady-state gain is the sum of the impulse response, k3(0.5)k=3/(1(0.5))=2\sum_k 3(-0.5)^k = 3/(1-(-0.5)) = 2.

Try it 2 · Long division to an impulse response

Find the first four impulse-response coefficients of G(z)=2z111.2z1+0.32z2G(z)=\dfrac{2z^{-1}}{1-1.2z^{-1}+0.32z^{-2}}, and say whether the system is stable.

Solution. Divide lowest power first. 2z12z^{-1} over 11 gives ω(1)=2\omega(1)=2; multiplying back gives 2z12.4z2+0.64z32z^{-1}-2.4z^{-2}+0.64z^{-3}, and subtracting leaves 2.4z20.64z32.4z^{-2}-0.64z^{-3}. Next term ω(2)=2.4\omega(2)=2.4; multiplying back gives 2.4z22.88z3+0.768z42.4z^{-2}-2.88z^{-3}+0.768z^{-4}, and subtracting leaves 2.24z30.768z42.24z^{-3}-0.768z^{-4}. So ω(3)=2.24\omega(3)=2.24, and one more round gives ω(4)=1.92\omega(4)=1.92. With ω(0)=0\omega(0)=0 the response is 0,2,2.4,2.24,1.92,0, 2, 2.4, 2.24, 1.92, \dots — it rises before it decays, which a first-order system cannot do.

Stability: factor the denominator as (10.8z1)(10.4z1)(1-0.8z^{-1})(1-0.4z^{-1}), so the poles are 0.80.8 and 0.40.4, both inside the unit circle. Stable.

Try it 3 · Division with a remainder

For C(z)=1+0.5z1C(z)=1+0.5z^{-1} and A(z)=10.8z1A(z)=1-0.8z^{-1}, perform the division to k=2k=2, giving E(z)E(z) and R~(z)\tilde R(z) in C=EA+R~z2C=EA+\tilde Rz^{-2}. Verify the degree condition.

Solution. Step one: the leading term of CC is 11, so the first quotient term is e0=1e_0=1. Multiplying back gives 10.8z11-0.8z^{-1}; subtracting from CC leaves 1.3z11.3z^{-1}. Step two: the quotient term is e1=1.3e_1=1.3. Multiplying back gives 1.3z11.04z21.3z^{-1}-1.04z^{-2}; subtracting leaves 1.04z21.04z^{-2}.

Two steps done, so stop. E(z)=1+1.3z1E(z)=1+1.3z^{-1} and the remainder is 1.04z21.04z^{-2}, giving R~(z)=1.04\tilde R(z)=1.04. Check the degree condition: degE=1=k1\deg E=1=k-1 with k=2k=2. ✓

Verify by multiplying out: EA=(1+1.3z1)(10.8z1)=1+0.5z11.04z2E A = (1+1.3z^{-1})(1-0.8z^{-1}) = 1+0.5z^{-1}-1.04z^{-2}, and adding R~z2=1.04z2\tilde Rz^{-2}=1.04z^{-2} recovers C=1+0.5z1C=1+0.5z^{-1} exactly.

Try it 4 · Variance of a coloured disturbance

A slope disturbance is d(t)=0.95d(t1)+ξ(t)d(t)=0.95\,d(t-1)+\xi(t) with ξWN(0,0.4)\xi\sim\mathrm{WN}(0,0.4). (a) Find Var[d]\mathrm{Var}[d]. (b) By what factor does the filter amplify the variance? (c) What happens as the pole approaches 1, and what does that mean physically?

Solution. (a) Var[d]=λ2/(1a2)=0.4/(10.9025)=0.4/0.09754.10\mathrm{Var}[d]=\lambda^2/(1-a^2)=0.4/(1-0.9025)=0.4/0.0975\approx 4.10. (b) The amplification is 1/(1a2)10.31/(1-a^2)\approx 10.3 — the disturbance has ten times the variance of the noise driving it. (c) As a1a\to 1 the denominator goes to zero and the variance diverges: the process stops being stationary and becomes a random walk, wandering without ever settling. Physically, a disturbance with no restoring tendency — a slope that drifts and never returns.

Try it 5 · Least squares by hand

Fit y(t)=ay(t1)y(t)=a\,y(t-1) — one parameter, no input — to the three observations y(1)=10y(1)=10, y(2)=8y(2)=8, y(3)=6.6y(3)=6.6. Set up J(a)J(a), differentiate, and solve.

Solution. Two prediction errors are available, at t=2t=2 and t=3t=3:

J(a)=(810a)2+(6.68a)2.J(a)=(8-10a)^2+(6.6-8a)^2.

Differentiate with respect to aa and set to zero:

dJda=20(810a)16(6.68a)=0    160+200a105.6+128a=0.\frac{dJ}{da}=-20(8-10a)-16(6.6-8a)=0 \;\Longrightarrow\; -160+200a-105.6+128a=0.

So 328a=265.6328a=265.6 and a^=0.8098\hat a=0.8098. Sanity-check against the shortcut a^=y(t)y(t1)/y(t1)2=(80+52.8)/(100+64)=132.8/164=0.8098\hat a=\sum y(t)y(t-1)/\sum y(t-1)^2 = (80+52.8)/(100+64)=132.8/164=0.8098 — the same number, which it must be, since the shortcut is the one-parameter normal equation.

Note what this exercise is not: with three data points and no input variation, the estimate is plausible but has no useful precision. It demonstrates the mechanics, not a sound experiment.

Try it 6 · From physics to a discrete model

A cart of mass m=40m=40 kg is pushed by force FF against viscous friction β=16\beta=16 N·s/m, so mv˙=Fβvm\dot v=F-\beta v. It is sampled at 4 Hz. (a) Find τ\tau and the discrete pole aa. (b) Find the steady-state gain from FF to vv. (c) Write the difference equation.

Solution. (a) τ=m/β=40/16=2.5\tau=m/\beta=40/16=2.5 s. At 4 Hz the sampling time is ΔT=1/4=0.25\Delta T=1/4=0.25 s — the reciprocal, not the frequency. So a=e0.25/2.5=e0.10.905a=e^{-0.25/2.5}=e^{-0.1}\approx 0.905. (b) At steady state v˙=0\dot v=0, so F=βvF=\beta v and the gain is μ=1/β=1/16=0.0625\mu=1/\beta=1/16=0.0625 m/s per newton. (c) b=μ(1a)=0.0625×0.09520.00595b=\mu(1-a)=0.0625\times 0.0952\approx 0.00595, giving

v(t)=0.905v(t1)+0.00595F(t1).v(t)=0.905\,v(t-1)+0.00595\,F(t-1).

The small bb is not an error — it is the gain per newton per sample, and it is exactly compensated by the pole being close to 1, so that the steady state still comes out at 0.06250.0625 m/s per newton.

09 · Recap

Chapter 00 — what you must carry forward

  1. The modulus is the stability verdict, and \forall means every one. In discrete time λi<1\lvert\lambda_i\rvert<1 for all ii; the sign is irrelevant, and one bad eigenvalue is fatal.
  2. The bar names an information set. y^(t+kt)\hat y(t+k\mid t) is what you may use, not a division. Predictor versus filter is one sample of data and a graded distinction.
  3. z1z^{-1} is an operator that obeys polynomial algebra. Dividing B/AB/A to a power series gives the impulse response; the coefficients converge exactly when the plant is stable.
  4. Division with a remainder splits the knowable from the unknowable. C=EA+R~zkC=EA+\tilde Rz^{-k} with degE=k1\deg E=k-1 — the degree condition is what makes it unique, and it is the first move of chapter 08’s derivations.
  5. White noise is the unpredictable residue; everything else is structure. An AR(1) disturbance has variance λ2/(1a2)\lambda^2/(1-a^2) and is partly predictable, which is why coloured noise forces a model extension.
  6. Identification is one recipe with four steps. Experiment, family, index, argmin\arg\min — and the experiment comes first because a singular ΦΦ\Phi^{\top}\Phi is a failed experiment, not a failed solver.
  7. The prediction error is a residual, not the noise. They coincide only at the true parameters, and that coincidence is the floor no method beats.

Chapter 01 begins by writing a plant three ways at once — state space, transfer function, impulse response — and asking which of the six conversions between them lose information. You now have every tool it uses: the convolution sum is the third representation, the long division is the route from the second to the third, and the modulus test is how it decides whether any of them is stable.