You are on page 1of 5

Lecture 2 Today’s Goal

• Linearization
To be able to
• Stability definitions
◮ linearize, both around equilibria and trajectories,
• Simulation in Matlab/Simulink ◮ explain definitions of local and global stability,
◮ check local stability and local controllability at equilibria
◮ simulate in Simulink,
Material
◮ Glad& Ljung Ch. 11, 12.1,
( Khalil Ch 2.3, part of 4.1, and 4.3 )
(Slotine and Li, pp 40-57)
◮ Lecture slides

Example - Linearization around equilibrium point Linearization Around a Trajectory

Idea: Make Taylor-expansion around a known solution { x0 (t), u0 (t)}


Neglect small terms (i.e., keep the linear terms, as these will locally
dominate over the higher order terms).
The linearization of
Let dx0 /dt = f ( x0 (t), u0 (t)) be a known solution. How will a small
ˆ deviation { x̃, ũ} from this solution behave?
ẍ(t) = f ( x(t)) = sin x(t)
l
around the equilibrium x0 = nπ is given by
d( x0 + x̃)
= f ( x0 (t) + x̃(t), u0 (t) + ũ(t))
′ ˆ dt
x̃¨ (t) = f ( x0 ) x̃(t) = (−1)n x̃(t)
l

( x0 (t), u0 (t))
x̃(t)
( x0 (t) + x̃(t), u0 (t) + ũ(t))

Linearization Around a Trajectory, cont.


2 minute exercise: Linearize
Let ( x0 (t), u0 (t)) denote a solution to ẋ = f ( x, u) and consider
2 3
ẋ = 4x + u another solution ( x(t), u(t)) = ( x0 (t) + x̃(t), u0 (t) + ũ(t)):

around the solution ẋ(t) = f ( x0 (t) + x̃(t), u0 (t) + ũ(t))


€f
1 = f ( x0 (t), u0 (t)) + ( x0 (t), u0 (t)) x̃(t)
x0 (t) = u0 (t) = 0 €x
t2 €f
+ ( x0 (t), u0 (t))ũ(t) + O (q x̃, ũq2 )
€u

Hint:
( x0 (t), u0 (t))
Plug-in x(t) = t−2 + x̃(t), expand the expressions,
and finally remove higher order terms (≥ 2) of x̃. x̃(t)

( x0 (t) + x̃(t), u0 (t) + ũ(t))

State-space form Linearization, cont’d


The linearization of the output equation
Hence, for small ( x̃, ũ), approximately
y(t) = h( x(t), u(t))
x̃˙ (t) = A( x0 (t), u0 (t)) x̃(t) + B ( x0 (t), u0 (t))ũ(t)
around the nominal output y0 (t) = h( x0 (t), u0 (t)) is given by
where (if dim x = 2, dim u = 1)
"
€ f1 € f1
# ( y(t) − y0 (t)) = C(t)( x(t) − x0 (t)) + D (t)(u(t) − u0 (t))
€f € x1 € x2

A( x0 (t), u0 (t)) = ( x0 (t), u0 (t)) =

€ f2 € f2
€x

€ x1 € x2
( x0 (t),u0 (t)) where (if dim y = dim x = 2, dim u = 1)
" #
€ f1
€f €u1

B ( x0 (t), u0 (t)) = ( x0 (t), u0 (t)) =

€ f2
€u

( x0 (t),u0 (t)) "
€ h1 € h1
#
€u1
€h € x1 € x2

C(t) = =

€ h2 € h2
€ x ( x0 ,u0 )

€ x1 € x2 ( x0 (t),u0 (t))

Note that A and B are time dependent! However, if we don’t


" #
€ h1
€h €u1

D (t) = =

linearize around a trajectory but linearize around an equilibrium €u ( x0 ,u0 )
€ h2
( x0 (t),u0 (t))
€u1
point ( x0 (t), u0 (t)) " ( x0 , u0 ) then A and B are constant.

1
Example: Rocket

ḣ(t) = v(t)
v u(t)
m(t) v̇(t) = −ˆ + me (t)
ṁ(t) = −u(t)
h(t)
Part II: Stability definitions

h0 (t)
Let u0 (t) " u0 > 0; x0 (t) =  v0 (t) ; m0 (t) = m0 − u0 t.
m0 (t)

0 1 0
   
0
−ve u0 ve
Linearization: ˙x̃(t) =  0 0 m0 (t)2
 x̃(t) +  m0 (t)
 ũ(t)
0 0 0 −1

Definition: A norm function pp xpp : x ∈ R n → R satisfies the Local Stability


following three properties:
Consider ẋ = f ( x) where f (0) = 0
◮ pp xpp = 0 if and only if (iff) x = 0, pp xpp > 0 otherwise.
◮ ppaxpp = app xpp, for any positive a and any signal vector x. Definition The equilibrium x = 0 is stable if, for any R > 0,
◮ (The triangle inequality) pp x + ypp ≤ pp xpp + pp ypp there exists r > 0, such that

y x y q x(0)q < r =[ q x(t)q < R, for all t ≥ 0


x
Otherwise the equilibrium point is unstable.
x+y
x+y

x(t)
Definition: (Euclidean norm)   r
x1
pp xpp x =  x2  R
x3
q xq = ( x12 + x22 + . . . + xn2 )1/2 x2
x3

x1

Asymptotic Stability Global Asymptotic Stability

Definition The equilibrium x = 0 is locally asymptotically


stable (LAS) if it Definition The equilibrium is said to be globally
1) is stable asymptotically stable (GAS) if it is LAS and for all x(0) one
has
2) there exists r > 0 so that if q x(0)q < r then
x(t) → 0 as t → ∞.
x(t) −→ 0 as t −→ ∞.

(PhD-exercise: Show that 1) does not follow from 2))

Lyapunov’s Linearization Method


Theorem Assume
ẋ = f ( x)
has the linearization
d
( x(t) − x0 ) = A( x(t) − x0 )
dt
Part III: Check local stability and controllability
around the equilibrium point x0 and put

α ( A) = max Re(λ ( A))

◮ If α ( A) < 0, then ẋ = f ( x) is LAS at x0 ,


◮ If α ( A) > 0, then ẋ = f ( x) is unstable at x0 ,
◮ If α ( A) = 0, then no conclusion can be drawn.

(Proof in Lecture 4)

2
Example Local Controllability

Theorem Assume
The linearization of ẋ = f ( x, u)
ẋ1 = − x12 + x1 + sin( x2 ) has the linearization
ẋ2 = cos( x2 ) − x13 − 5x2 d
( x(t) − x0 ) = A( x(t) − x0 ) + B (u(t) − u0 )
    dt
1
at x0 = 
   −1 1 
 gives A = 
 
0 −3 −5 around the equilibrium ( x0 , u0 ) then

Eigenvalues are given by the characteristic equation ◮ ( A, B ) controllable [ f ( x, u) nonlinear locally controllable
0 = det(λ I − A) = (λ + 1)(λ + 5) + 3
Here nonlinear locally controllable is defined as:
This gives λ = {−2, −4}, which are both in the left half-plane,
hence the nonlinear system is LAS around x0 . For every T > 0 and ε > 0 the set of states x(T ) that can be
reached from x(0) = x0 , by using controls satisfying
qu(t) − u0 q < ε , contains a small ball around x0 .

5 minute exercise:

Is the ball and beam


7 2r
ẍ = xφ˙2 + ˆ sin φ + φ¨
5 5
nonlinearly locally controllable around
φ˙ = φ = x = ẋ = 0 (with φ¨ as input)?

Remark: This is a bit bit more detailed model of the ball and beam than we
saw in Lecture 1.

However... Example
An inverted pendulum with vertically moving pivot point

phi

1
Bosch 2008 (Automatic parking assistance) φ¨(t) =(ˆ + u(t)) sin(φ (t)),
l
◮ Multiple turns where u(t) is acceleration, can be written as
◮ parking lot > car length + 80 cm
ẋ1 = x2
1
More parking in lecture 12 ẋ2 = (ˆ + u) sin( x1 )
l

Example, cont. Bonus — Discrete Time

The linearization around x1 = x2 = 0, u = 0 is given by


Many results are parallel (observability, controllability,...)
ẋ1 = x2
ˆ
ẋ2 = x1
l
Example: The difference equation
It is not controllable, hence no conclusion can be drawn about
nonlinear controllability x k+1 = f ( x k )
However, simulations show that the system is stabilized by
is asymptotically stable at x∗ if the linearization
2
u(t) = εω sin(ω t) € f
has all eigenvalues in pλ p < 1
€ x x∗
if ω is large enough !
(that is, within the unit circle).
Demonstration We will come back to this example later.

3
Part IV: Simulation
Example (cont’d): Numerical iteration
Often the only method
x k+1 = f ( x k )
ẋ = f ( x)
to find fixed point ◮ ACSL
x∗ = f ( x∗ ) ◮ Simnon
◮ Simulink

F ( ẋ, x) = 0
When does the iteration converge? ◮ Omsim
http://www.control.lth.se/∼cace/omsim.html
f ( x) x x
x f ( x) x ? ◮ Dymola http://www.dynasim.se/
f ( x) ◮ Modelica
http://www.dynasim.se/Modelica/index.html
f ( x)
Special purpose
x0 x0 x0 x0 x0 ◮ Spice (electronics)
◮ EMTP (electromagnetic transients)
◮ Adams (mechanical systems)

Simulink Simulink, An Example

File -> New -> Model


Double click on Continuous
Transfer Fcn
Step (in Sources)
Scope (in Sinks)
Connect (mouse-left)
> matlab Simulation->Parameters
> > simulink

1
s+1
Step Transfer Fcn Scope

Choose Simulation Parameters Save Results to Workspace

t
Clock To Workspace1

1
y
s+1
Signal Transfer Fcn To Workspace
Generator

Check “Save format” of output blocks (“Array” instead of “Structure”)


> > plot(t,y)
(or use “Structure” which also contains the time information.)

Don’t forget “Apply”

How To Get Better Accuracy Points were correct, only the plot was bad

1
Modify Refine, Absolute and Relative Tolerances, Integration
method 0.8

Refine adds interpolation points: 0.6

0.4
Refine = 1 Refine = 10
1 1

0.8 0.8 0.2

0.6 0.6

0
0.4 0.4

0.2 0.2
−0.2
0 0

−0.2 −0.2 −0.4

−0.4 −0.4

−0.6
−0.6 −0.6

−0.8 −0.8
−0.8
−1 −1
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10

−1
0 1 2 3 4 5 6 7 8 9 10

4
Use Scripts to Document Simulations Submodels, Example: Water tanks
Equation for one water tank:
ḣ = (u − q)/ A
p √
If the block-diagram is saved to stepmodel.mdl, q = a 2ˆ h
the following Script-file simstepmodel.m simulates the system:
Corresponding Simulink model:
open_system(’stepmodel’)
set_param(’stepmodel’,’RelTol’,’1e-3’)
1
set_param(’stepmodel’,’AbsTol’,’1e-6’) 1
1/A
s
f(u) 1

Sum q
set_param(’stepmodel’,’Refine’,’1’) In Gain Integrator Fcn

tic 2
h
sim(’stepmodel’,6)
toc
Make a subsystem and connect two water tanks in series.
subplot(2,1,1),plot(t,y),title(’y’)
subplot(2,1,2),plot(t,u),title(’u’) q
q In
1 In
h 1
h Out
In Subsystem2
Subsystem

Linearization in Simulink Linearization in Simulink, cont.

Use the command trim to find e.g., stationary points to a


system > > A=2.7e-3;a=7e-6,g=9.8;
Use the command linmod to find a linear approximation of the
> > % Example to find input u for desired states/output system around an operating point:
> > [x0,u0,y0]=trim(’flow’,[0.1 0.1]’,[],0.1)
x0 = > > [aa,bb,cc,dd]=linmod(’flow’,x0,u0);
0.1000 > > sys=ss(aa,bb,cc,dd);
0.1000
> > bode(sys)
u0 =
8.3996e-06
y0 =
0.1000

Linearization in Simulink; Alternative Computer exercise


By right-clicking on a signal connector in a Simulink model you Simulation of JAS 39 Gripen
can add “Linearization points” (inputs and/or outputs).
1
Kf x’ = Ax+Bu
T_f.s+1 Ctheta theta
reference y = Cx+Du
pitch angle
prefilter
pilot 1 plane
dynamics

command
1/A 1 a*sqrt(2*g*u[1]) 1
1 s upilot L x
In1 Output Point q
Input Point Integrator states
Gain Fcn

2
h t
Clock time

Start a “Control and Estimation Tool Manager” to get a linearized ◮ Simulation


model by
Tools -> Control Design ->Linear analysis ...
◮ Analysis of PIO using describing functions
◮ Improve design
where you can set the operating points, export linearized model to
Workspace (Model-> Export to Workspace) and much more.

Today

◮ Linearization, both around equilibria and trajectories,


◮ Definitions of local and global stability,
◮ How to check local stability and local controllability at
equilibria
◮ Simulation tool: Simulink,

Next Lecture
◮ Phase plane analysis
◮ Classification of equilibria

You might also like