# Assignment 2 - System Identification编程代写

- 首页 >> WebESS101 Mod & Sim

SP1 2023

Assignment 2 - System Identification

Due date: 2023-09-27

In this assignment, we will explore various aspects of parameter estimation including least-squares estimation and

system identification. Write a small report providing the answers to the questions. For compute exercise, provide

the answers in the report and a file with the Matlab code, too.

Instructions

The assignments comprise an important part of the examination in this course. Hence, it is important to

comply with the following rules and instructions:

• The assignment is pursued in groups of two students. For group formation procedures, see Canvas.

• The findings from each assignment are described in a short report, written by each group independently.

• The report should provide clear answers to the questions, including your motivations, explanations,

observations from simulations etc. Figures included in the report should have legends, and axes should

be labelled.

• Since the assignments are part of the examination in the course, plagiarism is of course not allowed. If

we observe that this happens anyway, it will be reported.

• The report should be uploaded to Canvas before the deadline. Matlab code is uploaded as separate files.

If the deadline is not met, we cannot guarantee that you will be able to complete the assignment during

the course.

• The written report is graded PASS, REVISE or RESUBMIT. With a decision REVISE, you will get a

new due date to provide a revised report with changes highlighted. With a decision RESUBMIT, you

will need to submit a completely rewritten report.

First part - Estimators and Least Squares.

1. Unbiased estimate. Consider the data samples {x[0],··· , x[N − 1]}, where each sample is distributed as

U [0,θ] (uniform distribution in the interval [0,θ]) and the samples are IID.

(a) Find an unbiased estimator for θ. The range of θ is 0 < θ < ∞.

Hint: Think about the relation between the mean value of the data samples and the parameter you want to

estimate!

2. Linear least squares. Consider the linear system

y[k] = θu[k] +e[k], k = 0,··· ,N −1 (3)

with θ being a parameter to estimate and e[k] ∼ N (1,σ

2

).

(a) Compute the least-squares estimate of θ.

(b) Is the estimate biased? If yes, give the expression of the bias.

(c) What happens to the estimation of θ if u[k] = 0,∀k?

3. Computer exercise. Curve fitting. In Matlab, create a noise-corrupted 2 dimensional dataset {x(i), y(i)},

i = 1,...N following the relation denoted by y = a0+b0 ∗x+e where e ∼ N (µ, σ

2

), with µ = 0,σ = 3.8, true

parameters a0 = −2.923,b0 = 7.18, N = 100, and limiting values of x up to 50. x can be chosen uniformly in

range [0,50]. (If you would like to generate the same figures you can use rng(1) command to fix the seed to

generate the same random data.)

ESS101 Mod & Sim Assignment 2 - System Identification - Page 2 of 2 Due date: 2023-09-27

Figure 1: Linear regression based on least squares

(a) Report the parameters that correspond to the line that best fits this data using the least squares solution,

and plot the line together with the data points as in the first plot in Fig. 1.

(b) Fit a 2nd order polynomial to a dataset created with y = a0 +b0 ∗ x +c0 ∗ x

2 +e,µ = 0,σ = 12.8,a0 =

−2.923,b0 = 7.18, c = 2.8 and x values up to 50, only altering θ in the previous line fitting exercise

and plot the resulting model fit as in the second plot in Fig. 1, also fit a line to the same data in the

third plot in Fig. 1 and compare the resulting residual of the both polynomial and line fitting values,

ε = 1/N ∑

N

i=1

(y(i) −yˆ(i)

)

2

.

Second part - Identification of linear models for dynamical systems.

1. One-step ahead predictor. Consider the following model structure

y(t) +a1y(t −1) +a2y(t −2) = b0u(t) +e(t) +c1e(t −1) (5)

(a) What kind of model structure is it (ARX, FIR, ARMAX, OE)?

(b) Which are the expressions of the plant model G and noise model H?

(c) Find the 1-step-ahead predictor for Model (5).

(d) Is the 1-step-ahead predictor you found a linear function of the parameters?

2. Prediction or simulation? Consider the following model structure

y(t) +a1y(t −1) = b0u(t) +e(t) +a1e(t −1) (9)

(a) What kind of model structure is it (ARX, FIR, ARMAX, OE)?

(b) Find the 1-step-ahead predictor for the model in (a). Something weird is happening! Can you explain

what and why?

3. Computer exercise. Identification of an ARX model. In Matlab, load the data files input.mat and output.mat from Canvas. The data contained in the file are generated using an ARX model with additive white

Gaussian noise (σ

2 = 0.01). Consider the following candidate ARX model structures,

y(t) +a1y(t −1) +a2y(t −2) = b0u(t) +e(t) (12a)

y(t) +a1y(t −1) +a2y(t −2) = b0u(t) +b1u(t −1) +e(t) (12b)

y(t) +a1y(t −1) +a2y(t −2) +a3y(t −3) = b1u(t −1) +e(t) (12c)

(a) Split the data in estimation and validation data, and identify the parameters of each candidate ARX

model, using the estimation data. Hint: ARX models provide a 1-step-ahead predictor, which is a linear

regression in the parameters. Hence, compute the predictor and use linear least-squares to find a closedform expression for the parameter estimates.

(b) For each estimated model, write a small script for computing the simulated and predicted (1-step) output,

using the validation data. Compare those outputs with the true data (you can use Root Mean Square Error

as a measure of the goodness of the comparison). Which model is the best in simulation? And which

one in prediction?