Practice Exam 2021
(About 6 of the following problems)
Solutions to the problems Download Solutions to the problems
Code to solutions:
problem6.m Download problem6.m
1. System Identification Theory
a) Suppose that we would like to identify a model, where the true system is given by
y(t)=0.4u(t−1)+0.3u(t−2)+0.2u(t−3)+0.1u(t−4)+e(t)y(t)=0.4u(t−1)+0.3u(t−2)+0.2u(t−3)+0.1u(t−4)+e(t)y(t)=0.4u(t−1)+0.3u(t−2)+0.2u(t−3)+0.1u(t−4)+e(t)
where e(t)∈N(0,1)e(t)e(t) is white noise with zero mean and unit variance. Suppose
that the input signal is a sinusoidal, u(t)=sin(πt/4)u(t)=sin(πt/4)u(t)=sin(πt/4) and that you
estimate the parameters in a model of the form
y(t)=b1u(t−1)+b2u(t−2)+e(t)y(t)=b1u(t−1)+b2u(t−2)+e(t)y(t)=b1u(t−1)+b2u(t−2)+e(t)
using a standard least squares prediction error method. What are the estimates of b1b1b1 and
b2b2b2 when
N→∞N→∞N→∞ ?
b) In another scenario assume the true system is given by
y(t)=0.2u(t−1)+0.4u(t−2)+w(t)y(t)=0.2u(t−1)+0.4u(t−2)+w(t)y(t)=0.2u(t−1)+0.4u(t−2)+w(t)
with w(t)∈N(0,1)w(t)w(t) white noise of variance 1. Assume an identification experiment is carried out with an input
uuu uncorrelated with
www but with autocovariance
Ru(τ)={1,τ=00.5,|τ|=10,|τ|>1Ru(τ)={1,τ=00.5,|τ|=10,|τ|>1Ru(τ)={1,τ=00.5,|τ|=10,|τ|>1
Calculate the asymptotic values of the estimates ˆb1ˆb1ˆb1 and
ˆb2ˆb2ˆb2 when
N→∞.N→∞.N→∞. Are the estimates asymptotically correct? The model is of the correct form
y(t)=b1u(t−1)+b2u(t−2)+e(t)y(t)=b1u(t−1)+b2u(t−2)+e(t)y(t)=b1u(t−1)+b2u(t−2)+e(t).
Also determine the error variances Var(b1−ˆb1)Var(b1−ˆb1)Var(b1−ˆb1) and
Var(b2−ˆb2)Var(b2−ˆb2)Var(b2−ˆb2)of the parameter estimates for finite amount of data
NNN.
c) Suggest another signal u(t)u(t)u(t), also with variance 1 as in b, which gives lower error variances
Var(b1−ˆb1)Var(b1−ˆb1)Var(b1−ˆb1) and
Var(b2−ˆb2)Var(b2−ˆb2)Var(b2−ˆb2).
2 System Identification Practice
The data for this problem are in the file sysid02.mat.
Download sysid02.mat. Load the data into Matlab, inside it you will find input and output signals u and y (the sample time is Ts=1Ts=1Ts=1).
Use that data to construct one or more appropriate black-box models, choosing between ARX, OE, ARMAX and BJ structures of appropriate orders. For your best model report:
- plot of the fitted model vs validation data. (Hint: compare())
- parameter values and uncertainty
- residual analysis plot (resid)
- Bode plot (bode or bodeplot)
- poles and zeros (pzmap)
You can either use the systemIdentification GUI or do it with matlab code that you write.
3. Modeling, Modelica and DAE systems
Subproblems
Consider the electric circuit below driven by a current source of input current III (and
VVV is a voltage).
a) Write a DAE in the variables i1i1i1,
i2i2i2, and
VVV, with
III as input.
[In 2021-22 we have skipped talking about the differentiability index, and therefore questions of the form b) and c) will not be given in Jan 2022-3. Therefore skip the next two subproblems.
b) What is the differentiability index kkk of the DAE ?
c) Let w=L1i1−L2i2w=L1i1−L2i2w=L1i1−L2i2and
y=Vy=Vy=V. Show that the model can be written in the form
˙w=Aw+BIy=Cw+D0I+…+Dk−1I(k−1)˙w=Aw+BIy=Cw+D0I+…+Dk−1I(k−1)˙w=Aw+BIy=Cw+D0I+…+Dk−1I(k−1)
where I(k−1)I(k−1)I(k−1) is the
(k−1)(k−1)(k−1)-derivative of
I,I,I, and
kkk is the differentiability index. ]
d) If the current source is replaced by a voltage source (similar diagram, but with voltage VVV as input), is it possible to write the system in state space form
˙x=Ax+Bu,y=Cx+Du˙x=Ax+Bu,y=Cx+DuUnexpected text node: ' ?' (Note: different matrices
A,B,C,D than in c)
You can assume that parameters L1L1L1 and
L2L2L2 are non-zero.
4. Supervised Learning - Practice and theory
The EEG data needed here is not included, so you cant solve this problem. The problem would be more detailed on the exam. Don't spend all the time trying to optimize performance.
The google colab notebook xxx loads data from an EEG experiment, measuring brain activity from persons looking on images on a computer screen. These images belong to 3 different categories, (denoted 0,1,2 in the data). It is known that the activities in the brain differ when processing images from these categories.
The EEG data has the following structure:
The data is split into a training set of X images which you should use to train your classifier and a test set of Y images which you should use to evaluate your algorithm.
a) Choose a good algorithm described in the course and train a classifier on the data. It is of course good if your algorithm gets a high performance, but your result will be judged mainly by your methodology, and how well you describe your method and result.
b) Describe how one could interpret the information one obtains from the singular value decomposition [U,S,V]=svd(A)
of the EEG data matrix A = (here follows a description of the matrix A). Say for instance that only 5 singular values are significantly larger then 0.
5. Causal Inference, Theory or Practice
The following DAG decscribes a linear Gaussian structural causal model, where we assume we do not know the parameters (the values on the edges).
The equations of the SCM are given by
A:=NAB:=NBX:=A+2B+NCD:=3B+4X+NDY:=2D+3X+NEA:=NAB:=NBX:=A+2B+NCD:=3B+4C+NDY:=2D+3C+NEA:=NAB:=NBX:=A+2B+NCD:=3B+4C+NDY:=2D+3C+NE
where NA,…,NENA,…,NENA,…,NE are normally distributed
N(0,1)N(0,1)N(0,1) random variables.
a) We are interested in estimating the causal effect from XXX to
YYUnexpected text node: ' ,' e.g. find
∂∂xE(Y|do(X:=x)) (which in this case is 11). Draw a figure indicating the updated DAG after an intervention has been made corresponding to this situation, ∂∂aE(Y|do(X:=a))∂∂aE(Y|do(X:=a)).
b) If such an intervention is not practically possible, then describe how the causal effect from X to Y can be obtained from linear regression using available data. Determine which of these linear regressions will give the correct value
Y∼XY∼X+BY∼X+A+BY∼XY∼X+BY∼X+A+BY∼XY∼X+BY∼X+A+B
For the example Y∼X+A+BY∼X+A+BY∼X+A+B this would mean that we find the correct coefficient
θ1=11θ1=11θ1=11 (asymptotically when the number of data points goes to infinity) from the least squares regression
Y=θ1X+θ2A+θ3B+noiseY=θ1X+θ2A+θ3B+noiseY=θ1X+θ2A+θ3B+noise
c) Confirm your results numerically by generating a large amount of data points according to the true SCM and perform the three different linear regressions described in b. (Hint: In python you can use the ols command in the statsmodels package. You can also solve the problem in matlab).
6. Grey Box Identification
The following continuous time model describes the one dimensional position yy of a mobile robot. The input signal
uu to a motor generates a force
FF on the robot. The motor has a time constant
TT. The robot is initially at rest.
M¨y=FT˙F=−F+kuM¨y=FT˙F=−F+ku
Parameters M,TM,T and
kk are unknown and should be estimated from output input data
(y,u).(y,u).
a) Use the state x=[y˙yF]x=[y˙yF] and write the model on state space form
˙x=A(θ)x+B(θ)u;y=C(θ)x;x(0)=0˙x=A(θ)x+B(θ)u;y=C(θ)x;x(0)=0
suitable for Grey-box identification.
b) Explain why all three parameters M,T,kM,T,k can not be identified from any output input data
(y,u)(y,u).
b) The file problem6data.mat
Download problem6data.mat contains data (y,u)(y,u) sampled at
Ts=0.1Ts=0.1. (The data includes some noise.) Estimate the two parameters
k,Tk,T assuming that the mass
M=5M=5 is known.
7. Bayesian Estimation
Say we know data y1,…,yN is drawn from a probability function
p(y;θ)=(1−θ)f0(y)+θf1(y)
where f0(y) and f1(y) are known functions, but where the parameter
θ∈(0,1) is unknown and should be estimated.
a) Calculate the Fisher information I(θ) and show that any bias-free estimator
ˆθ=t(y) needs to satisfy
E(θ−ˆθ)2≥1N[∫(f0(y)−f1(y))2(1−θ)f0(y)+θf1(y)dy]−1
(where we assume the integral exists)
b) Suggest a method to estimate θ from data
y1,…,yN which works well when
N→∞ (assuming
f0 is different from
f1).