Documente Academic
Documente Profesional
Documente Cultură
Solved Exercises
2. Design a state feedback controller with an integral part and closed loop poles
p1,2 = −1 ± i, p3 = −10 using MATLAB.
3. Plot the step response of the output y and the error e using MATLAB or
Simulink.
2 Two-Mass-Swinger
Given is the system below, with the force u as input signal, and the two positions
y1 and y2 as output signals.
Assume that m1 = 1kg, m2 = 2kg, k = 36N/m, b = 0.6N s/m. The equations for
the system are
3. Create the closed loop system with the state vector [x x̃]T and verify that
the eigenvalues of the system correspond to the two pole placement designs.
4. Plot the step response of the outputs y1 and y2 and verify the correct selection
of Kvf .
5. Compare the system responses for the condition when the two mass swinger
T
has a state vector x = [1 1 0 0]T and the observer x̃ = 0 0 0 0 respective
T
x̃ = −1 − 1 0 0 . Explain.
3 Four-Mass-Swinger
Given is the system below, with two forces as input, u = [u1 u2 ]T , and four posi-
tions as output: y = [y1 y2 y3 y4 ]T . The state variables are x1 = y1 , x2 = y2 ,
x3 = y3 , x4 = y4 , x5 = ẏ1 , x6 = ẏ2 , x7 = ẏ3 , x8 = ẏ4 . Assume that m = 1kg,
k = 36N/m, b = 0.6N s/m.
3. Compare the behaviour of the system without and with observer (LQR vs.
LQG-LTR). Compare the responses of initial values [-1 -1 -1 -1 0 0 0 0]
(Initial state of the observer!).
4. Design the state regulator and the observer using optimal control.
4 Train
Given is the system below, where the forces u1 and u2 are the inputs and d1 = y2 −y1 ,
d2 = y3 −y2 and d3 = y4 −y3 are the differences between the positions of the waggons.
Assume that m = 1kg, k = 36N/m, b = 0.6N s/m.
1. Find the state space description for this system with one output ẏ1 .
3. Compare the behaviour of the system without and with observer (LQR vs.
LQG-LTR).
4. Plot the step response of the output ẏ1 . Find a suitable prefilter Kvf .
5. Design the state regulator and the observer using optimal control.
Solutions
2.
0 1 0 0
ė e
= 0 0 1 + 0 w
ż z
0 −2 −2 1
| {z } | {z }
 B̂
K̂ = 20 20 10
K1 = 20
K2 = 20 10
ẋ = [A − BK2 ]x + Bu
y = Cx
Step Response
1.5
y
e
0.5
Amplitude
-0.5
-1
0 1 2 3 4 5 6 7
Time (seconds)
When you simulate the step response with Simulink you can refer to the block
diagram in the script. To verify your implementation use the MATLAB com-
mand linmod(’yourSimulinkFile’) to get a system description. Check the
eigenvalues of this system to make sure that they correspond to the pole place-
ment design.
2 Two-Mass-Swinger
1.
ẋ1 = x3
ẋ2 = x4
k k b b
ẋ3 = − x1 + x2 − x3 + x4 + u
m1 m1 m1 m1
k k b b
ẋ4 = x1 − x2 + x3 − x4
m2 m2 m2 m2
ẋ1 0 0 1 0 x1 0
ẋ2 0 0 0 1 x2 0
= k b + u
ẋ3 − m k
m
− m
b
m x 3 1
1 1 1 1
k
ẋ4 m2
− mk2 mb2 − mb2 x4 0
x1
y1 1 0 0 0
x2
=
y2 0 1 0 0 x3
x4
2. The design is straight forward. The only thing that needs special attention
is the design of the prefilter Kvf . Because we have two outputs but only one
input, we have to decide for which output we want the static gain to be 1.
We select the second output y2 (in this example the choice does not really
matter because both outputs have the same static gain). The static gain is
not influenced by the observer because at steady state the observer errors are
zero for all suitable H.
A = [0 0 1 0; 0 0 0 1; [ - k k -b b ]/ m1 ; [ k -k b -b ]/ m2 ] ;
B = [0; 0; 1; 0];
C = [1 0 0 0; 0 1 0 0];
K = 130.4444 −41.5556 23.1 15.4185
30.4 0.6
0.3 30.7
H=185.94 54.06
27.03 212.97
Kvf = 88.8889
3.
Listing 4: Create the closed loop system and check the eigenvalues
Ag = [A - B * K B * K ; zeros ( size ( A ) ) A - H * C ];
Bg = [ B ; zeros ( size ( B ) ) ];
Cg = [ C zeros ( size ( C ) ) ];
G = ss ( Ag , Bg , Cg , []) * Kvf ;
eig ( G )
4.
Listing 5: Step response of the closed loop system
step ( G ) ;
5.
Listing 6: Initial responses of the closed loop system
x0 = [1 1 0 0 0 0 0 0];
initial (G , x0 ) ;
hold on
x0 = [1 1 0 0 -1 -1 0 0] ;
initial (G , x0 ) ;
hold off
legend ( ’ Observer state [0 0 0 0] ’ , ’ Observer state [ -1 -1 0 0] ’
)
Refer to figure 3 for the initial responses. Because the controller uses inaccurate
state estimations during the transients of the observer, the performance of the
controller is initially reduced.
Step Response
1.5
1
To: Out(1)
0.5
Amplitude
1.5
1
To: Out(2)
0.5
0
0 0.5 1 1.5 2 2.5 3 3.5
Time (seconds)
1.5
1
To: Out(1)
0.5
0
Amplitude
-0.5
1.5
Observer state [0 0 0 0]
Observer state [-1 -1 0 0]
1
To: Out(2)
0.5
-0.5
0 0.5 1 1.5 2 2.5 3 3.5 4
Time (seconds)
3 Four-Mass-Swinger
-0.2
-0.4
-0.6
-0.8
-1
0 0.5 1 1.5 2 2.5 3 3.5 4
Time (sec)
-0.2
-0.4
-0.6
-0.8
-1
0 0.5 1 1.5 2 2.5 3 3.5 4
Time (sec)
4 Train
0.02
-0.02
-0.04
-0.06
-0.08
0 0.5 1 1.5 2 2.5 3 3.5 4
Time (sec)
Step Response
(state regulator)
1.4
1.2
1
Amplitude
0.8
Velocity
0.6
0.4
0.2
0
0 0.5 1 1.5 2 2.5 3
Time (sec)
0.02
-0.02
-0.04
-0.06
-0.08
-0.1
-0.12
0 0.5 1 1.5 2 2.5 3 3.5 4
Time (sec)
Step Response
1.2
1
Amplitude
0.8
Velocity
0.6
0.4
0.2
0
0 0.5 1 1.5 2 2.5 3
Time (sec)