Lec6aa 2021
Lec6aa 2021
Software:
M ATLAB (any recent version) + identification toolbox + optimization toolbox: E.g.
available from NCS.
Course material:
Overview topics: 3. Miscellaneous (second part of the lectures):
Lecture notes / slides in PDF-format from BlackBoard site.
On-line M ATLAB documentation of the toolboxes (selection).
• MIMO-systems
• Identification in the frequency domain Examination (5 EC):
• Identification of closed loop systems Exercises parallel to the lectures, usually to be handed in next week.
• Non-linear optimisation One exercise includes a lab experiment (during the “break” in March / April).
• Cases. The answers will be graded and may be discussed during an oral exam.
Grades will be available on-line∗.
Several system descriptions are available: • The amplification equals the absolute value |G(iω)|.
• The phase shift is found from the phase angle ∠G(iω).
• Continuous versus discrete time
• Time domain versus frequency domain
The output y(t) for an arbitrary input signal u(t) can be found by considering
Examples for LTI systems: all frequencies in the input signal: Fourier transform.
Continue time vs. Discrete time Zero order hold (ZOH) discretisation introduces a phase lag:
Laplace transform z transform
Transfer function: 1 Phase lag depends on
n1 s + n0 b1z −1 + b2z −2 frequency ω and sample time
G(s) = 2
G(z) = 0.5
d2s + d1s + d0 1 + a1z −1 + a2z −2 Ts: −ω · Ts/2 (in rad).
x [−]
Relation between s en z: z = esTs (Franklin (8.19)) 0 0
−20
phase [deg]
Stability: −0.5
−40
Poles in LHP: Poles inside the unit circle:
Re(s) < 0 |z| < 1 −1 −60
T = 0.1 s
0 0.5 1 1.5 2 −80
s
Fourier transforms
Signal characterisation
Continuous-time deterministic signals u(t): Fourier integral:
Z ∞ Z ∞
1
M ATLAB’s identification toolbox ident works with time domain data. Even then, U (ω) = u(t)e−iωt dt u(t) = U (ω)eiωt dω
−∞ 2π −∞
the frequency domain will appear to be very important. Furthermore,
identification can also be applied in the frequency domain. For a finite number (N ) of discrete-time samples ud(tk ): Fourier summation:
NX
−1
1 NX
−1
• Frequency content: Fourier transform UN (ωl ) = ud(tk )e−iωl tk ud(tk ) = UN (ωl )eiωl tk
k=0
N l=0
• Energy
• Power
UN (ωl ) with ωl = Nl ωs = Nl 2π
Ts , l = 0, ..., N − 1 is the discrete Fourier
transform (DFT) of the signal ud(tk ) with tk = kTs, k = 0, ...N − 1.
Deterministic or stochastic signals?
For N equal a power of 2, the Fast Fourier Transform (FFT) algorithm can be
applied.
Example: 32768 data samples of the piezo mechanism (left).
Energy and power (continue time signals)
6
900 10 Energy spectrum: Ψu(ω) = |U (ω)|2
4 Z∞ Z∞
800 10 1
Y [−]
Energy: Eu = u(t)2dt = Ψu(ω)dω
y [−]
2π
N
2 −∞ −∞
700 10
0 1
600 10 Power spectrum: Φu(ω) = lim |UT (ω)|2
0 2 4
0 0.5 1 10 10 10 T →∞ T
t [s] f [Hz] ZT Z∞
1 1
Power: Pu = lim u(t)2dt = Φu(ω)dω
T →∞ T 2π
0 −∞
DFT (right) in 16384 frequencies computed with M ATLAB’s fft command.
[ UT (ω) is de Fourier transform of a continuous time signal with a finite duration ]
Horizontal axis in steps of 1/(total measurement time) = 0.925 Hz.
Signal types
Energy and power (discrete time signals)
∞
X Examples: Mean E x(t)
Discrete time: y(k) = (g ∗ u)(k) = g(l)u(k − l) (t = 0, 1, 2, ...)
l=0
Power E (x(t) − E x(t))2
After Fourier transform: Y (ω) = G(ω) · U (ω) Cross-covariance: Rxy (τ ) = E[x(t) − Ex(t)][y(t − τ ) − Ey(t − τ )]
Power:
E (x(t) − E x(t))2 = Rx(0) = E (xd(t) − E xd(t))2 = Rxd (0) =
Z∞ Signals: • measurable input signal(s) u
1 T
Z
= Φx(ω) dω = Φxd (ω) dω • measurable output signal(s) y
2π 2π ω
−∞ s • unmeasurable disturbances v (noise, non-linearities, ...)
This estimator is • Give models with “many” numbers, so we don’t obtain models with a “small”
number of parameters.
• unbiased if the estimator E θ̂N = θ0. • The results are no “simple” mathematical relations.
• consistent, if for N → ∞ the estimator E θ̂N resembles a δ-function, or in • The results are often used to check the “simple” mathematical relations that
other words the certainty of the estimator improves for increasing N . are found with (subsequent) parametric identification.
• Non-parametric identification is often the fist step.
The estimator is consistent if it is unbiased and the asymptotic covariance ∗The IDENT commands impulse & step use a different approach that is related to the
lim covθ̂N = lim E(θ̂N − E θ̂N )(θ̂N − E θ̂N )T = 0 parametric identification to be discussed later.
N →∞ N →∞
Correlation analyse Ident manual: Tutorial pages 3-9,10,15; The Finite Impulse Response (FIR) ĝ(k), k = 0, 1, 2, ..., M , is a model
Function reference cra (4-42,43). estimator for system G0(z) for sufficiently high order M :
v
M
y(t) = G0(z) u(t) + v(t)
X
u
? y y(t) ≈ ĝ(k)u(t − k) (t = 0, 1, 2, ...)
-
G0 -
-
k=0
Note: In an analysis the lower limit of the summation can be taken less than 0 (e.g. −m) to
verify the (non-)existence of a non-causal relation between u(t) and y(t).
Using the Impulse Response g0(k), k = 0, 1, 2, ... of system G0(z)
How do we compute the estimator ĝ(k)?
∞
X
y(t) = g0(k)u(t − k) + v(t) (t = 0, 1, 2, ...) • u(t) en v(t) are uncorrelated (e.g. no feedback from y to u!!!).
k=0
• Multiply the expression y(t) = g0(k)u(t − k) + v(t) with u(t − τ )
P
Ryu (τ ) R̂yu (τ )
g0(τ ) = 2
and ĝ(τ ) = And what if u(t) is not a white noise signal?
σu σu2
∞
X
Wiener-Hopf: Ryu(τ ) = g0(k)Ru (τ − k)
k=0
Finding a pre-whitening filter L(z) for uF (k) = L(z)u(k):
And what if u(t) is not a white noise signal (continued)?
Try to use a linear model of order n (default in ident n = 10)
Option 2: Filter input and output with a pre-whitening filter L(z):
Suppose we know a filter L(z), such that uF (k) = L(z)u(k) is a white L(z) = 1 + a1z −1 + a2z −2 + ... + anz −n
noise signal.
N
Apply this filter to the output as well (yF (k) = L(z)y(k)), then 1 X
and look for a “best fit” of the n parameters such that e.g. u2 (k) is
yF (t) = G0(z) uF (t) + L(z)v(t) N k=1 F
so the impulse response ĝ(k) can also be estimated from uF (k) and minimised.
yF (k).
⇒ Exercise 3.
OK, but how do we find such a pre-whitening filter L(z)?
Impulse response of the piezo mechanism.
An example (1): The piezo mechanism.
[ir,R,cl]=cra(piezod,200,10,2);
Warning: All equations starting from y(t) = G0(z) u(t) + v(t) do not account Covf for filtered y Covf for prewhitened u
2000 2500
for offsets due to non-zero means in input and/or output. So detrend! 2000
1800
1500
Upper right: u is indeed
1600
150
Input and output signals
load piezo; 1000 whitened.
1400
100 500
50 Ts = 33e-6; 1200 0
Lower right: The impulse
y1
−50
u=piezo(:,2); 1000
−200 −100 0 100 200
−500
−50 0 50
0
detrend(piezo); 0
0
−50
plot(piezod);
−0.02
−500
T = 33 µs.
0 50 100 150 200 0 50 100 150 200
−100
0 0.2 0.4 0.6 0.8 1
Time
T = 1s −1
fs = 1 Hz
−1.5
u(t) binary signal in frequency band 0..0.3fs 0 5 10 15 20
Time [s]
25 30 35 40
Difficulty: For N → ∞ there is more data, but there are also estimators at more
Fourier transform (without v): Y (ω) = G0(eiωT )U (ω), so (=N/2) frequencies, all with a finite variance.
Y (ω)
G0(eiωT ) = . Solutions:
U (ω)
1. Define a fixed period N0 and consider an increasing number of
YN (ω) measurements N = rN0 by r → ∞. Carry out the spectral analysis for each
Estimator for G0(eiωT ) using N measurements: ĜN (eiωT ) = . period and compute the average to obtain a “good” estimator in N0/2
UN (ω)
frequencies.
V (ω)
Effect of v: ĜN (eiωT ) = G0(eiωT ) + N . 2. Smoothen the spectrum in the f -domain.
UN (ω)
An example: 32768 data samples of the output signal (position) of the piezo An example: 32768 data samples of the output signal (position) of the piezo
mechanism. mechanism.
7
10
6
10
5
10 6
10
5
10
5
10
4
10
4 4
10 10
3
10
3
3 10
10
2
2 10
10
2
10
1
10
0 1 2 3 4
10 10 10 10 10
1 1
10 10
0 1 2 3 4 0 1 2 3 4
10 10 10 10 10 10 10 10 10 10
Φ̂yu(ω)
−5 “reasonable” white. ĜN (eiωT ) = in 128 (default) frequencies.
10
Φ̂u(ω)
Smoothing is also applied and again depends on a parameter M , that sets the
0 1 2 3 4
10 10 10 10 10
Frequency (Hz)
Amplitude
• Not always straightforward to predict which method will perform best. Why
−2
10
not try both?
• ETFE is preferred for systems with clear peaks in the spectrum. −4
10
2 3 4
according to window
0
2 parameter:
Φ̂yu(ω)
−200
Φ̂v (ω) = Φ̂y (ω) − Phase (deg)
Φ̂u(ω) −400
M = 15
• Measure of signal
v
to noise ratio with the coherence spectrum −600 M = 30
u |Φ̂yu(ω)|2 M = 60 *
u
−800
κ̂yu(ω) = t M = 90
Φ̂y (ω)Φ̂u (ω) 10
2
10
3 4
10
Frequency (Hz) M = 120
q −1 + 0.5q −2 z + 0.5
−4
10 So G0(q) = or G0(z) = 2
10
2
10
3 4
10 1 − 1.5q −1 + 0.7q −2 z − 1.5z + 0.7
window 1 − q −1 + 0.2q −2 z 2 − z + 0.2
0
parameter: and H0(q) = or H0(z) = 2
−200
1 − 1.5q −1 + 0.7q −2 z − 1.5z + 0.7
Phase (deg)
−400
M = 15 Simulation: N = 4096
−600 M = 30 T = 1s
−800
M = 60 fs = 1 Hz
2 3 4
M = 90 * u(t) binary signal in frequency band 0..0.3fs
10 10 10
Frequency (Hz) M = 120 e(t) “white” noise (random signal) with variance 1
r=1 r=4 r = 16
Smoothen the ETFE: 2
10
1 −2
10
Periodic input,
r periods
Amplitude
0
0
10
−180
G0 −360
−1
10
−3 −2 −1 −3 −2 −1 −3 −2 −1
−2 −1 0
10 10 10 10 10 10 10 10 10
10 10 10
ETFE, M = 30 f [Hz] f [Hz] f [Hz]
2
w=1 w=2 w=4
−2
10
−180 Filtering, Hamming
window of width w 0
−270
−2 −1 0 −180
10 10 10
Frequency (Hz)
−360
−3 −2 −1 −3 −2 −1 −3 −2 −1
10 10 10 10 10 10 10 10 10
f [Hz] f [Hz] f [Hz]
Idea: Try to recognise “features” in the data. • Prediction of variable y on the basis of information provided by other
measured variables ϕ1, ..., ϕd.
• Immediately in u(k) en y(k) ???
• In the spectral models: Are there “features” e.g. like peaks as are are ϕ1
• Collect ϕ = .. .
expected in the Bode plots / FRF (eigenfrequency, ...) of a system with a
ϕd
complex pole pair.
• In the impulse response (measured or identified): • Problem: find function of the regressors g(ϕ) that minimises the difference
(1) Recognise “features” (settling time, overshoot, ...). y − g(ϕ) in some sense.
(2) Realisation algorithms → to be discussed next. So ŷ = g(ϕ) should be a good prediction of y.
y [−]
• Linear fit y = ax + b. " #
5
0
• Regression function g(ϕ) is parameterised. It depends on a set of x
Then g(ϕ) = ϕT θ with input vector ϕ = 0 5 10
parameters 1 x [−]
" # " #
θ1 a h i a
and parameter vector θ = . So: g(ϕ) = x 1 .
θ = .. . b b
θd
y [−]
Note that this does not imply any linearity with respect to the variables 5
x2
0
from ϕ.
Then g(ϕ) = ϕT θ with input vector ϕ = x −5
0 5 10
1 x [−]
• Special case: g(ϕ) = θ1ϕ1 + θ2ϕ2 + ... + θdϕd
c2 h i c2
So g(ϕ) = ϕT θ. and parameter vector θ = c1 . So: g(ϕ) = x2 x 1 c1 .
c0 c0