Professional Documents
Culture Documents
Robert Grepl
Institute of Solid Mechanics, Mechatronics and Biomechanics
Faculty of Mechanical Engineering, Brno University of Technology
2010 - 2015
Black box - agenda
1. Prerequisities:
Least squares.
Discrete dynamic system.
2. How to use LS to estimate parameters of DDS?
Example: mechanical oscillator
3. Problem: Noise.
www.mechlab.cz 2
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Methods: Least Squares 1/2
result:
www.mechlab.cz 4
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
LS example: regression 1D function
fit 1D function
(this task = the fitting of static model linear in parameters)
noise added to measurement
regression matrix: 2.5
noisy data
2 original
fit
1.5
0.5
0
y
-0.5
-1
[E015] -1.5
-2
-2.5
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
t
www.mechlab.cz 5
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Recursive Least Squares (RLS) (Plackett's algorithm)
online estimation
gives identical result as OLS
assume model
in matrix form:
www.mechlab.cz 6
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Black box - agenda
1. Prerequisities:
Least squares.
Discrete dynamic system.
www.mechlab.cz 7
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
OLS & RLS example:
Estimation of mass+spring+damper system 1/3
1) Discretization
www.mechlab.cz 8
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
OLS & RLS example:
Estimation of mass+spring+damper system 2/3
2) Create matrix X and vector Y
Y(k) = y(k);
X(k,:) = [y (k-1), y(k-2), u(k-2)];
{E003}
www.mechlab.cz 9
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
OLS & RLS example:
Estimation of mass+spring+damper system 3/3
1. Prerequisities:
Least squares.
Discrete dynamic system.
2. How to use LS to estimate parameters of DDS?
Example: mechanical oscillator
3. Problem: Noise.
www.mechlab.cz 11
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Problem = noise: simple example study setup 1/4
Ts
1.5
simulation data : 1
x
0.5
0
0 2 4 6 8 10
t
1.5
x(k+1)
0.5
-1 0 1 2 www.mechlab.cz
3 12
ISMMB, Faculty of Mechanical Engineering, Brno
x(k) University of Technology
Problem = noise: simple example study
without noise 2/4
Consider ini value x_0 and simulate equation: xk 1 axk
On lower Fig. we see the plot x(k) vs. x(k+1).
From the equation, it is obvious, that it should be a line.
The slope of this line is a.
2
With data WITHOUT noise, 1.5
x
0.5
0
0 2 4 6 8 10
t
1.5
x(k+1)
0.5
-1 0 1 2 3
x(k)
www.mechlab.cz 13
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Problem = noise: simple example study
noise on output 3/4
Consider further the noise on output (e.g. noise of sensor).
Equation: xk 1 axk
(w is random number with normal distribution (Gauss) yk xk w
We can observe a problem with estimation of parameter a.
6
% simulation
5 5 x(1) = x0;
for i = 2:length(t)
4 4
x(i,1) = a*x(i-1);
3 5
3
y(i,1) = x(i) + randn*0.2;
end
x(k+1)
2
x
4 2
1
1
0
3
x(k+1)
0
-1
2
-1
-2
0 2 4 6 8 10 -1 0 1 2 3 4 5
t 1 x(k)
0
Example:
-1
SI 004
4 6 8 10 -1 0 1 2 3 4 5
t x(k) www.mechlab.cz 14
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Problem = noise: simple example study
2
2
x
x(k+1)
2
0 0
0
-2 -2
-2
-4 -4
-6 -4
-6
Example:
-8
0 2 4 6 8 10
-6
-5 0 5 10
SI 004
t x(k)
0 2 4 6 8 10 -5 0 5 10 www.mechlab.cz 15
t x(k)
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Linear Models for System Identification
www.mechlab.cz 16
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Linear Models for System Identification
AR autoregressive model
MA moving average
example: smoothing
www.mechlab.cz 17
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Linear Models for System Identification
Very popular linear in parameters
OLS
ARMA
ARX
ARMAX
OE
www.mechlab.cz 18
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Black-box identification
- the use of a tool System Identification/GUI
Robert Grepl
Institute of Solid Mechanics, Mechatronics and Biomechanics
Faculty of Mechanical Engineering, Brno University of Technology
2010 - 2015
System Identification Toolbox - GUI
www.mechlab.cz 20
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
System Identification Toolbox GUI: Import data
www.mechlab.cz 21
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
System Identification Toolbox GUI: Preprocessing
Check
imported data
www.mechlab.cz 22
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
System Identification Toolbox GUI: Select data
Data for
estimation
Data for
verification
www.mechlab.cz 23
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
System Identification Toolbox GUI:
Estimate order of the system
Example:
You can estimate ARX
several ARX models at
once.
Think about noise...
Example:
OE
www.mechlab.cz 24
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Exercise
S005
www.mechlab.cz 25
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Dodatky
www.mechlab.cz 34
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Offline vs. online odhad parametr
batch estimation
measurement in time (0,T)
data processing
parameter estimation using all data
online estimation
parameter estimation during system operation
recursive algorithm
advantages:
memory requirements (often) reduced OLS vs. RLS
the slow changes of parameters can be captured
www.mechlab.cz 35
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Recursive Least Squares (RLS) (Plackett's algorithm)
online estimation
gives identical result as OLS
assume model
in matrix form:
www.mechlab.cz 36
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
OLS & RLS example:
Estimation of mass+spring+damper system 3/3
-50
0 2 4 6 8 10a1
t [s] a2
convergence of Recursive LS (RLS) b2
2
1
0
-1
0 2 4 6 8 10
t [s]
www.mechlab.cz 38
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Estimation of OE: Instrumental Variable (IV) Method
4. Estimate
www.mechlab.cz 39
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Nonlinear Least Squares 1/2
Taylor series
gradient:
www.mechlab.cz 40
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Nonlinear Least Squares 2/2
Newtons method
Gauss-Newton
Levenberg-Marquardt
www.mechlab.cz 41
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Example NLS: Solution of overdetermined system
0.8
values of x
0.6 LM lambda = 2
0.4 GN alpha = 0.5
solution of individual equations
0.2
0
0 2 4 6 8 10 12 14 16 18 20
[E002] iterations
Plot of square error
0.8
f21
0.6
f22
0.4
f21 + f22
0.2
0
0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3
variable x
www.mechlab.cz 42
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
References
www.mechlab.cz 43
ISMMB, Faculty of Mechanical Engineering, Brno University of Technology
Kontakt: www.mechlab.cz
stav mechaniky tles, mechatroniky a biomechaniky
Fakulta strojnho inenrstv
Vysok uen technick v Brn
doc. Ing. Robert Grepl, Ph.D.
grepl@fme.vutbr.cz