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.81m/s2; the notation of the course is used (x state, u input, F state matrix, ΔF(λ)=det(λ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 x1, area A1) receives the supply u1 and is connected through a pipe to tank 2 (level x2, area A2), which receives a second supply u2 and is connected through another pipe to tank 3 (level x3, area A3). Tank 3 has no other connection except the demand outflow Q3. The flow from tank i to tank j is Qij, with pipe coefficient aij, and the demand flow is Q3=a32gx3. All flows are in m3/s, all levels in m.
a) Write the nonlinear state-space model with state x=(x1,x2,x3)T and input u=(u1,u2)T. State clearly which ordering of the levels you assume in order to remove the sign and the absolute value in Qij (2 points).
b) Find the working point (xˉ,uˉ): the flows and the levels xˉ1,xˉ2,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 with numerical F and G, compute the eigenvalues of F 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=A1u1−Q12, x˙2=A2u2+Q12−Q23, x˙3=A3Q23−Q3, with Q12=a122g(x1−x2), Q23=a232g(x2−x3), Q3=a32gx3, assuming x1>x2>x3>0.
b) Qˉ12=0.050m3/s, Qˉ23=Qˉ3=0.077m3/s; xˉ3=1.046m, xˉ2=1.670m, xˉ1=1.845m; the ordering holds.
c) F=−0.052970.0794600.05297−0.113720.0280300.03426−0.04476s−1, G=0.37040000.55560m−2. Eigenvalues about −0.1610, −0.0464, −0.00406s−1, time constants about 6.2s, 21.5s, 246s; all eigenvalues have negative real part, so the linearized system is a.s.
The flows depend on the level differences, Qij=aijsign(xi−xj)2g∣xi−xj∣, and the demand on the level of tank 3. The terms sign(⋅) and ∣⋅∣ 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>x3 (and x3>0). Near the working point the model becomes
Hence xˉ1=1.845>xˉ2=1.670>xˉ3=1.046>0: the assumed ordering is consistent. (Substituting xˉ and 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 u2 also flows to the demand.
Row by row. For x˙1=(u1−Q12)/A1: the flow Q12 increases with x1 (slope c12) and decreases with x2, so ∂f1/∂x1=−c12/A1=−0.05297, ∂f1/∂x2=c12/A1=0.05297, ∂f1/∂x3=0. For x˙2=(u2+Q12−Q23)/A2: ∂f2/∂x1=c12/A2=0.07946, ∂f2/∂x2=−(c12+c23)/A2=−0.11372 (both flows depend on x2), ∂f2/∂x3=c23/A2=0.03426. For x˙3=(Q23−Q3)/A3: ∂f3/∂x1=0, ∂f3/∂x2=c23/A3=0.02803, ∂f3/∂x3=−(c23+c3)/A3=−0.04476. All entries are in s−1:
Consider the autonomous system x˙(t)=Fx(t) with x∈R5 and
F=−200000−200037−200000a00002−2,a∈R.
a) Compute the eigenvalues of F and, for each value of a, the algebraic and the geometric multiplicity of every eigenvalue. Use the rank-nullity theorem (2 points).
b) Write the Jordan matrix J of F (up to the order of the blocks) and list the modes of the system, separately for a=−2 and for a=−2 (2 points).
c) Decide, for every a∈R, whether the system is a.s., simply stable but not a.s., or unstable. For a=0 and the initial state x(0)=(0,0,0,1,1)T compute x(t) and its limit for t→+∞ (2 points).
Show the result
a) F is block diagonal with F1 (rows and columns 1-3) and F2 (rows and columns 4-5); eigenvalues −2 (from F1, algebraic multiplicity 3) and a, −2 (from F2). If a=−2: λ=−2 has algebraic multiplicity 4 and geometric multiplicity 3, λ=a has both multiplicities 1. If a=−2: λ=−2 has algebraic multiplicity 5 and geometric multiplicity 3.
b) For a=−2: J=diag((−201−2),−2,−2,a); modes e−2t, te−2t, eat. For a=−2: J=diag((−201−2),(−201−2),−2); modes e−2t, te−2t.
c) a<0: a.s. (including a=−2); a=0: simply stable, not a.s.; a>0: unstable. For a=0: x(t)=(0,0,0,2−e−2t,e−2t)T→(0,0,0,2,0)T=0.
Show the full solution
a) Eigenvalues and multiplicities. The matrix is block diagonal, F=diag(F1,F2), with
The geometric multiplicity of λ is dimKer(λI−F)=5−rk(λI−F) (rank-nullity theorem, see the same note). For λ=−2, take F+2I:
F+2I=000000000037000000a+2000020.
The first two rows are proportional (they are 3 and 7 times the same row), so they contribute rank 1. The fourth row is (0,0,0,a+2,2), which is nonzero (its last entry is 2) and independent from the others. The rows 3 and 5 are zero. So rk(F+2I)=2 for everya and the nullity is 5−2=3: the geometric multiplicity of −2 is always 3, that is, three Jordan blocks.
The algebraic multiplicity depends on a. If a=−2, the eigenvalue −2 is a root of order 4 of ΔF (three from F1 and one from F2) and a is a simple root: λ=a has algebraic multiplicity 1, hence geometric multiplicity 1. If a=−2 then ΔF(λ)=(λ+2)5: algebraic multiplicity 5, geometric multiplicity still 3. Typical mistake: saying that the multiplicities do not change with a, or taking the geometric multiplicity from the diagonal entries without computing the rank.
For F1: N1=F1+2I has rank 1, so the eigenvalue −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((−201−2),−2), with the modes e−2t and te−2t.
For F2: if a=−2 it has the two distinct eigenvalues a and −2, so J2=diag(a,−2) and the modes are eat and e−2t. If a=−2, F2+2I=(0020) has rank 1, so there is only one block, of size 2: J2=(−201−2), modes e−2t and te−2t.
Therefore:
a=−2: J=diag((−201−2),−2,−2,a), three blocks for −2 (sizes 2, 1, 1) and one for a; modes e−2t, te−2t and eat. The sizes add to 4 for the eigenvalue −2, as required by the algebraic multiplicity.
a=−2: J=diag((−201−2),(−201−2),−2), sizes 2, 2, 1 (sum 5); modes e−2t and te−2t, and t never appears with a power above 1 because the largest block has size 2 (a block of size h gives th−1eλt).
Check for a=−2: the matrix N=F+2I satisfies N2=0, so eFt=e−2t(I+tN) and the only polynomial factor in the entries is t (with coefficients 3, 7 and 2). Typical mistake: giving for a=−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).
a<0: the eigenvalues are −2 and a, all with negative real part: the system is a.s. This includes a=−2, where te−2t appears but decays.
a>0: the mode eat diverges, so the system is unstable (the eigenvalue a appears in the Jordan form and a generic initial state excites it).
a=0: the eigenvalues are 0 (simple, algebraic multiplicity = geometric multiplicity = 1, a block of size 1) and −2. The mode e0t=1 is constant: bounded, not convergent. So eFt is bounded: the system is simply stable but not a.s.
For a=0 and x(0)=(0,0,0,1,1)T solve the system from the bottom. The last equation is x˙5=−2x5, so x5(t)=e−2t. The fourth is x˙4=2x5=2e−2t (since a=0), so x4(t)=1+∫0t2e−2sds=1+(1−e−2t)=2−e−2t. The first three components: x3(0)=0 and x˙3=−2x3, so x3≡0; then x˙1=−2x1+3x3=−2x1 and x˙2=−2x2+7x3=−2x2 with zero initial values, so x1=x2≡0. Hence
x(t)=0002−e−2te−2t⟶00020=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)). This confirms stability without asymptotic stability. Typical mistakes: calling the case a=0 unstable because the eigenvalue is on the imaginary axis (it is allowed when the multiplicities are equal, here 1); calling a=−2 unstable because of the term te−2t.
Exercise 3 (points 6)
Consider the discrete-time systems x(t+1)=Fix(t), i=1,2, with
F1=(0.4−0.20.70.5),F2=(0.50.701.2).
a) For F1 compute the characteristic polynomial and the modulus of the eigenvalues, and say what they imply about the stability (1 point).
b) For F1 solve the discrete-time Lyapunov equation −Q=F1TPF1−P with Q=I, where P=(p1p2p2p3). Verify with the Sylvester criterion that P is positive definite. Then, for the initial state x(0)=(1,2)T, compute V(x(0)) and V(x(1)) with V(x)=xTPx and check that ΔV=−x(0)Tx(0) (3 points).
c) For F2 solve the same equation with Q=I, say whether P is positive definite and what the test says about the stability. Compare with the eigenvalues of F2 (2 points).
Show the result
a) ΔF1(λ)=λ2−0.9λ+0.34, λ=0.45±j0.371, ∣λ∣=0.34=0.583<1: a.s.
b) P=(1.27380.13560.13562.2921) (exactly p1=34525/27104, p2=525/3872, p3=8875/3872); ∣M1∣=1.2738>0, ∣M2∣=detP=2.901>0, so P≻0. V(x(0))=10.985, x(1)=(1.8,0.8)T, V(x(1))=5.985, ΔV=−5=−∣x(0)∣2.
c) P=(−4.606−4.773−4.773−2.273) (exactly p1=−152/33, p2=−105/22, p3=−25/11), not positive definite (∣M1∣<0): the system is not a.s.; indeed the eigenvalues are 0.5 and 1.2, and 1.2>1.
Show the full solution
a) Eigenvalues. For F1 the trace is 0.4+0.5=0.9 and the determinant is 0.4⋅0.5−0.7⋅(−0.2)=0.20+0.14=0.34, so
From the first, p3=−25+21p1+4p2. Substituting in the second: 14p1−47p2+125−105p1−20p2=0, that is 91p1+67p2=125. Substituting in the third: 49p1+70p2+1875−1575p1−300p2=−100, that is 1526p1+230p2=1975. From 91p1+67p2=125 we get p2=(125−91p1)/67, and then
Check with the energy function V(x)=xTPx. For x(0)=(1,2)T: V(x(0))=p1+4p2+4p3=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)T, and V(x(1))=3.24p1+2⋅1.44p2+0.64p3=4.127+0.390+1.467=5.985. Then ΔV=5.985−10.985=−5.000, and −x(0)TQx(0)=−(1+4)=−5: the identity ΔV=−xTQx derived in the notes holds. Typical mistakes: using FP+PFT (the continuous-time form) instead of FTPF−P; forgetting that the entry (1,2) of P counts twice in xTPx.
c) The unstable system. For F2 the same computation gives, entry by entry of F2TPF2−P with F2T=(0.500.71.2):
From the last: p3=−1/0.44=−2.273; from the second: p2=0.84p3/0.4=2.1p3=−4.773; from the first: p1=(1+0.7p2+0.49p3)/0.75=(1−3.341−1.114)/0.75=−4.606. Then P=(−4.606−4.773−4.773−2.273) and already ∣M1∣=−4.606<0, so P 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.5 and 1.2, and ∣1.2∣>1, so there is a diverging mode 1.2t 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 P; a solution P exists here but it does not prove stability.
Exercise 4 (points 6)
A fan is driven at speed u (in units of 100rev/min). Physical reasoning says that the mechanical power y (in W) needed in steady state is the sum of a term proportional to u and a term proportional to u2, with two unknown coefficients: y=θ1u+θ2u2+e, where e is a measurement disturbance. Six steady-state experiments gave
u
1
2
3
4
5
6
y (W)
3.10
6.40
10.84
14.84
20.89
25.37
σi (W)
0.2
0.2
0.4
0.4
0.8
0.8
where σi is the standard deviation of the error ei of the i-th measurement (the instrument is less precise at high speed). A seventh experiment, not used for the estimation, gave y=32.6W at u=7.
a) Say whether this is a gray-box or a black-box identification problem and why. Write y=Φθ for the six data points, and check that ΦTΦ is invertible (1 point).
b) Compute the least squares estimate θ^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/σi2. 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, ΦTΦ=(914414412275), det=12544=0.
b) θ^LS=(2.842,0.2400)T; residuals (0.018,−0.243,0.155,−0.367,0.681,−0.322) W; sum of squares 0.785W2.
c) w=(25,25,6.25,6.25,1.5625,1.5625)W−2; θ^WLS=(2.751,0.2539)T. At u=7: predictions 31.65W (LS) and 31.70W (WLS) against the measured 32.6W: errors 0.95 and 0.90W, of the order of the noise.
The columns are independent (the second is not a multiple of the first: u2/u=u is not constant), which is what the notes require for ΦTΦ to be invertible. Explicitly, the sums are ∑ui2=91, ∑ui3=441, ∑ui4=2275:
b) Least squares. The normal equation is ΦTΦθ=ΦTy. The right-hand side has components ∑uiyi=364.45 and ∑ui2yi=1799.27. With the inverse 125441(2275−441−44191):
The fitted values are Φθ^=(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)W. The sum of their squares is 0.0003+0.0593+0.0239+0.1349+0.4632+0.1034=0.785W2, the minimum of ∥y−Φθ∥2. A check of the normal equation: the residual vector is orthogonal to the columns of Φ (ΦT(y−Φθ^)=0 up to rounding). Typical mistakes: using u and u2 in the same column; computing ΦTy with the wrong sums.
c) Weighted least squares and check on new data. The rule of thumb of the notes is wi=1/σi2: the more precise the measurement, the more weight. So w=(25,25,6.25,6.25,1.5625,1.5625)W−2 and W=diag(wi). The estimate is θ^WLS=(ΦTWΦ)−1ΦTWy, with
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, smaller than 3.369, the weighted cost of the LS estimate; conversely, the plain sum of squares of the WLS residuals is 0.861, larger than the 0.785 of the LS: each estimate is the minimum of its own cost.
An unknown constant θ∈R is measured once with a noisy instrument: y=θ+e, with E[e]=0 and Var(e)=σ2=2.25. Three estimators of θ are proposed:
θ^A=y,θ^B=0.7y,θ^C=2.7(a constant, chosen before the measurement).
a) For each estimator compute the bias, the variance and the mean square error as functions of θ, and check the decomposition of the MSE (2 points).
b) Compute the three MSE for θ=0, θ=2.7 and θ=6. Find the values of θ for which θ^B is better than θ^A, and those for which θ^C is better than θ^A. Is there an estimator that is the best for all θ? (2 points)
c) A colleague says: "the constant θ^C has variance zero, so it is the best estimator; and θ^B has a smaller MSE than θ^A at θ=0, so it is better than θ^A". Comment on both claims. Which of the three estimators is unbiased, and what does this restriction solve (2 points)?
b) θ=0: 2.25, 1.1025, 7.29 (A, B, C). θ=2.7: 2.25, 1.7586, 0. θ=6: 2.25, 4.3425, 10.89. B beats A for ∣θ∣<3.57; C beats A for 1.2<θ<4.2. The best estimator changes with θ: none is best for all θ.
c) Both claims are wrong in general: the variance alone is not the MSE, and the comparison depends on the unknown θ. Only θ^A is unbiased for every θ (θ^B only at θ=0, θ^C only at θ=2.7). Restricting to unbiased estimators removes the dependence on θ and makes the problem well posed.
θ^A=y: E[θ^A]=θ, so bias 0; variance 2.25; MSEA=2.25 for every θ.
θ^B=0.7y: E[θ^B]=0.7θ, so the bias is 0.7θ−θ=−0.3θ and the squared bias is 0.09θ2; variance 0.72⋅2.25=0.49⋅2.25=1.1025; MSEB=1.1025+0.09θ2.
θ^C=2.7: it does not depend on the data, so E[θ^C]=2.7 and the variance is 0; the bias is 2.7−θ and MSEC=(θ−2.7)2 (this is the example "constant estimator" of the notes).
Typical mistake: forgetting to square the factor 0.7 in the variance, or the factor 0.3 in the squared bias.
b) Comparison. Substituting:
θ
MSEA
MSEB
MSEC
0
2.25
1.1025
7.29
2.7
2.25
1.1025+0.09⋅7.29=1.7586
0
6
2.25
1.1025+0.09⋅36=4.3425
(3.3)2=10.89
B is better than A when 1.1025+0.09θ2<2.25, that is θ2<12.75, ∣θ∣<3.57. C is better than A when (θ−2.7)2<2.25, that is ∣θ−2.7∣<1.5, 1.2<θ<4.2. The three estimators are ordered differently at the three values: B is the best at θ=0, C at θ=2.7, A at θ=6. So no estimator has the smallest MSE for all θ: the problem argminθ^MSEθ^(θ) depends on the unknown θ (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 θ that an estimator is better.
c) Critical reading. First claim: the variance of θ^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 is 2.7−θ and the MSE is (θ−2.7)2: zero only if the true θ is exactly 2.7, which we cannot know (at θ=6 it is 10.89, almost five times the MSE of θ^A). Zero variance means that the estimator ignores the data, not that it is good. Second claim: at θ=0 the MSE of B is smaller, but B beats A only for ∣θ∣<3.57, and since θ is unknown we cannot check in which case we are; at θ=6 it is almost twice worse (4.34 against 2.25). A comparison at one value of θ is not a proof; moreover the better value of B comes from a bias, not from a better use of the data.
Model of a water network, working point, linearization
6
a) model and ordering 2; b) flows and levels 2; c) F, G and eigenvalues 2
2
Multiplicities, Jordan form, modes, stability with a parameter
6
a) 2; b) 2; c) 1 for the classification of a, 1 for x(t) and the limit
3
Discrete-time Lyapunov equation
6
a) 1; b) 3 (equation 1.5, Sylvester 0.5, check of Δ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, residuals orthogonal to the columns of Φ, 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.