ELEC-E8116 Model-based control systems
/exercises and solutions 3
Problem 1. Consider the mass/spring/damper system shown in the figure. The
control forces are F1 and F2. Parameter values: k1=1, k2=4, b1=0.2, b2=0.1, m1=1,
m2=2.
a. Form a differential model of the system.
b. Form a state-space representation of the system.
c. Plot the singular values as functions of frequency (Matlab).
d. Calculate the H∞-norm (Matlab).
F1 y1
m1
F2 k1 b1 y2
m2
k2 b2
Solution:
a. By applying Newton’s 2. law
m1 y1 = F1 − k1 ( y1 − y 2 ) − b1 ( y1 − y 2 )
m2 y2 = F2 + k1 ( y1 − y 2 ) + b1 ( y1 − y 2 ) − k 2 y 2 − b2 y 2
b. Choose the state variables x1 = y1 , x 2 = y 2 , x3 = y1 , x 4 = y 2 so that
x1 = x3
x 2 = x 4
m1 x 3 = F1 − k1 ( x1 − x 2 ) − b1 ( x3 − x 4 )
m2 x 4 = F2 + k1 ( x1 − x 2 ) + b1 ( x3 − x 4 ) − k 2 x 2 − b2 x 4
The state-space representation is
x = Ax + Bu
y = Cx
in which
0 0 1 0
0 0 0 1
− k k1 − b1 b1
A=
1
m1 m1 m1 m1
k1 − ( k1 + k 2 ) b1 − (b1 + b2 )
m2 m2 m2 m2
0 0
0
1 0
1 0 0 0 0 0
B= 0 C= D=
m1 0 1 0 0 0 0
1
0
m2
When using Matlab also the D matrix must be given (with correct
dimensions).
c. In Matlab the command sigma(A,B,C,D) gives the figure
Singular Values
30
20
10
Singular Values (dB)
-10
-20
-30
-40
-50
-1 0 1
10 10 10
Frequency (rad/sec)
d. The calculation of the H∞-norm of the transfer function is a difficult task (and
no theoretical background for it has been given during the course either). Use
the commands of the Robust Control Toolbox in Matlab (it is related to robust
control theory, but the toolbox can be utilized in other purposes also).
1. G = pck(A,B,C,D); form the system matrix. The transfer function (or matrix of the
transfer functions) can be also defined using ss(A,B,C,D) or tf(A,B,C,D).
2. hinfnorm(G,0.001); - calculate an approximation to the norm; tolerance
(accuracy) 0.001
The result is between 11.47 and 11.48 at the angular frequency 0.848. Note that in
the figure the singular values are in dB-units.
Problem 2. (Matlab) Consider the transfer function matrix
10( s + 1) 1
2 s +1
G ( s ) = s + 0.2 s + 100
s+2 5( s + 1)
2
s + 0.1s + 10 ( s + 2)( s + 3)
Determine a realization and plot the singular values.
Solution:
Calculate the transfer function matrix by using Matlab
g11=10*tf([1 1],[1 0.2 100]);
g12=tf(1,[1 1]);
g21=tf([1 2],[1 0.1 10]);
g22=5*tf([1 1],conv([1 2],[1 3]));
G=[g11 g12;g21 g22];
Change into the state-space form
Gss=ss(G);
Form the minimal realization i.e. the representation with a minimal number of state
variables that generates the same input-output behaviour.
Gssm=minreal(ss(G));
Look at the matrices of the representation
[A,B,C,D]=ssdata(Gss);
[Am,Bm,Cm,Dm]=ssdata(Gssm);
We note that the first state-space representation was in fact the minimal realization (A
= Am etc.)
Plot the largest and smallest singular value
sigma(A,B,C,D)
Problem 3. Two systems are given by the two transfer function matrices below.
Calculate the poles and zeros
2( s + 1)( s + 2) s+2
G1 ( s ) =
s ( s + 3)( s + 4) ( s + 1)( s + 3)
1 s+3
s +1 ( s + 1)( s − 2)
G2 ( s) =
10 5
( s − 2) s+3
Solution:
2( s + 1)( s + 2) s+2
System 1: Minors ,
s ( s + 3)( s + 4) ( s + 1)( s + 3)
The pole polynomial p ( s ) = s ( s + 1)( s + 3)( s + 4) , from which the poles
s = 0, s = −1, s = −3, s = −4 . (All poles are single, so that the minimal realization has
four states).
The “largest” minors (here the only ones have the degree 1. Arrange the pole
polynomial to the denominator
2( s + 1) 2 ( s + 2) s ( s + 2)( s + 4)
,
s ( s + 1)( s + 3)( s + 4) s ( s + 1)( s + 3)( s + 4)
The zero polynomial is z ( s ) = s + 2 , so that the zero is s = −2 .
But what about Matlab. Let us try
G1=[tf([2 6 4],[1 7 12 0]),tf([1 2],[1 4 3])];
pole(G1)
ans =
0
-4
-3
-3
-1
One pole appears twice. Try the minimal realization
pole(minreal(G1))
ans =
0
-4
-3
-3
-1
Same results. But programs are only programs! Form first a state-space realization,
and from it the minimal realization
G1ss=minreal(ss(G1))
1 state(s) removed.
Now the extra state disappeared
a=
x1 x2 x3 x4
x1 -3.0047 0.33629 -0.35451 -0.57787
x2 2.6142 -0.31631 -0.18814 0.39683
x3 2.4213 -0.47446 -4.2822 -0.90475
x4 -1.6142 0.31631 2.1881 -0.39683
b=
u1 u2
x1 -1.4021 0.16105
x2 0.46736 -0.053685
x3 0.70105 0.91947
x4 -0.46736 0.053685
c=
x1 x2 x3 x4
y1 -1.2095 -0.34684 1.2297 0.84684
d=
u1 u2
y1 0 0
Continuous-time model.
pole(G1ss)
ans =
-3.0000
-4.0000
-0.0000
-1.0000
The result is correct. The Matlab command tzero(G1) (transmission zero) gives the
zero –2, as desired.
System 2: Minors
1 s+3 10 5
, , , ,
s + 1 ( s + 1)( s − 2) s−2 s+3
5 10( s + 3) − 5( s 2 + 16 s + 14)
− ==
( s + 1)( s + 3) ( s + 1)( s − 2) 2 ( s + 1)( s + 3)( s − 2) 2
Pole polynomial p( s ) = ( s + 1)( s − 2) 2 ( s + 3) , poles s = −1, 2, − 3 .
The pole 2 has the degree 2; the minimal realization has four states.
Zeros: the largest minor has the dimension 2. Arrange again the pole polynomial to
the denominator
− 5( s 2 + 16 s + 14)
z ( s) =
( s + 1)( s − 2) 2 ( s + 3)
Zeros -15.07, -0.93 (both have the degree one). Confirm with Matlab.
Problem 4. By considering the static system
0 100
G (s ) =
0 0
prove that eigenvalues do not give a reliable view about the gain of a multivariable
system. What is a better alternative?
Solution: The eigenvalues of the matrix are both zero. However, the input
u = [0 1] gives the output y = [100 0] . So, at least in this input direction the
T T
eigenvalue 0 does not describe the system well. The problem is that generally
eigenvalues describe the gain only in the direction of the eigenvector. Let (λ i , t i ) be
the eigenvalue-eigenvector pair related to the matrix G. For the eigenvector as input
y λ i ti
y = Gt i = λ i t i ⇒ = = λ i
ti ti
But let us calculate the singular values.
By the Matlab command svd(G) or by calculating directly sqrt(eig(G’*G)) the
singular values 100 and 0 are obtained. The gain of the system is between these
values, and the maximum gain (corresponding to the infinity norm of the transfer
function) is 100.
Note. The singular values are obtained as σ i (G ) = λi (G H G ) ; the eigenvalues here
H H
are always real, because G G is a hermitian matrix. Also G G is positive
semidefinite, so that the eigenvalues are nonnegative.