system identi cation - eth zsysid/course/2018slides/sysid_lecture09... · orbit of ceres and zach...
TRANSCRIPT
System IdentificationLecture 9: Time-domain correlation methods, persistency of excitation and
parametric models
Roy Smith
2018-11-13 9.1
Example: Ceres orbit determination
1801, 1st January. Guissepe Piazzi finds and makes 22observations of a “planet” over 44 days.
1801, February. Ceres is obscured by the sun. Theobservations correspond to 9 degrees of arc.
1801, June. Zach publishes the observational data.Many astronomers attempt to estimate when andwhere Ceres will reappear.
1801, September. Karl Fredrich Gauss estimates theorbit of Ceres and Zach publishes his empheris (alongwith many others). Those of Gauss differ significantly.
1801, 7th December.Zach locates Ceres within 1/2 adegree of Gauss’s prediction. Gauss refuses to disclosehis method and is accused by some of sorcery.
Dawn mission image of Ceres
(930 km. diameter)
2018-11-13 9.2
Example: Ceres orbit determination
1802. Gauss also estimates the orbit of Pallas.
1805 Legendre publishes a paper on the method of leastsquares.
1807 Gauss becomes director of Gottingen observatory. Olbersdiscovers Vesta and Gauss takes on 10 hours to estimate itsorbit. Cere’s orbit had taken him 100 hours.
1809. Gauss finally publishes details of his method and claimspriority over Legendre.
Gauss’s approach: least squares
Basic assumptions: Kepler’s laws of planetary motion.
§ Planetary orbits are ellipses with the sun at one of the foci.
§ A line drawn between the Sun and any planet sweeps out equal areas inequal time.
§ The ratio of the square of the orbital periods of two planets is equal to theratio of the cubes of their major semi-axes.
2018-11-13 9.3
Example: Ceres orbit determination
Gauss’s approach: least squares
The orbit of a planet is defined by five variables (orbital elements)
§ Two angles that orient the plane of the orbit with respect to the eclipticplane.
§ The size and eccentricity of the orbit. Equivalently, the length of themajor and minor semi-axes.
§ The tilt of the main axis of the orbit with respect to that of Earth’s orbit.
Ecliptic plane
Sun
Ceres
EarthP
P
E
C
§ Specifying the position on the orbita particular time, then determinesthe planet’s position in space.
2018-11-13 9.4
Example: Ceres orbit determination
Gauss’s approach: least squares
§ Select three observations: 1 January, 21 January and 11 February.§ Calculate a nominal orbit matching the observations.
§ Calculate a Taylor series approximation to the nonlinear differentialequations.
§ Iterative refinement of the nominal orbit.
§ Adjust linearized versions of the orbit to minimise the sum of squares ofthe error in all 22 observations.
Problem formulation
y “
»—————–
RA of obs. 1Dec. of obs. 1
...RA of obs. 22
Dec. of obs. 22
fiffiffiffiffiffifl“ Hpθ, tq, where θ “ vector of orbital elements.
2018-11-13 9.5
Example: Ceres orbit determination
Problem formulation
ε “ yobs ´Hpθ, tq, ε is the vector of residuals.
Define a “cost function”: Jpθq “ εTR´1ε
2, with weighting: R ą 0.
Optimisation: θ “ argminθ
Jpθq.
Nominal orbit
1 Jan.
21 Jan.
11 Feb.
Nominal orbit
LS fit candidate orbits
εj
Nominal orbit determination Estimated orbit errors6 equations in 6 unknown parameters. 44 equations in 6 unknown parameters.
2018-11-13 9.6
Example: Ceres orbit determination
Linearisation and iterative refinement
The nominal orbit is specified by θ0. Close to this,
Hpθq « Hpθ0q `Hθpθ ´ θ0q, where Hθ “ BHBθ
ˇˇθ0
.
Define δθ “ θ ´ θ0 and δy “ yobs ´Hpθ0q. Then,
Jlinearpδθq “ pδy ´HθδθqTR´1pδy ´HθδθqT2
« Jpθ0 ` δθq.
The gradient of Jlinearpθq is,
BJlinearpθqBθ “ ´HT
θ R´1pδy ´Hθδθq.
Setting this to zero is equivalent to solving,
HTθ R
´1Hθδθ “ HTθ R
´1δy. (linear least-squares problem)
Solve for δθ and iteratively update: θ0,new “ θ0,old ` δθ.
2018-11-13 9.7
Example: Ceres orbit determination
Gauss’s sketch References
Skizze der Bahnen derKleinplaneten Ceres, Pallas undVesta. “AstronomischeUntersuchen und Rechnungenvornehmlich ber die CeresFerdinandea,” 1802. SUBGottingen: Cod. Ms. GaußHandbuch 4, Bl. 1.
R. Bannister, Am. J. Phys.,71(12), pp. 1268–1275, Dec.2003.
L. Weiss, “Gauss and Ceres,”(www.math.rutgers.edu/~cherlin/History/Papers1999/weiss.html).
2018-11-13 9.8
Time-domain parametrisations
Pulse response
ypkq “8ÿ
i“0
gpiqupk ´ iq
Real-rational transfer functions
G “ BpzqApzq “
b1zn´1 ` b2zn´2 ` . . . bmzn´m
zn ` a1zn´1 ` a2zn´2 ` . . . an
“ b1z´1 ` b2z´2 ` . . . bmz´m
1` a1z´1 ` a2z´2 ` . . . anz´n
State-space representations
xpk ` 1q “ Axpkq `Bupkqypkq “ Cxpkq `Dupkq
2018-11-13 9.9
Parametrised model sets
We are looking for the plant, G, in a parametrised set,
tGpθqu ,that most closely matches the experimental data.
θ P Rd is the parameter vector.
Model structure Parameter vector, θ P Rd
Pulse response: gpkq “gp0q gp1q . . .
‰T
Transfer function:BpzqApzq
“a1 . . . b1 . . .
‰T
State-space:
„A B
C D
“Aij . . . Bij . . . Cij . . .
‰T
2018-11-13 9.10
Identification framework
Measurement data
Define the measurement data set:
ZK “ tup0q, yp0q, . . . , upK ´ 1q, ypK ´ 1qu.
Objective
Define the cost function (includes the model structure)
Jpθ, ZKq
General optimisation formulation
minimiseθ
Jpθ, ZKq or θ “ argmin Jpθ, ZKq.
2018-11-13 9.11
Optimisation objectives
Residual error objectives
error: epk, θq “ ypkq ´Gpθqupkq.Jpθq “ }epθq}22 or }epθq}8, or }epθq}1?
Parametric error objectives
Jpθq “ }θ ´ θ0}2 or Etθ ´ θ0u
Prediction error objective
Jpθq “ Etypk ` 1q ´ ypk ` 1, θ|kqu
2018-11-13 9.12
Correlation-based methods
Autocorrelation (periodic signals)
Rxpτq “ 1
N
N´1ÿ
k“0
xpkqxpk ´ τq, τ “ 0, . . . , N ´ 1.
Note that Rxpτq is also periodic.
Autocorrelation (random stationary signals)
Rxpτq “ Etxpkqxpk ´ τqu
“ limNÝÑ8
1
N
N´1ÿ
k“0
xpkqxpk ´ τq (for x „ N p0, σ2q )
2018-11-13 9.13
Correlation-based methods
Input-output relationship
ypkq “8ÿ
i“0
gpiqupk ´ iq ` vpkq
Etypkqupk ´ τqu “ E
# 8ÿ
i“0
gpiqupk ´ iqupk ´ τq+` Etvpkqupk ´ τqu
“8ÿ
i“0
gpiqEtupk ´ iqupk ´ τqu (if noise is uncorrelated)
“8ÿ
i“0
gpiqRupτ ´ iq
Ryupτq “ gpkq˚Rupτq. (convolution)
2018-11-13 9.14
Correlation-based methods
Matrix representation
The input-output relationship,
Ryupτq “ gpkq˚Rupτqcan be written in matrix form,
»—————–
Ryup0qRyup1qRyup2q
...
fiffiffiffiffiffifl“
»—————–
Rup0q Rup´1q Rup´2q ¨ ¨ ¨Rup1q Rup0q Rup´1qRup2q Rup1q . . .
. . .
.... . .
. . .
fiffiffiffiffiffifl
»—————–
gp0qgp1qgp2q...
fiffiffiffiffiffifl.
2018-11-13 9.15
Correlation-based methods
Finite data estimate
Create finite length estimates from this relationship;
»——–
Ryup0q...
RyupN ´ 1q
fiffiffifl
loooooooomoooooooonRyu
“
»——–
Rup0q ¨ ¨ ¨ Rup´pN ´ 1qq...
...
RupN ´ 1q ¨ ¨ ¨ Rup0q
fiffiffifl
loooooooooooooooooooooooomoooooooooooooooooooooooonRN
»——–
gp0q...
gpN ´ 1q
fiffiffifl .
Note that Rup´τq “ Rupτq.
In the periodic (noise-free) and FIR case this is exact,
if N is the period and gpτq “ 0 for τ ě N .
2018-11-13 9.16
Correlation-based methods
If RN is invertible
g “ R´1N Ryu.
Invertibility of RN is guaranteed if upkq is “persistently exciting”.
Under these conditions g is uniquely determined.
2018-11-13 9.17
Persistency of excitation
A stationary input, upkq, is persistently exciting of order n if,
Rn “
»—–
Rup0q ¨ ¨ ¨ Rup´pn´ 1qq...
...Rupn´ 1q ¨ ¨ ¨ Rup0q
fiffifl
is positive definite (Rn ą 0).
This is sufficient to uniquely determine the first n coefficients of the pulseresponse, gpkq, via the correlation approach.
The definition also applies to deterministic (or quasi-stationary) signals.
A signal is simply called persistently exciting if this holds for all n.
2018-11-13 9.18
Persistency of excitation
Spectra of persistently exciting signals
If upkq is persistently exciting of order n then,
φupejωq ‰ 0, for at least n frequencies.
Moving average (MA) filtering
An nth order MA filter: Mnpzq “ m1z´1 ` ¨ ¨ ¨ `mnz
´n.
If for all nth order MA filters,
ˇˇMnpejωq
ˇˇ2
φupejωq “ 0 ùñ Mpejωq “ 0,
then upkq is persistently exciting of order at least n.
2018-11-13 9.19
Examples
Step function
upkq “ 1, k “ 0, 1, . . . is persistently exciting of order 1.
PRBS signal of period M :
This is persistently exciting of order M .
Sum of sinusoids:
upkq “Sÿ
s“1
αs cospωsk ` φsq
persistently exciting of order
$’&’%
2S if 0 ă ωs ă π, s “ 1, . . . , S
2S ´ 1 if ω “ 0 or ω “ π P tωs, s “ 1, . . . , Su2S ´ 2 if ω “ 0 and ω “ π P tωs, s “ 1, . . . , Su
2018-11-13 9.20
ARX and ARMAX models
Autoregressive moving average models
Model form (without noise):
Gpzq “ b1z´1 ` ¨ ¨ ¨ ` bmz´m
1` a1z´1 ` ¨ ¨ ¨ ` anz´n .
Input output reationship:
ypkq “ Gpzqupkq“ ´a1ypk ´ 1q ´ ¨ ¨ ¨ ´ anypk ´ nq ` b1upk ´ 1q ` ¨ ¨ ¨ ` bmupk ´mq“ ϕT pkqθ
where
ϕpkq “ “´ypk ´ 1q ¨ ¨ ¨ ´ypk ´ nq upk ´ 1q ¨ ¨ ¨ upk ´mq‰T
θ “ “a1 ¨ ¨ ¨ an b1 ¨ ¨ ¨ bm
‰T.
2018-11-13 9.21
ARX and ARMAX models
Autoregressive moving average models
ypkq “ Gpθ, zqupkq “ ϕT pkqθ.where ϕpkq is called the regressor vector
θ is the parameter vector.
Because we can calculate ypkq from the model, with knowledge of past ypkq,upkq and model parameters, θ, the output ypkq is sometimes written as,
ypkq “ ϕT pkqθ “ ypk|θq,to emphasize the parameter dependence.
2018-11-13 9.22
Least squares estimation
Model framework (ARX or ARMAX)
Consider ypkq “ ϕT pkqθ for k “ 0, . . . , N ´ 1.
»—–
yp0q...
ypN ´ 1q
fiffifl
looooooomooooooonY
“
»—–
ϕT p0q...
ϕT pN ´ 1q
fiffifl
loooooooomoooooooonΦ
θ.
or, in matrix form, Y “ Φθ
If N ą pn`mq this system is overdetermined.
Least squares solution
θ “´
ΦTΦ¯´1
ΦTY (Matlab: Theta = Phi\Y;)
2018-11-13 9.23
Least squares estimation
Optimisation framework
The least squares solution, θ “ `ΦTΦ
˘´1ΦTY, solves the problem,
minimiseθ
}ε}2subject to Y “ Φθ ` ε
Define the cost function: Jpθ, ZN q “ }Y ´ Φθ}2 “ }ε}2
General formulation:
θ “ argminθ
Jpθ, ZN q
“ argminθ
}ε}2subject to : ε “ Y ´ Φθ.
2018-11-13 9.24
Example
System: Gpz, θq “ bz´1
p1` az´1q “b
pz ` aq where θ “„ab
.
Difference equation: ypkq “ ´aypk ´ 1q ` bupk ´ 1q.
Least squares solution:
«a
b
ff“
»————–
N´1ÿ
k“0
y2pk ´ 1q ´N´1ÿ
k“0
ypk ´ 1qupk ´ 1q
´N´1ÿ
k“0
ypk ´ 1qupk ´ 1qN´1ÿ
k“0
u2pk ´ 1q
fiffiffiffiffifl
´1
»————–
´N´1ÿ
k“0
ypkqypk ´ 1qN´1ÿ
k“0
ypkqupk ´ 1q
fiffiffiffiffifl
2018-11-13 9.25
Example
Step response experiment
vartvpkqu “ 0.252
ypkq
Gpzqupkq (noise-free)
upkq
´1
´0.5
0
0.5
1
1.5
2
2.5
3
index: k5 10 15 20
2018-11-13 9.26
Example
Least-squares estimates: step response experiment
b “ 0.5
a “ ´0.7
astep
bstep
´1
´0.5
0
0.5
1.0
index: k5 10 15 20
Gpθ, zq “ bz´1
1` az´1.
Estimates (apkq,bpkq) calculated from: (ypiq,upiq), i “ 0, k.
2018-11-13 9.27
Example
PRBS response experiment
PRBS period “ 7, vartvpkqu “ 0.252
ypkq
Gpzqupkq(noise-free)
upkq
´1.5
´1.0
´0.5
0
0.5
1.0
1.5
index: k5 10 15 20
2018-11-13 9.28
Example
Least-squares estimates: step response and PRBS
b “ 0.5
a “ ´0.7
astep
bstep
aprbs
bprbs
´1.0
´0.5
0
0.5
1.0
index: k5 10 15 20
Gpθ, zq “ bz´1
1` az´1.
Estimates (apkq,bpkq) calculated from: (ypiq,upiq), i “ 0, k.
2018-11-13 9.29
Statistical properties of the LS estimates
Model
Y “ Φθ ` ε, ε “
»—–
εp0q...
εpN ´ 1q
fiffifl
Error assumptions,
Etεu “ 0, EtεεT u “ σ2I.
LS estimator properties
Assume that Φ is fixed, but consider ε as a stochastic variable.
Etθu “ θ (unbiased estimator)
covtθu “ E!pθ ´ θqpθ ´ θqT
)“ σ2
´ΦTΦ
¯´1
.
2018-11-13 9.30
Least square estimators
Model with correlated noiseY “ Φθ ` ε, with EtεεT u “ R.
LS estimator properties
Assume that Φ is fixed, but consider ε as a stochastic variable.
Etθu “ θ (unbiased estimator)
covtθu “ E!pθ ´ θqpθ ´ θqT
)“
´ΦTΦ
¯´1
ΦTRΦ´
ΦTΦ¯´1
Note the simplification to the white noise case if R “ σ2I.
2018-11-13 9.31
Best linear unbiased estimator (BLUE or Markov estimate)
Model with correlated noise
Y “ Φθ ` ε, with EtεεT u “ R.
Best linear estimator
Linear estimators: θ “ ZTY
The linear estimator: Z “ R´1Φ´
ΦTR´1Φ¯´1
satisfies:
EtθZu “ θ, (unbiased)
covtθZu “´
ΦTR´1Φ¯´1 ď covtθu for any unbiased estimate.
Note that the BLUE requires knowledge of the error covariance, R.
2018-11-13 9.32
Error statistics and noise statistics
Experimental configuration
Gpθ, zq`ypkq upkqvpkq
Estimation framework»—–
yp0q...
ypN ´ 1q
fiffifl “
»—–
ϕT p0q...
ϕT pN ´ 1q
fiffifl θ `
»—–
vp0q...
vpN ´ 1q
fiffifl ,
But,
ϕT pkq “ “´ypk ´ 1q ¨ ¨ ¨ ´ypk ´ nq upk ´ 1q ¨ ¨ ¨ upk ´mq‰
` “´vpk ´ 1q ¨ ¨ ¨ ´vpk ´ nq 0 ¨ ¨ ¨ 0‰,
and so Φ is a function of ypkq, upkq, and vpkq.So it is not the case that Y “ Φθ ` V . (vpkq ‰ εpkq in the LS problem)
2018-11-13 9.33
Equation error models
Model form
ypkq ` a1ypk ´ 1q ` ¨ ¨ ¨ ` anypk ´ nq “b1upk ´ 1q ` ¨ ¨ ¨ ` bmupk ´mq ` vpkq
ApzqY pzq “ BpzqUpzq ` V pzq
Now we have: Y “ Φθ ` V.
Bpθ, zq`1
Apθ, zqypkq upkq
vpkq
The noise also has the autoregressive dynamics (in Apzq).
2018-11-13 9.34
Example revisted
Equation error system response
PRBS period “ 7, vartvpkqu “ 0.252
ypkq
Gpzqupkq(noise-free)
upkq
´1.5
´1.0
´0.5
0
0.5
1.0
1.5
index: k5 10 15 20
2018-11-13 9.35
Example revisted
Least-squares estimates: equation error structure
b “ 0.5
a “ ´0.7
astep
bstep
aprbs
bprbs
aee
bee
´1.0
´0.5
0
0.5
1.0
index: k5 10 15 20
Gpθ, zq “ bz´1
1` az´1.
Estimates (apkq,bpkq) calculated from: (ypiq,upiq), i “ 0, k.
2018-11-13 9.36
Bibliography
Persistency of excitation
Lennart Ljung, System Identification;Theory for the User, 2nd Ed., Prentice-Hall,1999, [section 13.2].
ARX modelsLennart Ljung, System Identification;Theory for the User, 2nd Ed., Prentice-Hall,1999, [sections 1.3 and 4.2].
LS estimation statisticsLennart Ljung, System Identification;Theory for the User, 2nd Ed., Prentice-Hall,1999, [section 10.1 and appendix II].
2018-11-13 9.37