Salta al contenuto
Note per Studenti Systems and Models - Mock Exam 2 Report

Systems and Models - Mock Exam 2

Questa pagina non ha ancora la versione ripasso: qui sotto c'è il testo completo.

In questa pagina 6

The written tests of this course are not public. The official format, from the course description, is a written test of 2 hours and 30 minutes with five exercises: formulating mathematical models, analysing systems in state space, identification, validation of models with experimental data, and critical interpretation. This mock exam follows that list: Exercise 1 is about modelling, Exercises 2 and 3 about state-space analysis, Exercise 4 about identification and a first check on new data, Exercise 5 about the critical reading of estimators. The distribution of the points (6 points per exercise, 30 in total) is a proposal of this site, not an official rule. The test is built only on the notes of the course; it is not a copy of any real test, and all systems and data are new.

Conventions used in the whole test: g=9.81 m/s2g = 9.81\ \text{m/s}^2; the notation of the course is used (xx state, uu input, FF state matrix, ΔF(λ)=det⁡(λI−F)\Delta_F(\lambda) = \det(\lambda I - F), a.s. = asymptotically stable). Matrices and data are listed completely, so every figure can be redrawn on the sheet before starting.

How to use it: work with a timer, write each formula in letters before the numbers, and look at the "Result" only when a question is finished. Some parts ask for a comment: the "Solution" says which sentences of the notes support it.

Exercise 1 (points 6)

A water distribution network has three tanks in a chain. Tank 1 (level x1x_1, area A1A_1) receives the supply u1u_1 and is connected through a pipe to tank 2 (level x2x_2, area A2A_2), which receives a second supply u2u_2 and is connected through another pipe to tank 3 (level x3x_3, area A3A_3). Tank 3 has no other connection except the demand outflow Q3Q_3. The flow from tank ii to tank jj is QijQ_{ij}, with pipe coefficient aija_{ij}, and the demand flow is Q3=a32g x3Q_3 = a_3\sqrt{2g\,x_3}. All flows are in m3/s\text{m}^3/\text{s}, all levels in m.

Data: A1=2.7 m2A_1 = 2.7\ \text{m}^2, A2=1.8 m2A_2 = 1.8\ \text{m}^2, A3=2.2 m2A_3 = 2.2\ \text{m}^2; a12=0.027 m2a_{12} = 0.027\ \text{m}^2, a23=0.022 m2a_{23} = 0.022\ \text{m}^2, a3=0.017 m2a_3 = 0.017\ \text{m}^2; constant supplies uˉ1=0.050 m3/s\bar u_1 = 0.050\ \text{m}^3/\text{s} and uˉ2=0.027 m3/s\bar u_2 = 0.027\ \text{m}^3/\text{s}.

a) Write the nonlinear state-space model with state x=(x1,x2,x3)Tx = (x_1, x_2, x_3)^T and input u=(u1,u2)Tu = (u_1, u_2)^T. State clearly which ordering of the levels you assume in order to remove the sign and the absolute value in QijQ_{ij} (2 points).

b) Find the working point (xˉ,uˉ)(\bar x, \bar u): the flows and the levels xˉ1,xˉ2,xˉ3\bar x_1, \bar x_2, \bar x_3 in equilibrium. Check that the ordering assumed in part a) holds (2 points).

c) Linearize the model around the working point: write δx˙=F δx+G δu\dot{\delta x} = F\,\delta x + G\,\delta u with numerical FF and GG, compute the eigenvalues of FF and the corresponding time constants, and say what they tell about the behaviour near the working point (2 points).

Show the result

a) x˙1=u1−Q12A1\dot x_1 = \dfrac{u_1 - Q_{12}}{A_1}, x˙2=u2+Q12−Q23A2\dot x_2 = \dfrac{u_2 + Q_{12} - Q_{23}}{A_2}, x˙3=Q23−Q3A3\dot x_3 = \dfrac{Q_{23} - Q_3}{A_3}, with Q12=a122g(x1−x2)Q_{12} = a_{12}\sqrt{2g(x_1 - x_2)}, Q23=a232g(x2−x3)Q_{23} = a_{23}\sqrt{2g(x_2 - x_3)}, Q3=a32g x3Q_3 = a_3\sqrt{2g\,x_3}, assuming x1>x2>x3>0x_1 > x_2 > x_3 > 0.

b) Qˉ12=0.050 m3/s\bar Q_{12} = 0.050\ \text{m}^3/\text{s}, Qˉ23=Qˉ3=0.077 m3/s\bar Q_{23} = \bar Q_3 = 0.077\ \text{m}^3/\text{s}; xˉ3=1.046 m\bar x_3 = 1.046\ \text{m}, xˉ2=1.670 m\bar x_2 = 1.670\ \text{m}, xˉ1=1.845 m\bar x_1 = 1.845\ \text{m}; the ordering holds.

c) F=(−0.052970.0529700.07946−0.113720.0342600.02803−0.04476) s−1F = \begin{pmatrix} -0.05297 & 0.05297 & 0 \\ 0.07946 & -0.11372 & 0.03426 \\ 0 & 0.02803 & -0.04476 \end{pmatrix}\ \text{s}^{-1}, G=(0.3704000.555600) m−2G = \begin{pmatrix} 0.3704 & 0 \\ 0 & 0.5556 \\ 0 & 0 \end{pmatrix}\ \text{m}^{-2}. Eigenvalues about −0.1610-0.1610, −0.0464-0.0464, −0.00406 s−1-0.00406\ \text{s}^{-1}, time constants about 6.2 s6.2\ \text{s}, 21.5 s21.5\ \text{s}, 246 s246\ \text{s}; all eigenvalues have negative real part, so the linearized system is a.s.

Show the full solution

a) Model. This is the structure of the three-tank model of Linearization of Nonlinear SystemsNear an equilibrium a nonlinear system behaves like an LTI system whose matrix is the Jacobian of the dynamics evaluated at the equilibrium; applied to the pendulum (two equilibria), to a direct term-by-term approximation and to the three-tank model.Linearization of Nonlinear Systems →, with the pipes arranged in a different order. Each tank obeys a balance: area times derivative of the level equals the incoming flows minus the outgoing flows. For tank 1 the incoming flow is the supply u1u_1 and the outgoing flow is Q12Q_{12}; tank 2 receives u2u_2 and Q12Q_{12} and loses Q23Q_{23}; tank 3 receives Q23Q_{23} and loses the demand Q3Q_3:

x˙1=u1−Q12A1,x˙2=u2+Q12−Q23A2,x˙3=Q23−Q3A3.\dot x_1 = \frac{u_1 - Q_{12}}{A_1}, \qquad \dot x_2 = \frac{u_2 + Q_{12} - Q_{23}}{A_2}, \qquad \dot x_3 = \frac{Q_{23} - Q_3}{A_3}.

The flows depend on the level differences, Qij=aij sign(xi−xj)2g ∣xi−xj∣Q_{ij} = a_{ij}\,\mathrm{sign}(x_i - x_j)\sqrt{2g\,|x_i - x_j|}, and the demand on the level of tank 3. The terms sign(⋅)\mathrm{sign}(\cdot) and ∣⋅∣\sqrt{|\cdot|} are not differentiable, as the notes remark. The remedy of the notes is to order the levels at the equilibrium: water flows from the supplied tank 1 towards the demand tank 3, so x1>x2>x3x_1 > x_2 > x_3 (and x3>0x_3 > 0). Near the working point the model becomes

Q12=a122g(x1−x2),Q23=a232g(x2−x3),Q3=a32g x3.Q_{12} = a_{12}\sqrt{2g(x_1 - x_2)}, \qquad Q_{23} = a_{23}\sqrt{2g(x_2 - x_3)}, \qquad Q_3 = a_3\sqrt{2g\,x_3}.

The state is x=(x1,x2,x3)Tx = (x_1, x_2, x_3)^T and the input u=(u1,u2)Tu = (u_1, u_2)^T (see State-Space ModelsA state-space model describes a system with a state vector, an input and an output; it can be nonlinear, control-affine or linear (LTI or LTV), in continuous or discrete time.State-Space Models → for the form x˙=f(x,u)\dot x = f(x, u)). Typical mistake: copying the pipe order of the example in the notes (tank 1 to tank 3 to tank 2) instead of the order of this network.

b) Working point. The equilibrium of Linearization of Nonlinear SystemsNear an equilibrium a nonlinear system behaves like an LTI system whose matrix is the Jacobian of the dynamics evaluated at the equilibrium; applied to the pendulum (two equilibria), to a direct term-by-term approximation and to the three-tank model.Linearization of Nonlinear Systems → means f(xˉ,uˉ)=0f(\bar x, \bar u) = 0, and it includes the constant inputs. Setting each derivative to zero:

  • x˙1=0\dot x_1 = 0 gives Qˉ12=uˉ1=0.050 m3/s\bar Q_{12} = \bar u_1 = 0.050\ \text{m}^3/\text{s};
  • x˙2=0\dot x_2 = 0 gives Qˉ23=uˉ2+Qˉ12=0.027+0.050=0.077 m3/s\bar Q_{23} = \bar u_2 + \bar Q_{12} = 0.027 + 0.050 = 0.077\ \text{m}^3/\text{s};
  • x˙3=0\dot x_3 = 0 gives Qˉ3=Qˉ23=0.077 m3/s\bar Q_3 = \bar Q_{23} = 0.077\ \text{m}^3/\text{s}: the demand takes all the water that is supplied.

Each flow formula is then inverted. From Q3=a32g x3Q_3 = a_3\sqrt{2g\,x_3}:

xˉ3=12g(Qˉ3a3)2=119.62(0.0770.017)2=20.51619.62=1.046 m.\bar x_3 = \frac{1}{2g}\left(\frac{\bar Q_3}{a_3}\right)^2 = \frac{1}{19.62}\left(\frac{0.077}{0.017}\right)^2 = \frac{20.516}{19.62} = 1.046\ \text{m}.

From Q23=a232g(x2−x3)Q_{23} = a_{23}\sqrt{2g(x_2 - x_3)}:

xˉ2−xˉ3=119.62(0.0770.022)2=12.2519.62=0.6244 m,xˉ2=1.046+0.624=1.670 m.\bar x_2 - \bar x_3 = \frac{1}{19.62}\left(\frac{0.077}{0.022}\right)^2 = \frac{12.25}{19.62} = 0.6244\ \text{m}, \qquad \bar x_2 = 1.046 + 0.624 = 1.670\ \text{m}.

From Q12=a122g(x1−x2)Q_{12} = a_{12}\sqrt{2g(x_1 - x_2)}:

xˉ1−xˉ2=119.62(0.0500.027)2=3.42919.62=0.1748 m,xˉ1=1.670+0.175=1.845 m.\bar x_1 - \bar x_2 = \frac{1}{19.62}\left(\frac{0.050}{0.027}\right)^2 = \frac{3.429}{19.62} = 0.1748\ \text{m}, \qquad \bar x_1 = 1.670 + 0.175 = 1.845\ \text{m}.

Hence xˉ1=1.845>xˉ2=1.670>xˉ3=1.046>0\bar x_1 = 1.845 > \bar x_2 = 1.670 > \bar x_3 = 1.046 > 0: the assumed ordering is consistent. (Substituting xˉ\bar x and uˉ\bar u in the three equations gives zero, which is the check of the working point.) Typical mistake: finding the levels without the constant supplies, or forgetting that the second supply u2u_2 also flows to the demand.

c) Linearization. With the deviations δx=x−xˉ\delta x = x - \bar x and δu=u−uˉ\delta u = u - \bar u the matrices are the Jacobians of ff at the working point, F=∂f/∂xF = \partial f/\partial x and G=∂f/∂uG = \partial f/\partial u (the procedure for xˉ≠0\bar x \ne 0 in Linearization of Nonlinear SystemsNear an equilibrium a nonlinear system behaves like an LTI system whose matrix is the Jacobian of the dynamics evaluated at the equilibrium; applied to the pendulum (two equilibria), to a direct term-by-term approximation and to the three-tank model.Linearization of Nonlinear Systems →). The derivative of each flow with respect to the level difference Δ\Delta is

ddΔ a2g Δ=a2g2Δ=Q2Δ=:c,\frac{d}{d\Delta}\,a\sqrt{2g\,\Delta} = \frac{a\sqrt{2g}}{2\sqrt{\Delta}} = \frac{Q}{2\Delta} =: c,

since Q=a2gΔQ = a\sqrt{2g\Delta}. With the numbers of part b):

c12=0.0502⋅0.1748=0.1430 m2s,c23=0.0772⋅0.6244=0.06166 m2s,c3=0.0772⋅1.046=0.03682 m2s.c_{12} = \frac{0.050}{2\cdot 0.1748} = 0.1430\ \frac{\text{m}^2}{\text{s}}, \quad c_{23} = \frac{0.077}{2\cdot 0.6244} = 0.06166\ \frac{\text{m}^2}{\text{s}}, \quad c_{3} = \frac{0.077}{2\cdot 1.046} = 0.03682\ \frac{\text{m}^2}{\text{s}}.

Row by row. For x˙1=(u1−Q12)/A1\dot x_1 = (u_1 - Q_{12})/A_1: the flow Q12Q_{12} increases with x1x_1 (slope c12c_{12}) and decreases with x2x_2, so ∂f1/∂x1=−c12/A1=−0.05297\partial f_1/\partial x_1 = -c_{12}/A_1 = -0.05297, ∂f1/∂x2=c12/A1=0.05297\partial f_1/\partial x_2 = c_{12}/A_1 = 0.05297, ∂f1/∂x3=0\partial f_1/\partial x_3 = 0. For x˙2=(u2+Q12−Q23)/A2\dot x_2 = (u_2 + Q_{12} - Q_{23})/A_2: ∂f2/∂x1=c12/A2=0.07946\partial f_2/\partial x_1 = c_{12}/A_2 = 0.07946, ∂f2/∂x2=−(c12+c23)/A2=−0.11372\partial f_2/\partial x_2 = -(c_{12} + c_{23})/A_2 = -0.11372 (both flows depend on x2x_2), ∂f2/∂x3=c23/A2=0.03426\partial f_2/\partial x_3 = c_{23}/A_2 = 0.03426. For x˙3=(Q23−Q3)/A3\dot x_3 = (Q_{23} - Q_3)/A_3: ∂f3/∂x1=0\partial f_3/\partial x_1 = 0, ∂f3/∂x2=c23/A3=0.02803\partial f_3/\partial x_2 = c_{23}/A_3 = 0.02803, ∂f3/∂x3=−(c23+c3)/A3=−0.04476\partial f_3/\partial x_3 = -(c_{23} + c_3)/A_3 = -0.04476. All entries are in s−1\text{s}^{-1}:

F=(−0.052970.0529700.07946−0.113720.0342600.02803−0.04476).F = \begin{pmatrix} -0.05297 & 0.05297 & 0 \\ 0.07946 & -0.11372 & 0.03426 \\ 0 & 0.02803 & -0.04476 \end{pmatrix}.

The inputs enter linearly, so G=(1/A1001/A200)=(0.3704000.555600)G = \begin{pmatrix} 1/A_1 & 0 \\ 0 & 1/A_2 \\ 0 & 0 \end{pmatrix} = \begin{pmatrix} 0.3704 & 0 \\ 0 & 0.5556 \\ 0 & 0 \end{pmatrix}.

The characteristic polynomial is ΔF(λ)=λ3+0.2115 λ2+0.00832 λ+3.04⋅10−5\Delta_F(\lambda) = \lambda^3 + 0.2115\,\lambda^2 + 0.00832\,\lambda + 3.04\cdot 10^{-5} (the coefficient 0.21150.2115 is minus the trace, −det⁡F=3.04⋅10−5-\det F = 3.04\cdot 10^{-5}), with roots

λ1=−0.1610,λ2=−0.0464,λ3=−0.00406  s−1.\lambda_1 = -0.1610, \qquad \lambda_2 = -0.0464, \qquad \lambda_3 = -0.00406\ \ \text{s}^{-1}.

Their sum is −0.2115=tr F-0.2115 = \mathrm{tr}\,F, which is a check. The modes are eλite^{\lambda_i t} with time constants 1/∣λi∣=6.2 s1/|\lambda_i| = 6.2\ \text{s}, 21.5 s21.5\ \text{s} and 246 s246\ \text{s}. All eigenvalues are real and negative, so the linearized system is a.s. (Equilibrium and Stability of LTI SystemsDefinitions of equilibrium, simple stability and asymptotic stability (local and global), two counterexamples (Van der Pol oscillator, Vinograd system), and the stability conditions for LTI systems in terms of the eigenvalues of F.Equilibrium and Stability of LTI Systems →): a small deviation of the levels, or of the supplies, dies out without oscillations, and the slowest mode needs a few minutes. Reading: for the conclusion on the nonlinear network, the theorem of Stability of Nonlinear Systems by LinearizationThe stability of an equilibrium of a nonlinear system can be read from the eigenvalues of its linearization when they are all strictly stable or when one is unstable, while the critical case of a merely stable linearization says nothing about the nonlinear system.Stability of Nonlinear Systems by Linearization → says that a.s. of FF gives a.s. of the working point; the linear model is valid only while the levels stay close to xˉ\bar x. Typical mistakes: differentiating x1−x2\sqrt{x_1 - x_2} only with respect to x1x_1 and forgetting the entry in the column of x2x_2 (or the x2x_2 term in Q23Q_{23}); writing c=Q/Δc = Q/\Delta instead of Q/(2Δ)Q/(2\Delta).

Exercise 2 (points 6)

Consider the autonomous system x˙(t)=Fx(t)\dot x(t) = F x(t) with x∈R5x \in \mathbb{R}^5 and

F=(−203000−270000−200000a20000−2),a∈R.F = \begin{pmatrix} -2 & 0 & 3 & 0 & 0 \\ 0 & -2 & 7 & 0 & 0 \\ 0 & 0 & -2 & 0 & 0 \\ 0 & 0 & 0 & a & 2 \\ 0 & 0 & 0 & 0 & -2 \end{pmatrix}, \qquad a \in \mathbb{R}.

a) Compute the eigenvalues of FF and, for each value of aa, the algebraic and the geometric multiplicity of every eigenvalue. Use the rank-nullity theorem (2 points).

b) Write the Jordan matrix JJ of FF (up to the order of the blocks) and list the modes of the system, separately for a≠−2a \ne -2 and for a=−2a = -2 (2 points).

c) Decide, for every a∈Ra \in \mathbb{R}, whether the system is a.s., simply stable but not a.s., or unstable. For a=0a = 0 and the initial state x(0)=(0,0,0,1,1)Tx(0) = (0, 0, 0, 1, 1)^T compute x(t)x(t) and its limit for t→+∞t \to +\infty (2 points).

Show the result

a) FF is block diagonal with F1F_1 (rows and columns 1-3) and F2F_2 (rows and columns 4-5); eigenvalues −2-2 (from F1F_1, algebraic multiplicity 3) and aa, −2-2 (from F2F_2). If a≠−2a \ne -2: λ=−2\lambda = -2 has algebraic multiplicity 4 and geometric multiplicity 3, λ=a\lambda = a has both multiplicities 1. If a=−2a = -2: λ=−2\lambda = -2 has algebraic multiplicity 5 and geometric multiplicity 3.

b) For a≠−2a \ne -2: J=diag((−210−2),−2,−2,a)J = \mathrm{diag}\left(\begin{pmatrix} -2 & 1 \\ 0 & -2 \end{pmatrix}, -2, -2, a\right); modes e−2te^{-2t}, te−2tte^{-2t}, eate^{at}. For a=−2a = -2: J=diag((−210−2),(−210−2),−2)J = \mathrm{diag}\left(\begin{pmatrix} -2 & 1 \\ 0 & -2 \end{pmatrix}, \begin{pmatrix} -2 & 1 \\ 0 & -2 \end{pmatrix}, -2\right); modes e−2te^{-2t}, te−2tte^{-2t}.

c) a<0a < 0: a.s. (including a=−2a = -2); a=0a = 0: simply stable, not a.s.; a>0a > 0: unstable. For a=0a = 0: x(t)=(0,0,0,2−e−2t,e−2t)T→(0,0,0,2,0)T≠0x(t) = (0, 0, 0, 2 - e^{-2t}, e^{-2t})^T \to (0, 0, 0, 2, 0)^T \ne 0.

Show the full solution

a) Eigenvalues and multiplicities. The matrix is block diagonal, F=diag(F1,F2)F = \mathrm{diag}(F_1, F_2), with

F1=(−2030−2700−2),F2=(a20−2),F_1 = \begin{pmatrix} -2 & 0 & 3 \\ 0 & -2 & 7 \\ 0 & 0 & -2 \end{pmatrix}, \qquad F_2 = \begin{pmatrix} a & 2 \\ 0 & -2 \end{pmatrix},

and the eigenvalues of FF are those of the blocks (the argument of Jordan Form and Modal Analysis of LTI SystemsThe Jordan form of the state matrix, built from algebraic and geometric multiplicities of its eigenvalues, lists the modes of an LTI system and so decides how each part of the state behaves, as shown on a two-eigenvalue case and on a block-diagonal example with a parameter.Jordan Form and Modal Analysis of LTI Systems →). Both blocks are upper triangular, so the eigenvalues are the diagonal entries: −2,−2,−2-2, -2, -2 for F1F_1 and a,−2a, -2 for F2F_2. The characteristic polynomial is ΔF(λ)=(λ−a)(λ+2)4\Delta_F(\lambda) = (\lambda - a)(\lambda + 2)^4.

The geometric multiplicity of λ\lambda is dim⁡Ker(λI−F)=5−rk(λI−F)\dim\mathrm{Ker}(\lambda I - F) = 5 - \mathrm{rk}(\lambda I - F) (rank-nullity theorem, see the same note). For λ=−2\lambda = -2, take F+2IF + 2I:

F+2I=(003000070000000000a+2200000).F + 2I = \begin{pmatrix} 0 & 0 & 3 & 0 & 0 \\ 0 & 0 & 7 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & a + 2 & 2 \\ 0 & 0 & 0 & 0 & 0 \end{pmatrix}.

The first two rows are proportional (they are 33 and 77 times the same row), so they contribute rank 1. The fourth row is (0,0,0,a+2,2)(0, 0, 0, a + 2, 2), which is nonzero (its last entry is 22) and independent from the others. The rows 3 and 5 are zero. So rk(F+2I)=2\mathrm{rk}(F + 2I) = 2 for every aa and the nullity is 5−2=35 - 2 = 3: the geometric multiplicity of −2-2 is always 3, that is, three Jordan blocks.

The algebraic multiplicity depends on aa. If a≠−2a \ne -2, the eigenvalue −2-2 is a root of order 4 of ΔF\Delta_F (three from F1F_1 and one from F2F_2) and aa is a simple root: λ=a\lambda = a has algebraic multiplicity 1, hence geometric multiplicity 1. If a=−2a = -2 then ΔF(λ)=(λ+2)5\Delta_F(\lambda) = (\lambda + 2)^5: algebraic multiplicity 5, geometric multiplicity still 3. Typical mistake: saying that the multiplicities do not change with aa, or taking the geometric multiplicity from the diagonal entries without computing the rank.

b) Jordan form and modes. The geometric multiplicity is the number of Jordan blocks, and the sum of the block sizes is the algebraic multiplicity (Jordan Canonical FormEvery square matrix is similar to a Jordan matrix of blocks with the eigenvalue on the diagonal and ones above it; generalized eigenvectors built from kernel chains give the change of basis, and the exponential of a Jordan block contains the terms t^k e^(lambda t).Jordan Canonical Form →). The two blocks of FF can be treated separately, J=diag(J1,J2)J = \mathrm{diag}(J_1, J_2).

For F1F_1: N1=F1+2IN_1 = F_1 + 2I has rank 1, so the eigenvalue −2-2 has 2 blocks with sizes adding to 3: sizes 2 and 1 (the block of size 3 would need rank 2). Hence J1=diag((−210−2),−2)J_1 = \mathrm{diag}\left(\begin{pmatrix} -2 & 1 \\ 0 & -2 \end{pmatrix}, -2\right), with the modes e−2te^{-2t} and te−2tte^{-2t}.

For F2F_2: if a≠−2a \ne -2 it has the two distinct eigenvalues aa and −2-2, so J2=diag(a,−2)J_2 = \mathrm{diag}(a, -2) and the modes are eate^{at} and e−2te^{-2t}. If a=−2a = -2, F2+2I=(0200)F_2 + 2I = \begin{pmatrix} 0 & 2 \\ 0 & 0 \end{pmatrix} has rank 1, so there is only one block, of size 2: J2=(−210−2)J_2 = \begin{pmatrix} -2 & 1 \\ 0 & -2 \end{pmatrix}, modes e−2te^{-2t} and te−2tte^{-2t}.

Therefore:

  • a≠−2a \ne -2: J=diag((−210−2),−2,−2,a)J = \mathrm{diag}\left(\begin{pmatrix} -2 & 1 \\ 0 & -2 \end{pmatrix}, -2, -2, a\right), three blocks for −2-2 (sizes 2, 1, 1) and one for aa; modes e−2te^{-2t}, te−2tte^{-2t} and eate^{at}. The sizes add to 44 for the eigenvalue −2-2, as required by the algebraic multiplicity.
  • a=−2a = -2: J=diag((−210−2),(−210−2),−2)J = \mathrm{diag}\left(\begin{pmatrix} -2 & 1 \\ 0 & -2 \end{pmatrix}, \begin{pmatrix} -2 & 1 \\ 0 & -2 \end{pmatrix}, -2\right), sizes 2, 2, 1 (sum 5); modes e−2te^{-2t} and te−2tte^{-2t}, and tt never appears with a power above 1 because the largest block has size 2 (a block of size hh gives th−1eλtt^{h-1}e^{\lambda t}).

Check for a=−2a = -2: the matrix N=F+2IN = F + 2I satisfies N2=0N^2 = 0, so eFt=e−2t(I+tN)e^{Ft} = e^{-2t}(I + tN) and the only polynomial factor in the entries is tt (with coefficients 33, 77 and 22). Typical mistake: giving for a=−2a = -2 one block of size 5, or three blocks of size 1 and 2 (the sum must be 5 and the number of blocks must be the geometric multiplicity 3).

c) Stability. The behaviour of x(t)x(t) is read from the modes (Modes and Asymptotic Behaviour of LTI SystemsThe state of an LTI system is a linear combination of modes t^k e^(sigma t) cos(omega t); the real part of the eigenvalues decides whether all modes converge, stay bounded or diverge, illustrated on the pendulum with and without friction and upside down.Modes and Asymptotic Behaviour of LTI Systems →, Equilibrium and Stability of LTI SystemsDefinitions of equilibrium, simple stability and asymptotic stability (local and global), two counterexamples (Van der Pol oscillator, Vinograd system), and the stability conditions for LTI systems in terms of the eigenvalues of F.Equilibrium and Stability of LTI Systems →). All modes converge if and only if Re(λ)<0\mathrm{Re}(\lambda) < 0 for all eigenvalues; a mode tkeσtt^k e^{\sigma t} with σ<0\sigma < 0 decays for every kk, because eσte^{\sigma t} dominates tkt^k, so the modes te−2tte^{-2t} do not spoil convergence.

  • a<0a < 0: the eigenvalues are −2-2 and aa, all with negative real part: the system is a.s. This includes a=−2a = -2, where te−2tte^{-2t} appears but decays.
  • a>0a > 0: the mode eate^{at} diverges, so the system is unstable (the eigenvalue aa appears in the Jordan form and a generic initial state excites it).
  • a=0a = 0: the eigenvalues are 00 (simple, algebraic multiplicity = geometric multiplicity = 1, a block of size 1) and −2-2. The mode e0t=1e^{0t} = 1 is constant: bounded, not convergent. So eFte^{Ft} is bounded: the system is simply stable but not a.s.

For a=0a = 0 and x(0)=(0,0,0,1,1)Tx(0) = (0, 0, 0, 1, 1)^T solve the system from the bottom. The last equation is x˙5=−2x5\dot x_5 = -2x_5, so x5(t)=e−2tx_5(t) = e^{-2t}. The fourth is x˙4=2x5=2e−2t\dot x_4 = 2x_5 = 2e^{-2t} (since a=0a = 0), so x4(t)=1+∫0t2e−2s ds=1+(1−e−2t)=2−e−2tx_4(t) = 1 + \int_0^t 2e^{-2s}\,ds = 1 + (1 - e^{-2t}) = 2 - e^{-2t}. The first three components: x3(0)=0x_3(0) = 0 and x˙3=−2x3\dot x_3 = -2x_3, so x3≡0x_3 \equiv 0; then x˙1=−2x1+3x3=−2x1\dot x_1 = -2x_1 + 3x_3 = -2x_1 and x˙2=−2x2+7x3=−2x2\dot x_2 = -2x_2 + 7x_3 = -2x_2 with zero initial values, so x1=x2≡0x_1 = x_2 \equiv 0. Hence

x(t)=(0002−e−2te−2t)⟶(00020)≠0.x(t) = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 2 - e^{-2t} \\ e^{-2t} \end{pmatrix} \longrightarrow \begin{pmatrix} 0 \\ 0 \\ 0 \\ 2 \\ 0 \end{pmatrix} \neq 0.

The state does not go to the origin: it stays bounded and converges to a nonzero point, which is an equilibrium (a point of Ker(F)\mathrm{Ker}(F)). This confirms stability without asymptotic stability. Typical mistakes: calling the case a=0a = 0 unstable because the eigenvalue is on the imaginary axis (it is allowed when the multiplicities are equal, here 1); calling a=−2a = -2 unstable because of the term te−2tte^{-2t}.

Exercise 3 (points 6)

Consider the discrete-time systems x(t+1)=Fi x(t)x(t+1) = F_i\,x(t), i=1,2i = 1, 2, with

F1=(0.40.7−0.20.5),F2=(0.500.71.2).F_1 = \begin{pmatrix} 0.4 & 0.7 \\ -0.2 & 0.5 \end{pmatrix}, \qquad F_2 = \begin{pmatrix} 0.5 & 0 \\ 0.7 & 1.2 \end{pmatrix}.

a) For F1F_1 compute the characteristic polynomial and the modulus of the eigenvalues, and say what they imply about the stability (1 point).

b) For F1F_1 solve the discrete-time Lyapunov equation −Q=F1TPF1−P-Q = F_1^T P F_1 - P with Q=IQ = I, where P=(p1p2p2p3)P = \begin{pmatrix} p_1 & p_2 \\ p_2 & p_3 \end{pmatrix}. Verify with the Sylvester criterion that PP is positive definite. Then, for the initial state x(0)=(1,2)Tx(0) = (1, 2)^T, compute V(x(0))V(x(0)) and V(x(1))V(x(1)) with V(x)=xTPxV(x) = x^T P x and check that ΔV=−x(0)Tx(0)\Delta V = -x(0)^T x(0) (3 points).

c) For F2F_2 solve the same equation with Q=IQ = I, say whether PP is positive definite and what the test says about the stability. Compare with the eigenvalues of F2F_2 (2 points).

Show the result

a) ΔF1(λ)=λ2−0.9λ+0.34\Delta_{F_1}(\lambda) = \lambda^2 - 0.9\lambda + 0.34, λ=0.45±j 0.371\lambda = 0.45 \pm j\,0.371, ∣λ∣=0.34=0.583<1|\lambda| = \sqrt{0.34} = 0.583 < 1: a.s.

b) P=(1.27380.13560.13562.2921)P = \begin{pmatrix} 1.2738 & 0.1356 \\ 0.1356 & 2.2921 \end{pmatrix} (exactly p1=34525/27104p_1 = 34525/27104, p2=525/3872p_2 = 525/3872, p3=8875/3872p_3 = 8875/3872); ∣M1∣=1.2738>0|M_1| = 1.2738 > 0, ∣M2∣=det⁡P=2.901>0|M_2| = \det P = 2.901 > 0, so P≻0P \succ 0. V(x(0))=10.985V(x(0)) = 10.985, x(1)=(1.8,0.8)Tx(1) = (1.8, 0.8)^T, V(x(1))=5.985V(x(1)) = 5.985, ΔV=−5=−∣x(0)∣2\Delta V = -5 = -|x(0)|^2.

c) P=(−4.606−4.773−4.773−2.273)P = \begin{pmatrix} -4.606 & -4.773 \\ -4.773 & -2.273 \end{pmatrix} (exactly p1=−152/33p_1 = -152/33, p2=−105/22p_2 = -105/22, p3=−25/11p_3 = -25/11), not positive definite (∣M1∣<0|M_1| < 0): the system is not a.s.; indeed the eigenvalues are 0.50.5 and 1.21.2, and 1.2>11.2 > 1.

Show the full solution

a) Eigenvalues. For F1F_1 the trace is 0.4+0.5=0.90.4 + 0.5 = 0.9 and the determinant is 0.4⋅0.5−0.7⋅(−0.2)=0.20+0.14=0.340.4 \cdot 0.5 - 0.7 \cdot (-0.2) = 0.20 + 0.14 = 0.34, so

ΔF1(λ)=λ2−0.9 λ+0.34,λ1,2=0.9±0.81−1.362=0.45±j 0.371.\Delta_{F_1}(\lambda) = \lambda^2 - 0.9\,\lambda + 0.34, \qquad \lambda_{1,2} = \frac{0.9 \pm \sqrt{0.81 - 1.36}}{2} = 0.45 \pm j\,0.371.

The discriminant is negative, so the eigenvalues are complex conjugate with ∣λ∣2=0.452+0.3712=0.34|\lambda|^2 = 0.45^2 + 0.371^2 = 0.34, that is ∣λ∣=0.583|\lambda| = 0.583. In discrete time the system is a.s. when every eigenvalue has modulus below 1 (Equilibria and Stability of Discrete-Time LTI SystemsA discrete-time LTI system is asymptotically stable when every eigenvalue has modulus below one, stable when all modes are bounded, and unstable otherwise, and its equilibria solve an algebraic equation involving I minus F, with finite-time convergence possible when all eigenvalues are zero.Equilibria and Stability of Discrete-Time LTI Systems →); here 0.583<10.583 < 1, so F1F_1 is a.s. (the complex pair gives modes that oscillate while their amplitude decays like 0.583t0.583^t). Typical mistake: applying the continuous-time condition Re(λ)<0\mathrm{Re}(\lambda) < 0 in discrete time.

b) Lyapunov equation. The recipe of Lyapunov Equation for Discrete-Time SystemsFor a discrete-time linear system the Lyapunov equation becomes minus Q equals F transpose P F minus P, derived from the one-step difference of the energy function V of x equal x transpose P x, and the same recipe tests asymptotic stability by checking that P is positive definite.Lyapunov Equation for Discrete-Time Systems →: choose Q=IQ = I, solve −Q=FTPF−P-Q = F^T P F - P for P=PTP = P^T, check that P≻0P \succ 0. First compute F1TPF1F_1^T P F_1:

F1T=(0.4−0.20.70.5),F1TP=(0.4p1−0.2p20.4p2−0.2p30.7p1+0.5p20.7p2+0.5p3).F_1^T = \begin{pmatrix} 0.4 & -0.2 \\ 0.7 & 0.5 \end{pmatrix}, \qquad F_1^T P = \begin{pmatrix} 0.4p_1 - 0.2p_2 & 0.4p_2 - 0.2p_3 \\ 0.7p_1 + 0.5p_2 & 0.7p_2 + 0.5p_3 \end{pmatrix}.

Multiplying on the right by F1F_1 and subtracting PP, the three independent entries of the symmetric matrix F1TPF1−PF_1^TPF_1 - P are

(1,1): −0.84 p1−0.16 p2+0.04 p3(1,2): 0.28 p1−0.94 p2−0.1 p3(2,2): 0.49 p1+0.7 p2−0.75 p3\begin{aligned} (1,1):\ & -0.84\,p_1 - 0.16\,p_2 + 0.04\,p_3 \\ (1,2):\ & 0.28\,p_1 - 0.94\,p_2 - 0.1\,p_3 \\ (2,2):\ & 0.49\,p_1 + 0.7\,p_2 - 0.75\,p_3 \end{aligned}

and they must equal the entries of −I-I, namely −1-1, 00, −1-1. Multiplying the three equations by 2525, 5050, 100100 gives integer coefficients:

−21p1−4p2+p3=−25,14p1−47p2−5p3=0,49p1+70p2−75p3=−100.-21p_1 - 4p_2 + p_3 = -25, \qquad 14p_1 - 47p_2 - 5p_3 = 0, \qquad 49p_1 + 70p_2 - 75p_3 = -100.

From the first, p3=−25+21p1+4p2p_3 = -25 + 21p_1 + 4p_2. Substituting in the second: 14p1−47p2+125−105p1−20p2=014p_1 - 47p_2 + 125 - 105p_1 - 20p_2 = 0, that is 91p1+67p2=12591p_1 + 67p_2 = 125. Substituting in the third: 49p1+70p2+1875−1575p1−300p2=−10049p_1 + 70p_2 + 1875 - 1575p_1 - 300p_2 = -100, that is 1526p1+230p2=19751526p_1 + 230p_2 = 1975. From 91p1+67p2=12591p_1 + 67p_2 = 125 we get p2=(125−91p1)/67p_2 = (125 - 91p_1)/67, and then

1526 p1+230 (125−91p1)67=1975 ⇒ 81312 p1=103575 ⇒ p1=1.2738,1526\,p_1 + \frac{230\,(125 - 91p_1)}{67} = 1975 \ \Rightarrow\ 81312\,p_1 = 103575 \ \Rightarrow\ p_1 = 1.2738,

p2=125−91⋅1.273867=0.1356,p3=−25+21⋅1.2738+4⋅0.1356=2.2921.p_2 = \frac{125 - 91\cdot 1.2738}{67} = 0.1356, \qquad p_3 = -25 + 21\cdot 1.2738 + 4\cdot 0.1356 = 2.2921.

(The exact values are 34525/2710434525/27104, 525/3872525/3872, 8875/38728875/3872.) Sylvester criterion (Positive Definite Matrices and the Sylvester CriterionA symmetric matrix is positive definite when its smallest eigenvalue is positive, and the Sylvester criterion tests this through the signs of the leading minors, which is how energy-like functions x^T P x are checked in Lyapunov arguments.Positive Definite Matrices and the Sylvester Criterion →): the leading minors are ∣M1∣=p1=1.2738>0|M_1| = p_1 = 1.2738 > 0 and ∣M2∣=det⁡P=1.2738⋅2.2921−0.13562=2.9197−0.0184=2.901>0|M_2| = \det P = 1.2738 \cdot 2.2921 - 0.1356^2 = 2.9197 - 0.0184 = 2.901 > 0. Both are positive, so P≻0P \succ 0 and F1F_1 is a.s., in agreement with part a).

Check with the energy function V(x)=xTPxV(x) = x^T P x. For x(0)=(1,2)Tx(0) = (1, 2)^T: V(x(0))=p1+4p2+4p3=1.2738+0.5423+9.1684=10.985V(x(0)) = p_1 + 4p_2 + 4p_3 = 1.2738 + 0.5423 + 9.1684 = 10.985. One step: x(1)=F1x(0)=(0.4+1.4, −0.2+1.0)T=(1.8,0.8)Tx(1) = F_1 x(0) = (0.4 + 1.4,\ -0.2 + 1.0)^T = (1.8, 0.8)^T, and V(x(1))=3.24 p1+2⋅1.44 p2+0.64 p3=4.127+0.390+1.467=5.985V(x(1)) = 3.24\,p_1 + 2\cdot 1.44\,p_2 + 0.64\,p_3 = 4.127 + 0.390 + 1.467 = 5.985. Then ΔV=5.985−10.985=−5.000\Delta V = 5.985 - 10.985 = -5.000, and −x(0)TQx(0)=−(1+4)=−5-x(0)^T Q x(0) = -(1 + 4) = -5: the identity ΔV=−xTQx\Delta V = -x^T Q x derived in the notes holds. Typical mistakes: using FP+PFTF P + P F^T (the continuous-time form) instead of FTPF−PF^T P F - P; forgetting that the entry (1,2)(1,2) of PP counts twice in xTPxx^T P x.

c) The unstable system. For F2F_2 the same computation gives, entry by entry of F2TPF2−PF_2^T P F_2 - P with F2T=(0.50.701.2)F_2^T = \begin{pmatrix} 0.5 & 0.7 \\ 0 & 1.2 \end{pmatrix}:

(1,1): −0.75 p1+0.7 p2+0.49 p3=−1,(1,2): −0.4 p2+0.84 p3=0,(2,2): 0.44 p3=−1.(1,1):\ -0.75\,p_1 + 0.7\,p_2 + 0.49\,p_3 = -1, \qquad (1,2):\ -0.4\,p_2 + 0.84\,p_3 = 0, \qquad (2,2):\ 0.44\,p_3 = -1.

From the last: p3=−1/0.44=−2.273p_3 = -1/0.44 = -2.273; from the second: p2=0.84 p3/0.4=2.1 p3=−4.773p_2 = 0.84\,p_3/0.4 = 2.1\,p_3 = -4.773; from the first: p1=(1+0.7p2+0.49p3)/0.75=(1−3.341−1.114)/0.75=−4.606p_1 = (1 + 0.7p_2 + 0.49p_3)/0.75 = (1 - 3.341 - 1.114)/0.75 = -4.606. Then P=(−4.606−4.773−4.773−2.273)P = \begin{pmatrix} -4.606 & -4.773 \\ -4.773 & -2.273 \end{pmatrix} and already ∣M1∣=−4.606<0|M_1| = -4.606 < 0, so PP is not positive definite (it has a negative diagonal entry). By the third step of the recipe, the system is not a.s. The eigenvalues (the matrix is triangular) are 0.50.5 and 1.21.2, and ∣1.2∣>1|1.2| > 1, so there is a diverging mode 1.2t1.2^t and the system is indeed unstable. The Lyapunov test and the eigenvalue test agree. Typical mistake: stopping when the linear system is solved and not checking the sign of PP; a solution PP exists here but it does not prove stability.

Exercise 4 (points 6)

A fan is driven at speed uu (in units of 100 rev/min100\ \text{rev/min}). Physical reasoning says that the mechanical power yy (in W) needed in steady state is the sum of a term proportional to uu and a term proportional to u2u^2, with two unknown coefficients: y=θ1u+θ2u2+ey = \theta_1 u + \theta_2 u^2 + e, where ee is a measurement disturbance. Six steady-state experiments gave

uu 1 2 3 4 5 6
yy (W) 3.10 6.40 10.84 14.84 20.89 25.37
σi\sigma_i (W) 0.2 0.2 0.4 0.4 0.8 0.8

where σi\sigma_i is the standard deviation of the error eie_i of the ii-th measurement (the instrument is less precise at high speed). A seventh experiment, not used for the estimation, gave y=32.6 Wy = 32.6\ \text{W} at u=7u = 7.

a) Say whether this is a gray-box or a black-box identification problem and why. Write y=Φθy = \Phi\theta for the six data points, and check that ΦTΦ\Phi^T\Phi is invertible (1 point).

b) Compute the least squares estimate θ^LS\hat\theta^{LS} by the normal equation, the residuals and their sum of squares (2 points).

c) Compute the weighted least squares estimate with weights wi=1/σi2w_i = 1/\sigma_i^2. Then compare the two estimates with the seventh measurement and say what this check can and cannot tell (3 points).

Show the result

a) Gray box (known structure, two unknown physical coefficients). Φ=(uiui2)i=1..6\Phi = \begin{pmatrix} u_i & u_i^2 \end{pmatrix}_{i=1..6}, ΦTΦ=(914414412275)\Phi^T\Phi = \begin{pmatrix} 91 & 441 \\ 441 & 2275 \end{pmatrix}, det⁡=12544≠0\det = 12544 \ne 0.

b) θ^LS=(2.842, 0.2400)T\hat\theta^{LS} = (2.842,\ 0.2400)^T; residuals (0.018,−0.243,0.155,−0.367,0.681,−0.322)(0.018, -0.243, 0.155, -0.367, 0.681, -0.322) W; sum of squares 0.785 W20.785\ \text{W}^2.

c) w=(25,25,6.25,6.25,1.5625,1.5625) W−2w = (25, 25, 6.25, 6.25, 1.5625, 1.5625)\ \text{W}^{-2}; θ^WLS=(2.751, 0.2539)T\hat\theta^{WLS} = (2.751,\ 0.2539)^T. At u=7u = 7: predictions 31.65 W31.65\ \text{W} (LS) and 31.70 W31.70\ \text{W} (WLS) against the measured 32.6 W32.6\ \text{W}: errors 0.950.95 and 0.90 W0.90\ \text{W}, of the order of the noise.

Show the full solution

a) Problem type and regression matrix. In a gray-box problem the structure of the model is known and the unknowns are physical parameters; in a black-box problem a generic class M(θ)\mathcal M(\theta) is chosen and its parameters are estimated (System Identification - Estimation Problem and Parametric Model ClassesEstimation means reconstructing an unknown function from noisy samples; the problem is ill posed, so one fixes a parametric model class, and the basic objects (statistic, estimator, estimate) are defined, with the gray-box and black-box versions for dynamical systems.System Identification - Estimation Problem and Parametric Model Classes →). Here the physics fixes the structure g^(u;θ)=θ1u+θ2u2\hat g(u; \theta) = \theta_1 u + \theta_2 u^2 and the two coefficients have a physical meaning: it is a gray-box problem. The model is also linear in the parameters, so the linear LS of Least Squares Estimation - Linear and Weighted Least SquaresThe least squares estimator minimises the sum of squared deviations between observed and predicted outputs; for models linear in the parameters it has a closed form given by the normal equation, extended to weighted least squares and illustrated on a straight-line fit and on a DC motor.Least Squares Estimation - Linear and Weighted Least Squares → applies, with regressors xi=(ui,ui2)x_i = (u_i, u_i^2):

y=(3.106.4010.8414.8420.8925.37),Φ=(112439416525636).y = \begin{pmatrix} 3.10 \\ 6.40 \\ 10.84 \\ 14.84 \\ 20.89 \\ 25.37 \end{pmatrix}, \qquad \Phi = \begin{pmatrix} 1 & 1 \\ 2 & 4 \\ 3 & 9 \\ 4 & 16 \\ 5 & 25 \\ 6 & 36 \end{pmatrix}.

The columns are independent (the second is not a multiple of the first: u2/u=uu^2/u = u is not constant), which is what the notes require for ΦTΦ\Phi^T\Phi to be invertible. Explicitly, the sums are ∑ui2=91\sum u_i^2 = 91, ∑ui3=441\sum u_i^3 = 441, ∑ui4=2275\sum u_i^4 = 2275:

ΦTΦ=(914414412275),det⁡(ΦTΦ)=91⋅2275−4412=207025−194481=12544≠0.\Phi^T\Phi = \begin{pmatrix} 91 & 441 \\ 441 & 2275 \end{pmatrix}, \qquad \det(\Phi^T\Phi) = 91\cdot 2275 - 441^2 = 207025 - 194481 = 12544 \ne 0.

b) Least squares. The normal equation is ΦTΦ θ=ΦTy\Phi^T\Phi\,\theta = \Phi^T y. The right-hand side has components ∑uiyi=364.45\sum u_i y_i = 364.45 and ∑ui2yi=1799.27\sum u_i^2 y_i = 1799.27. With the inverse 112544(2275−441−44191)\dfrac{1}{12544}\begin{pmatrix} 2275 & -441 \\ -441 & 91 \end{pmatrix}:

θ^1=2275⋅364.45−441⋅1799.2712544=829123.75−793478.0712544=2.842,θ^2=−441⋅364.45+91⋅1799.2712544=3011.1212544=0.2400.\hat\theta_1 = \frac{2275\cdot 364.45 - 441\cdot 1799.27}{12544} = \frac{829123.75 - 793478.07}{12544} = 2.842, \qquad \hat\theta_2 = \frac{-441\cdot 364.45 + 91\cdot 1799.27}{12544} = \frac{3011.12}{12544} = 0.2400.

The fitted values are Φθ^=(3.082,6.643,10.685,15.207,20.209,25.692)T\Phi\hat\theta = (3.082, 6.643, 10.685, 15.207, 20.209, 25.692)^T and the residuals y−Φθ^=(0.018,−0.243,0.155,−0.367,0.681,−0.322) Wy - \Phi\hat\theta = (0.018, -0.243, 0.155, -0.367, 0.681, -0.322)\ \text{W}. The sum of their squares is 0.0003+0.0593+0.0239+0.1349+0.4632+0.1034=0.785 W20.0003 + 0.0593 + 0.0239 + 0.1349 + 0.4632 + 0.1034 = 0.785\ \text{W}^2, the minimum of ∥y−Φθ∥2\lVert y - \Phi\theta\rVert^2. A check of the normal equation: the residual vector is orthogonal to the columns of Φ\Phi (ΦT(y−Φθ^)=0\Phi^T(y - \Phi\hat\theta) = 0 up to rounding). Typical mistakes: using uu and u2u^2 in the same column; computing ΦTy\Phi^T y with the wrong sums.

c) Weighted least squares and check on new data. The rule of thumb of the notes is wi=1/σi2w_i = 1/\sigma_i^2: the more precise the measurement, the more weight. So w=(25,25,6.25,6.25,1.5625,1.5625) W−2w = (25, 25, 6.25, 6.25, 1.5625, 1.5625)\ \text{W}^{-2} and W=diag(wi)W = \mathrm{diag}(w_i). The estimate is θ^WLS=(ΦTWΦ)−1ΦTWy\hat\theta^{WLS} = (\Phi^TW\Phi)^{-1}\Phi^TWy, with

ΦTWΦ=(376.56251326.56251326.56255532.8125),ΦTWy=(1372.7975054.328)\Phi^TW\Phi = \begin{pmatrix} 376.5625 & 1326.5625 \\ 1326.5625 & 5532.8125 \end{pmatrix}, \qquad \Phi^TWy = \begin{pmatrix} 1372.797 \\ 5054.328 \end{pmatrix}

(for example 376.5625=25⋅1+25⋅4+6.25⋅9+6.25⋅16+1.5625⋅25+1.5625⋅36376.5625 = 25\cdot 1 + 25\cdot 4 + 6.25\cdot 9 + 6.25\cdot 16 + 1.5625\cdot 25 + 1.5625\cdot 36). The determinant is 376.5625⋅5532.8125−1326.56252=323682376.5625\cdot 5532.8125 - 1326.5625^2 = 323682, and

θ^1WLS=5532.8125⋅1372.797−1326.5625⋅5054.328323682=2.751,θ^2WLS=−1326.5625⋅1372.797+376.5625⋅5054.328323682=0.2539.\hat\theta_1^{WLS} = \frac{5532.8125\cdot 1372.797 - 1326.5625\cdot 5054.328}{323682} = 2.751, \qquad \hat\theta_2^{WLS} = \frac{-1326.5625\cdot 1372.797 + 376.5625\cdot 5054.328}{323682} = 0.2539.

The two estimates differ: WLS trusts the first four points more, where the instrument is precise, and less the last two. The weighted cost of the WLS estimate is ∑wiri2=2.550\sum w_i r_i^2 = 2.550, smaller than 3.3693.369, the weighted cost of the LS estimate; conversely, the plain sum of squares of the WLS residuals is 0.8610.861, larger than the 0.7850.785 of the LS: each estimate is the minimum of its own cost.

Now the seventh experiment, which was not used to compute either estimate. The predictions at u=7u = 7 (regressors 77 and 4949) are y^LS=2.842⋅7+0.2400⋅49=31.65 W\hat y^{LS} = 2.842\cdot 7 + 0.2400\cdot 49 = 31.65\ \text{W} and y^WLS=2.751⋅7+0.2539⋅49=31.70 W\hat y^{WLS} = 2.751\cdot 7 + 0.2539\cdot 49 = 31.70\ \text{W}. The measured value is 32.6 W32.6\ \text{W}, so the prediction errors are 0.95 W0.95\ \text{W} and 0.90 W0.90\ \text{W}, of the same order as the instrument error at high speed (σ≈0.8 W\sigma \approx 0.8\ \text{W} in the last experiments). Reading, built on the notes: the notes stress that least squares only minimises the mismatch on the data it has seen and does not address generalisation, whose goal is g^(x)≈g(x)\hat g(x) \approx g(x) for points not in the dataset (System Identification - Estimation Problem and Parametric Model ClassesEstimation means reconstructing an unknown function from noisy samples; the problem is ill posed, so one fixes a parametric model class, and the basic objects (statistic, estimator, estimate) are defined, with the gray-box and black-box versions for dynamical systems.System Identification - Estimation Problem and Parametric Model Classes →). A small residual on the six points therefore does not prove that the model is good; a comparison with a point left out, as here, is a first check of generalisation. One point is a weak check: here it is consistent with the model, it does not prove it, and the two estimates cannot be told apart by it. Typical mistakes: using wi=σi2w_i = \sigma_i^2 (the weights must decrease when the noise grows); judging the model only from the residuals of the data used for the fit.

Exercise 5 (points 6)

An unknown constant θ∈R\theta \in \mathbb{R} is measured once with a noisy instrument: y=θ+ey = \theta + e, with E[e]=0\mathbb{E}[e] = 0 and Var(e)=σ2=2.25\mathrm{Var}(e) = \sigma^2 = 2.25. Three estimators of θ\theta are proposed:

θ^A=y,θ^B=0.7 y,θ^C=2.7  (a constant, chosen before the measurement).\hat\theta_A = y, \qquad \hat\theta_B = 0.7\,y, \qquad \hat\theta_C = 2.7 \ \ (\text{a constant, chosen before the measurement}).

a) For each estimator compute the bias, the variance and the mean square error as functions of θ\theta, and check the decomposition of the MSE (2 points).

b) Compute the three MSE for θ=0\theta = 0, θ=2.7\theta = 2.7 and θ=6\theta = 6. Find the values of θ\theta for which θ^B\hat\theta_B is better than θ^A\hat\theta_A, and those for which θ^C\hat\theta_C is better than θ^A\hat\theta_A. Is there an estimator that is the best for all θ\theta? (2 points)

c) A colleague says: "the constant θ^C\hat\theta_C has variance zero, so it is the best estimator; and θ^B\hat\theta_B has a smaller MSE than θ^A\hat\theta_A at θ=0\theta = 0, so it is better than θ^A\hat\theta_A". Comment on both claims. Which of the three estimators is unbiased, and what does this restriction solve (2 points)?

Show the result

a) AA: bias 00, variance 2.252.25, MSE 2.252.25. BB: bias −0.3 θ-0.3\,\theta, variance 1.10251.1025, MSE 1.1025+0.09 θ21.1025 + 0.09\,\theta^2. CC: bias 2.7−θ2.7 - \theta, variance 00, MSE (θ−2.7)2(\theta - 2.7)^2.

b) θ=0\theta = 0: 2.252.25, 1.10251.1025, 7.297.29 (A, B, C). θ=2.7\theta = 2.7: 2.252.25, 1.75861.7586, 00. θ=6\theta = 6: 2.252.25, 4.34254.3425, 10.8910.89. B beats A for ∣θ∣<3.57|\theta| < 3.57; C beats A for 1.2<θ<4.21.2 < \theta < 4.2. The best estimator changes with θ\theta: none is best for all θ\theta.

c) Both claims are wrong in general: the variance alone is not the MSE, and the comparison depends on the unknown θ\theta. Only θ^A\hat\theta_A is unbiased for every θ\theta (θ^B\hat\theta_B only at θ=0\theta = 0, θ^C\hat\theta_C only at θ=2.7\theta = 2.7). Restricting to unbiased estimators removes the dependence on θ\theta and makes the problem well posed.

Show the full solution

a) Bias, variance, MSE. The definition is MSEθ^(θ)=E[∥θ^−θ∥2]=tr Var(θ^)+∥E[θ^]−θ∥2\mathrm{MSE}_{\hat\theta}(\theta) = \mathbb E\big[\lVert\hat\theta - \theta\rVert^2\big] = \mathrm{tr}\,\mathrm{Var}(\hat\theta) + \lVert\mathbb E[\hat\theta] - \theta\rVert^2 (Mean Square Error, Bias and Unbiased Minimum Variance EstimatorsThe quality of an estimator is measured by its mean square error, which splits into variance plus squared bias; minimising it over all estimators is ill posed, so one restricts to unbiased estimators and looks for the one with minimum variance.Mean Square Error, Bias and Unbiased Minimum Variance Estimators →); for a scalar parameter the trace is the variance. We use E[y]=θ\mathbb E[y] = \theta and Var(y)=Var(e)=2.25\mathrm{Var}(y) = \mathrm{Var}(e) = 2.25, and the rule Var(αy)=α2Var(y)\mathrm{Var}(\alpha y) = \alpha^2\mathrm{Var}(y) (the rule Var(Ax)=A Var(x)AT\mathrm{Var}(Ax) = A\,\mathrm{Var}(x)A^T used in Performance of the Linear Least Squares EstimatorWith zero-mean noise of covariance P, the weighted least squares estimator with weight P inverse is unbiased and has the smallest variance among all unbiased estimators that are linear in the data; the proof compares it with an arbitrary linear unbiased estimator.Performance of the Linear Least Squares Estimator →).

  • θ^A=y\hat\theta_A = y: E[θ^A]=θ\mathbb E[\hat\theta_A] = \theta, so bias 00; variance 2.252.25; MSEA=2.25\mathrm{MSE}_A = 2.25 for every θ\theta.
  • θ^B=0.7y\hat\theta_B = 0.7y: E[θ^B]=0.7θ\mathbb E[\hat\theta_B] = 0.7\theta, so the bias is 0.7θ−θ=−0.3θ0.7\theta - \theta = -0.3\theta and the squared bias is 0.09θ20.09\theta^2; variance 0.72⋅2.25=0.49⋅2.25=1.10250.7^2\cdot 2.25 = 0.49\cdot 2.25 = 1.1025; MSEB=1.1025+0.09 θ2\mathrm{MSE}_B = 1.1025 + 0.09\,\theta^2.
  • θ^C=2.7\hat\theta_C = 2.7: it does not depend on the data, so E[θ^C]=2.7\mathbb E[\hat\theta_C] = 2.7 and the variance is 00; the bias is 2.7−θ2.7 - \theta and MSEC=(θ−2.7)2\mathrm{MSE}_C = (\theta - 2.7)^2 (this is the example "constant estimator" of the notes).

Typical mistake: forgetting to square the factor 0.70.7 in the variance, or the factor 0.30.3 in the squared bias.

b) Comparison. Substituting:

θ\theta MSEA\mathrm{MSE}_A MSEB\mathrm{MSE}_B MSEC\mathrm{MSE}_C
00 2.252.25 1.10251.1025 7.297.29
2.72.7 2.252.25 1.1025+0.09⋅7.29=1.75861.1025 + 0.09\cdot 7.29 = 1.7586 00
66 2.252.25 1.1025+0.09⋅36=4.34251.1025 + 0.09\cdot 36 = 4.3425 (3.3)2=10.89(3.3)^2 = 10.89

BB is better than AA when 1.1025+0.09θ2<2.251.1025 + 0.09\theta^2 < 2.25, that is θ2<12.75\theta^2 < 12.75, ∣θ∣<3.57|\theta| < 3.57. CC is better than AA when (θ−2.7)2<2.25(\theta - 2.7)^2 < 2.25, that is ∣θ−2.7∣<1.5|\theta - 2.7| < 1.5, 1.2<θ<4.21.2 < \theta < 4.2. The three estimators are ordered differently at the three values: BB is the best at θ=0\theta = 0, CC at θ=2.7\theta = 2.7, AA at θ=6\theta = 6. So no estimator has the smallest MSE for all θ\theta: the problem arg⁡min⁡θ^MSEθ^(θ)\arg\min_{\hat\theta}\mathrm{MSE}_{\hat\theta}(\theta) depends on the unknown θ\theta (the constant equal to the true value would have MSE zero) and is ill posed, as the notes say, with infinitely many "optimal" candidates and some degenerate. Typical mistake: concluding from one value of θ\theta that an estimator is better.

c) Critical reading. First claim: the variance of θ^C\hat\theta_C is indeed zero, but the quality of an estimator is measured by the MSE, which is variance plus squared bias. The bias of θ^C\hat\theta_C is 2.7−θ2.7 - \theta and the MSE is (θ−2.7)2(\theta - 2.7)^2: zero only if the true θ\theta is exactly 2.72.7, which we cannot know (at θ=6\theta = 6 it is 10.8910.89, almost five times the MSE of θ^A\hat\theta_A). Zero variance means that the estimator ignores the data, not that it is good. Second claim: at θ=0\theta = 0 the MSE of BB is smaller, but BB beats AA only for ∣θ∣<3.57|\theta| < 3.57, and since θ\theta is unknown we cannot check in which case we are; at θ=6\theta = 6 it is almost twice worse (4.344.34 against 2.252.25). A comparison at one value of θ\theta is not a proof; moreover the better value of BB comes from a bias, not from a better use of the data.

Unbiasedness requires E[θ^]=θ\mathbb E[\hat\theta] = \theta for the true θ\theta, whatever it is. θ^A\hat\theta_A satisfies it for every θ\theta. θ^B\hat\theta_B has bias −0.3θ-0.3\theta, zero only if θ=0\theta = 0. θ^C\hat\theta_C is unbiased only if θ=μ=2.7\theta = \mu = 2.7 (the warning of the notes). So among the three only θ^A\hat\theta_A is unbiased. The restriction to unbiased estimators removes the bias term, so the MSE equals the variance and does not depend on θ\theta any more: the comparison becomes a comparison of variances, with a well-posed goal (the UMVE of the notes). Reading: in the notation of Performance of the Linear Least Squares EstimatorWith zero-mean noise of covariance P, the weighted least squares estimator with weight P inverse is unbiased and has the smallest variance among all unbiased estimators that are linear in the data; the proof compares it with an arbitrary linear unbiased estimator.Performance of the Linear Least Squares Estimator → this measurement is the model y=Φθ+ey = \Phi\theta + e with Φ=1\Phi = 1 and P=σ2P = \sigma^2, whose estimator (ΦTP−1Φ)−1ΦTP−1y=y(\Phi^TP^{-1}\Phi)^{-1}\Phi^TP^{-1}y = y is θ^A\hat\theta_A, with variance (ΦTP−1Φ)−1=σ2=2.25(\Phi^TP^{-1}\Phi)^{-1} = \sigma^2 = 2.25; so θ^A\hat\theta_A has the smallest variance among the estimators that are linear in yy and unbiased, but this says nothing about biased estimators such as BB. Typical mistakes: believing that an unbiased estimator always has the smallest MSE of all estimators (the table shows BB and CC win in part of the range); saying that the constant estimator is unbiased "because it has no randomness".

Self-assessment grid
Exercise Topic Points How to give them
1 Model of a water network, working point, linearization 6 a) model and ordering 2; b) flows and levels 2; c) FF, GG and eigenvalues 2
2 Multiplicities, Jordan form, modes, stability with a parameter 6 a) 2; b) 2; c) 1 for the classification of aa, 1 for x(t)x(t) and the limit
3 Discrete-time Lyapunov equation 6 a) 1; b) 3 (equation 1.5, Sylvester 0.5, check of ΔV\Delta V 1); c) 2
4 Gray-box least squares and weighted least squares 6 a) 1; b) 2; c) 3 (weighted estimate 2, comment on the held-out point 1)
5 Bias, variance, MSE and critical reading 6 a) 2; b) 2; c) 2
Total 30

Give full points for a part only if the formula is written in letters, the units are right and the final value is checked (equilibrium substituted in the equations, ΔV\Delta V, residuals orthogonal to the columns of Φ\Phi, decomposition of the MSE). Give half of the points for a correct method with an arithmetic slip. Do not give points for a comment that is not tied to a result of the exercise.