Lecture 1: Introduction to Dynamical Systems
• General introduction
• Modeling by differential equations (inputs, states, outputs)
• Simulation of dynamical systems
• Equilibria and linearization
• System interconnections and block diagrams Related Reading
Dynamical Systems
2/45 In a dynamical system the effects of action do not occur immediately.
This phenomenon can be observed in all systems surrounding us:
• Mechatronic systems
Pushing gas pedal in car does only gradually increase the velocity
• Heating systems
Temperature does not rise immediately when a heater is switched on
• Biological systems
A headache disappears slowly when medicine is taken
• Business systems: An investment leads to future gains or losses Variables in a dynamical systems evolve in time. The time evolution depends on theexternal excitation, which itself changes over time.
Mathematical Models
One way to analyze the behavior of a dynamical system is by means of a mathematical model. Such models are often described by (ordinary or partial) differential equations.
Example: Mass-Spring-Damper System
Newton’s second law leads to
mq¨+c( ˙q) +kq= 0.
• q denotes the position of the mass (in a chosen coordinate system) and varies with time. q˙ and q¨are the velocity and the acceleration.
• kq is the spring restoring force (assumed to satisfy Hooke’s law) and
Inputs
4/45 The previous system is said to beautonomoussince it is not exposed to external influences. Non-autonomous systems do have external inputs. Example: Mass-Spring-Damper System
With an external force u(.) acting on the mass, we obtain
mq¨+c( ˙q) +kq=u(t).
The external force u(.) typically varies with time. Depending on the circumstances it can be interpreted as follows:
• If we are allowed to manipulateu(.)then it is called acontrol input.
• If u(.) is generated by nature and cannot be influenced/changed by us then it is called a disturbance input.
Outputs
Often not all variables that appear in a model are of interest. We choose outputs in order to describe those quantities that get focus.
Example: Mass-Spring-Damper System
If we are only interested in the po-sition of the mass, the output y is
mq¨+c( ˙q) +kq=u, y=q.
For some control input y(.) and along a system trajectory, the output
y(.) will be a function of time. Interpretations of outputs:
• y is a variable that can be measured (through sensors).
• y indicate a variable which we would like to monitor in order to investigate/analyze the properties of the system (in simulation).
Interpretation of the Model
6/45 Letu(t) be aninput signal defined for t≥0and let an initial position
q0as well as an initial velocityv0 be given. Solve the differential equation mq¨(t) +c( ˙q(t)) +kq(t) =u(t) with q(0) =q0, q˙(0) = v0.
If u(.) is continuous and c(·) is C1, we know that this initial value problem has a uniquesolutionq(t)andq˙(t)that is defined fort∈[0, t1)
with some t1 >0.
Warning and Reminder: Solutions might not exist for all t≥0. Since the values forq(0) andq˙(0)specify the solution of the differential equation (for a fixed input) uniquely, we call
x= x1 x2 = q ˙ q and x(t) = x1(t) x2(t) = q(t) ˙ q(t) thestate-vectorandstate-responseof the system. The system’s out-put (response) is then just given by y(t) = q(t).
Demo: Free and Driven Response
0 10 20 30 40 −1 −0.5 0 0.5 1 u(t) 0 10 20 30 40 −4 −2 0 2 4 6q(t) (full) and v(t) (dotted)
−5 0 5 −2 −1 0 1 2 Graph of function c(.) −5 0 5 −4 −2 0 2 4
Demo: Effect of Nonlinearity
8/45 0 50 100 150 200 −2 −1 0 1 2 u 0 50 100 150 200 −20 −10 0 10 20q (blue) and v (green)
−5 0 5 −2 −1 0 1 2 Graph of function c(.) −20 −10 0 10 20 −20 −10 0 10 20
Demo: Finite Escape Time
0 5 10 15 −1 −0.5 0 0.5 1 u(t) 0 5 10 15 −5 0 5 10 15q(t) (full) and v(t) (dotted)
−5 0 5 −25 −20 −15 −10 −5 0 Graph of function c(.) −5 0 5 10 15 −5 0 5 10
Demo: Stability and Instability
10/45 0 5 10 −1 −0.5 0 0.5 1 u(t) 0 5 10 −10 −5 0 5 10q(t) (full) and v(t) (dotted)
−5 0 5 −2 −1 0 1 2 Graph of function c(.) −10 −5 0 5 10 −10 −5 0 5
Demo: Stable Limit Cycle
0 5 10 15 20 −1 −0.5 0 0.5 1 u(t) 0 5 10 15 20 −10 −5 0 5 10q(t) (full) and v(t) (dotted)
−5 0 5 −10 −5 0 5 10 Graph of function c(.) −10 −5 0 5 10 −10 −5 0 5 10
Interpretation of the Model
12/45 If we write down a system like
mq¨+c( ˙q) +kq=u, y=q,
we are actually interested in its behavior, the set of all input-, state-and output-signalsu(.), (q(.),q˙(.)) and y(.) that satisfy these laws.
• Signals are vector-valued functions of time, also called trajectories. Tacitly assumed to be piece-wise continuous.
• The laws to-be-satisfied are often described by differential equations. Impose hypothesis that guarantee existence/uniqueness of i.v.p.
• Different system descriptions (laws) can lead to the same behavior. We then call the system (descriptions) equivalent.
In the so-called behavioral approach to dynamical systems all this is developed in a mathematically precise fashion.
Sample Questions in Control
For a system likemq¨+c( ˙q) +kq =u, y =q
we are e.g. interested in the following issues:
• If there is no external excitation how does the state/output behave?
• Can we steer the system from one position to another?
• Is it possible to determine the input from knowledge of the output?
• Can we modify the system in order to create a desired behavior? Some of these (yet rough) questions are related toanalyzingthe system for its properties, while others involve synthesizing control inputs or modify the system laws in order to change the system’s behavior.
From Second-Order to First-Order Models
14/45 The system description
mq¨+c( ˙q) +kq=u
involves the first and second derivative of q. If m 6= 0 it is called a second order differential equation.
If we introduce the state-variables x1 =q and x2 = ˙q we conclude
˙ x1 = ˙q=x2, ˙ x2 = ¨q=− k mq− c( ˙q) m + 1 mu=− k mx1− 1 mc(x2) + 1 mu.
This can be written more compactly as ˙ x1 ˙ x2 = x2 −k mx1− 1 mc(x2) + 1 mu =f(x1, x2, u).
From High-Order to First-Order Models
Supposeris a general real-valued nonlinear function ofn+1arguments. Lemma 1 The system
q(n)+r(q(n−1), q(n−2), . . . ,q, q, u˙ ) = 0 is equivalent to ˙ x= ˙ x1 ˙ x2 .. . ˙ xn−1 ˙ xn = x2 x3 .. . xn −r(xn, xn−1, . . . , x2, x1, u) =:f(x, u). Proof. Introduce x1 = q, x2 = ˙q, . . . , xn−1 = q(n−2), xn = q(n−1), substitute the variables and write down the resulting vector equation.
Non-Uniqueness
16/45 It is important to note that there is no unique way to do this. Under-standing this issue will be an essential topic later.
Lemma 2 The system
q(n)+r(q(n−1), q(n−2), . . . ,q, q, u˙ ) = 0 is equivalent to ˙ z = ˙ z1 ˙ z2 .. . ˙ zn−1 ˙ zn = −r(z1, z2, . . . , zn−1, zn, u) z1 z2 .. . zn−1 = ˆf(z, u).
Proof. Introduce z1 = q(n−1), z2 =q(n−2), . . . , zn−1 = ˙q, zn =q and proceed as before.
Generic System Description in Control
Physical modeling often leads to a system of higher-order differential equations. As seen above, these can typically (though not always!) be equivalently written as a first-order vector differential equation
˙
x=f(x, u) and y =h(x, u).
with maps f :X×U →Rn andh:X×U →
Rk(X ⊂Rn,U ⊂Rm).
This compact system description forms the starting point of control. More explicitly these equations read as
˙ x1 = f1(x1, . . . , xn, u1, . . . , um) .. . ˙ xn = fn(x1, . . . , xn, u1, . . . , um) y1 = h1(x1, . . . , xn, u1, . . . , um) .. . yk = hk(x1, . . . , xn, u1, . . . , um) Note that these functions could as well depend explicitly on time!
System Response and Differential Equations
18/45 For f :X×U →Rn, h:X ×U →Rk with open X ⊂ Rn, U ⊂ Rm
consider
˙
x=f(x, u) and y =h(x, u).
Ifu(.) :I →Uis an input function on an open intervalI ⊂Rcontaining 0 and if ξ ∈ Rn is an initial condition for the state, then the state-response x(.) is obtained by solving the initial value problem
˙
x=f(x, u(t)) with initial condition x(0) =ξ.
The output response is just defined by y(t) :=h(x(t), u(t)) fort ∈I.
• Existence and uniqueness of the state-response on some open sub-interval ofI is guaranteed iff is continuous and Lipschitz continuous in x and ifu(.) is continuous.
Recap: Global Existence and Uniqueness Theorem
Consider the initial value problem (ivp)˙
x=g(t, x), x(τ) = ξ
forg :D→Rn with D⊂R×Rn.
Assumptions. Suppose D ⊂ R×Rn is open and g : D →
Rn,
(t, x)→g(t, x) is continuous and Lipschitz-continuous in x:
For each (τ, ξ) ∈ D there exists a neighborhood U ⊂ D of (τ, ξ) and some L >0 with
kg(t, x)−g(t, y)k ≤Lkx−yk for all (t, x),(t, y)∈U.
• Is satisfied if bothg and ∂xg are continuous onD.
• It suffices that g ∈C1(D, Rn).
Recap: Global Existence and Uniqueness Theorem
20/45 Theorem 3 Under the above assumptions and for every(τ, ξ)∈D
there exists a maximal interval of existence I(τ,ξ) = (t−, t+)3τ and
a unique C1-solution x(., τ, ξ) :I
(τ,ξ) →Rn of the ivp
˙
x=g(t, x), x(τ) = ξ. (1)
Maximality ofI(τ,ξ)means: If the initial value problem has aC1-solution xJ : J → Rn on the interval J 3 τ, then J ⊂ I(τ,ξ) and xJ is the restriction of x ontoJ.
Moreover, for t+ <∞ exactly one of the following properties holds:
• The solution “escapes”: limt→t+, t<t+kx(t)k=∞.
• There solution “approaches the boundary ofD”: For all sequences
tν ∈ (t−, t+) with tν → t+ and limν→∞x(tν) = x+, the point
Generic Description of Linear Systems
If f and h arelinear they can be represented asf(x, u) = Ax+Bu and h(x, u) =Cx+Du
with matrices A∈Rn×n, B ∈Rn×m,C ∈Rk×n, D∈Rk×m. Hence a generic linear (time-invariant) system is described as
˙
x=Ax+Bu and y =Cx+Du.
This is the system description mostly considered in this course.
The behavior of many dynamical systems in engineering can often be (approximately) modeled by linear systems. On the other hand, physical modeling often results in descriptions with nonlinear dynamics.
Simulation
22/45 A system description in terms of the differential and output equation
˙
x(t) =f(x(t), u(t)), x(0) =ξ, y(t) = h(x(t), u(t))
allows the numerical computation of the response (to an input and an initial condition) by ode-solvers (such as ode45 or ode15s in Matlab). By integrating over time, the description is equivalent to
x(t) = ξ+ Z t
0
f(x(τ), u(τ))dτ, y(t) =h(x(t), u(t)).
This leads to the general diagram for a Simulink simulation:
Signal Generator Scope f(x,u) Right-hand side of differential equation h(x,u) Output function 1 s Integrator with initial condition x0 u x
Example: Segway (Cart-Pendulum)
Modeling with the Lagrange technique ([F] p.30-31) leads to (M+m)¨p−mlcos(θ)¨θ+cp˙+mlsin(θ) ˙θ2 = F
−mlcos(θ)¨p+ml2θ¨+γθ˙−mglsin(θ) = 0
where, next to the parameters defined in the figure, c and γ are the coefficients describing the viscous friction of the cart and the pendulum.
Example: First-Order System Description
24/45 More insightful and compact description:
(M+m) −mlcos(θ) −mlcos(θ) ml2 ¨ p ¨ θ + cp˙+mlsin(θ) ˙θ2 γθ˙−mglsin(θ) = F 0 .
Introduce the abbreviations
U(θ) = (M +m) −mlcos(θ) −mlcos(θ) ml2 , v(θ,p,˙ θ˙) = cp˙+mlsin(θ) ˙θ2 γθ˙−mglsin(θ) .
Then the system can be described as
U(θ) ¨ p ¨ θ +v(θ,p,˙ θ˙) = F 0 .
Since the matrix U(θ) is always invertible (why?) this is the same as ¨ p ¨ θ =−U(θ)−1v(θ,p,˙ θ˙) +U(θ)−1 F 0 = w1(p, θ,p,˙ θ, F˙ ) w2(p, θ,p,˙ θ, F˙ ) with yet another abbreviation of the right-hand side.
Example: First-Order System Description
Finally introduce the states and the inputx1 x2 = p θ , x3 x4 = ˙ p ˙ θ and u=F.
The system is then described as ˙ x1 ˙ x2 ˙ x3 ˙ x4 = x3 x4 w1(x1, x2, x3, x4, u) w2(x1, x2, x3, x4, u) = f1(x1, x2, x3, x4, u) f2(x1, x2, x3, x4, u) f3(x1, x2, x3, x4, u) f4(x1, x2, x3, x4, u) .
The given representation of f(x, u) can be coded exactly as described. This is much less error-prone than explicit computations as e.g. given in [AM] p.37, in particular for more complicated situations.
However, let us stress again we just obtained another representation of the very same system as defined by the equations on slide 23.
Equilibria
26/45 Definition 4 All pairs of vectors (xe, ue)∈X×U which satisfy
0 =f(xe, ue)
are called equilibria of the system x˙ =f(x, u).
If the system is driven with the constant control input u(t) = ue and if the state is initialized asxe(0) =xe, then the state-response is given by
x(t) = xe and thus x˙e(t) = 0 for all t≥t0.
If starting at an equilibrium the state-trajectory stays there. Equilibria are in general not unique. Not even for linear systems. Often (but by no means always!) our interest is in trajectories that “do not deviate too much” from equilibria.
Example: Segway
27/45 The equilibria of the system on slide 23 are determined by
0 =F and mglsin(θ) = 0.
Solutions are θe = 0 (upright position) and θe = π (downright position), while pe is arbitrary.
Four simulations, including perturbation of initial condition (dash-dotted):
0 1 2 3 4 5 −1 0 1 p 0 1 2 3 4 5 0 5 θ
A controller should keep the Segway in the upright position which while the car follows a given position trajectory. Hence the system trajectory
Linearization
28/45 Iff andhareC1, their first-order Taylor expansions around(xe, ue)are
f(x, u) ≈ f(xe, ue) +∂xf(xe, ue) | {z } A (x−xe) +∂uf(xe, ue) | {z } B (u−ue) h(x, u) ≈ h(xe, ue) | {z } ye +∂xh(xe, ue) | {z } C (x−xe) +∂uh(xe, ue) | {z } D (u−ue). The approximation is good if x≈xe and u≈ue.
Definition 5 Suppose that f(xe, ue) = 0. If f and h are C1, the linearization of x˙ =f(x, u), y=h(x, u) at (xe, ue)is
˙
x∆=Ax∆+Bu∆, y∆=Cx∆+Du∆.
Letu(t)≈ue and x(0) ≈xe lead to the nonlinear response y(t)≈ye. If one drives the linearization withu∆(t) :=u(t)−ue and for the initial value x∆(0) :=x(0)−xe, we hopethaty∆(t) +ye approximatesy(t).
Example: Segway
Nonlinear (blue) versus linearized (green) simulation at(pe, θe) = (0, π):
0 2 4 6 8 10 0 0.5 1 F 0 2 4 6 8 10 0 0.5 1 p 0 2 4 6 8 10 3 3.2 3.4 θ Good match.
Example: Segway
30/45 Nonlinear (blue) versus linearized (green) simulation at(pe, θe) = (0,0):
0 0.5 1 1.5 0 0.5 1 F 0 0.5 1 1.5 0 2 4 p 0 0.5 1 1.5 0 10 20 θ
System Interconnections and Modularity
One of the most important concepts in modeling dynamical systems is modularity. Complex models are built by interconnecting simple system components in a hierarchical manner.
Dynamical systems are interconnectedby equating signals.
• Allows to use software libraries with standard system components and interfaces between different physical domains.
• Many concrete modeling packages are available (Matlab, Modelica).
• Even for complex models, the hierarchical (nested) structure renders bookkeeping manageable.
• Individual components can be adapted while preserving the overall interconnection structure.
Example: Mass-Spring-Damper System
32/45 The simple mass-spring-damper systemmq¨+c( ˙q)+kq =udoes actually result from Newton’s laws as follows:
F = ˙p with p=mv.
The total force acting on the mass (assumed to be constant) is
F =F1+F2+F3
with the externally exerted force
F1 =u,
the friction force (assumed to depend on velocity)
F2 =c(v),
and the spring restoring force (assumed to depend linearly on elongation)
Example: Pendulum on Cart
Suppose the cart force is generated by an electric DC motor attached to a one wheel of radius r.
If the voltageV is applied to the motor, the winding currentI generates a torque; with the load torque T the motor dynamics is described by
Jφ¨+bφ˙ =kmI−T, LI˙+RI =V −keφ˙ with positive constants J, b, km, L, R, ke.
The load torque and the motor shaft-angle are assumed to be related toF and p by
T =F r and p=rφ. 0 p
φ r
Example: Pendulum on Cart
34/45 We obtain the following description of the interconnection:
LI˙+RI +ke r p˙ = V (M +m+ J r2)¨p−mlcos(θ)¨θ+ (c+ b r2) ˙p+mlsin(θ) ˙θ 2 − km r I = 0 −mlcos(θ)¨p+ml2θ¨+γθ˙−mglsin(θ) = 0.
Note that the coupling is often called two-sided, since the dynamics of the interconnected systems influence each other. If ke = 0 then the coupling is one-sided.
It is not straightforward to predict the impact of the motor dynamics onto the overall dynamic response of the model.
Let us hence only analyze, by simulation, the influence of “large” and “small” values of L.
Example: Pendulum on Cart
Small L leads to fast motor dynamics:0 1 2 3 4 5 0 0.5 1 F 0 1 2 3 4 5 0 1 2 p 0 1 2 3 4 5 3 3.2 3.4 θ
Example: Pendulum on Cart
36/45 Larger L slows the motor dynamics down:
0 1 2 3 4 5 0 0.5 1 F 0 1 2 3 4 5 0 1 2 p 0 1 2 3 4 5 3 3.2 3.4 θ
Series Interconnection
Definition 6 The series interconnection of the systems ˙
x1 =f1(x1, u1), y1 =h1(x1, u1), x˙2 =f2(x2, u2), y2 =h2(x2, u2)
is obtained if the output of the first system enters the second system as an input: u2 =y1. (The vector dimensions must be equal.)
The series interconnection is then described by ˙ x1 ˙ x2 = f1(x1, u1) f2(x2, h1(x1, u1)) , y2 =h2(x2, h1(x1, u1)). Linear systems: ˙ x1 = A1x1 +B1u1, y1 = C1x1+D1u1 ˙ x2 = A2x2+B2u2, y2 = C2x2+D2u2 η= x1 x2 ˙ η = A1 0 B2C1 A2 η+ B1 B2D1 u1, y2 = D2C1 C2 η+D2D1u1
Parallel Interconnection
38/45 Definition 7 The parallel interconnectionof the systems
˙
x1 =f1(x1, u1), y1 =h1(x1, u1), x˙2 =f2(x2, u2), y2 =h2(x2, u2)
is obtained by having them enter a common input and summing the outputs: u1 =u2 =u and y=y1+y2. (Dimensions must fit.)
The parallel interconnectionis then described by ˙ x1 ˙ x2 = f1(x1, u) f2(x2, u) , y =h1(x1, u) +h2(x2, u). Linear systems: ˙ x1 = A1x1 +B1u1, y1 = C1x1+D1u1 ˙ x2 = A2x2+B2u2, y2 = C2x2+D2u2 η= x1 x2 ˙ η= A1 0 0 A2 η+ B1 B2 u, y= C1 C2 η+ (D1+D2)u
Matlab’s Control System Toolbox
Matlab’s Control System Toolbox has so-called ss objects which are used to work with linear state-space systems as follows:
• System definition:sys1=ss(A1,B1,C1,D1), sys2=ss(A2,B2,C2,D2)
• Series interconnection:ser=sys1*sys2
• Parallel interconnection:par=sys1+sys2
• Simulation: y=lsim(sys,u,T,x0)
• Extraction of defining matrices: [A,B,C,D]=ssdata(sys)
Note that the (overloaded) operations for the series and parallel inter-connections remind us about the way how matrices act as mappings. Internally these operations are based on the above derived formulas. You should be actively exploring the possibilities of the toolbox.
Block-Diagrams
40/45 Like in Simulink,block-diagramsas generally used for the visualization of systems interconnections in control.
Generically an individual block is indicated as
Operation to be performed on input
Input Output
Static blocks are maps from R into R or from Rp into
Rq. Dynamic
Block-Diagrams
Dynamic blocks described by differential equations require the specifi-cation of an initial conditionsuch that the output is uniquely defined by the input. Such an initial condition can be viewed as an extra input. That’s why, for an integrator, one sometimes uses the notation
Z
x0
y u
or, for a general system, the block description
˙ x = f(x, u) y = h(x, u) x0 y u
Block-Diagrams
42/45 A block-diagram is obtained by interconnecting individual blocks (by equating signals). Hence such diagrams (should) always correspond in a precise fashion to algebraic equations.
Generic examples Series interconnection: ˙ x1 = f(x1, u1) y1 = h(x1, u1) u1 x˙ y2 2 = f(x2, u2) y2 = h(x2, u2) Parallel interconnection: ˙ x1 = f(x1, u) y1 = h(x1, u) y ˙ x2 = f(x2, u) y2 = h(x2, u) + u
Example: Mass-Spring-Damper System
Differential equation and output equation:¨ q= 1 mu− 1 mc( ˙q)− k mq, y=q
Start from chain of integrators
˙ q(0) ˙ q ¨ q q(0) q Z Z
and obtain block-diagram with equations of motion:
˙ q(0) ˙ q ¨ q q(0) q 1 mc(.) k m Z Z + 1 m + − u y
Example: State-Space System
44/45 The standard linear state-space system can be depicted as
B - - R - C A D -j 6 - j 6 - -? u(t) x0 x(t) y(t)
However, there is no need for such an explicit implementation in e.g. Simulink, since one can just use either a State-Space block (defined byA, B, C, D) or an LTI Systems block (defined by an ss-object).
Covered in Lecture 1
• Models of dynamical systems
differential equations, inputs, outputs, state, reduction to first order, linear systems, compact notation, Simulink simulation
• Linearization
• System interconnections
modularity in modeling, interconnection=equating signals feedback equations, relation to block diagrams
• Aspects of qualitative analysis of dynamic responses
nonzero initial condition, external input signal, equilibria, stability, limit cycles, finite escape time