Linear Dynamical Systems 2022 LinDynSys
Linear Dynamical Systems 2022 LinDynSys
Systems
Linear Dynamical Systems
Chapter 9 in Introduction to Applied Linear Algebra by Boyd and
Vandenberghe. Cambridge University Press 2018
𝑇!̇ = 𝑢 + 𝑎 𝑇" − 𝑇!
𝑇̇# = 𝑏 𝑇" − 𝑇# + 𝑐 15 − 𝑇#
Continuous vs. Discrete
• A continuous-time system involves variables that are defined for all time,
whereas a discrete-time system variables, defined only at discrete time points.
• Continuous-time systems consist of variables in the “analog” domain; e.g., 𝑥(𝑡).
• Discrete-time systems consist of variables in the “digital” domain; e.g., sampled
(measured) position 𝑥(𝑘𝑇3 ) that exists only at the discrete-time points 𝑡 = 𝑇3 ,
𝑡 = 2𝑇3 , …, 𝑡 = 𝑘𝑇3 , where 𝑇3 is the sampling interval.
• Continuous-time systems are described by ODEs
while discrete-time systems are described by
difference equations.
Time-variant vs. Time-invariant
• In a time-varying system, the system parameters change with time (e.g., the
friction coefficient changes with time).
• In a time-invariant system, the parameters remain constant.
• Same inputs and initial conditions produce same system response every time.
• Do not confuse the variation of the system parameters with the variation of
dynamic variables.
• For a DC motor, system parameters would be electrical resistance of the
circuit, inductance of the coil windings around the rotor, friction coefficient for
the rotor bearings, and moment of inertia of the rotor.
Linear vs. Nonlinear
• Linear systems obey the superposition property:
• If 𝑢# is an input and 𝑦# = 𝑓(𝑢# ) is the output then 𝛼𝑦# = 𝑓(𝛼𝑢# ), 𝛼 ∈ ℝ.
• If 𝑦# = 𝑓(𝑢# ) and 𝑦$ = 𝑓(𝑢$ ) then 𝑦# + 𝑦$ = 𝑓(𝑢# + 𝑢$ ).
• The behaviour of linear dynamical systems can be described by linear ODEs.
• Nonlinear systems do not obey these properties.
• All physical systems are nonlinear. However, if we confine the input/output
variables to a restricted (nominal) range then we can replace a nonlinear
system with a linear model. This important process is called linearization.
• Obtaining a linear model is extremely useful in system analysis because it is
possible to obtain an analytical (closed-form) solution to linear ODEs.
• Nonlinear systems must be solved by using numerically integrating the ODEs.
Try it!
• Problem 1:
• Show that 𝑦̇ = 𝑥(𝑡), 𝑥(𝑡) = 2𝑡, is time-invariant.
• Problem 2:
• Consider the system whose input-output relation is given by the linear
equation 𝑦 = 𝑎𝑥 + 𝑏, where 𝑥 and 𝑦 are the input and output of the system,
respectively, and 𝑎 and 𝑏 are constants. Is this system linear? Show!
Linear Dynamical
Systems
Linear Dynamical Systems
• In the following, we will consider discrete-time systems, for which 𝑥 ∈ ℝ4 is a
vector, called the state vector, 𝑛 ∈ ℕ, and 𝐴 ∈ ℝ4×4 a square matrix such that
𝑥! = 𝐴𝑥!"# .
• The index (subscript) denotes time and is written as 𝑡.
• Matrix 𝐴 is called the dynamics matrix; often, it does not depend on 𝑡, in which
case the linear dynamical system is called time-invariant.
• Sidenote: The state vector described the state of the system at a given time
point.
Simulation
• If we know the dynamics matrix, and the state at time 𝑡, we can find the future
state trajectory 𝑥!6# , 𝑥!6$ , … through iteration.
• This is called simulating the linear dynamical system.
• Simulation makes predictions about the future state of a system.
• To the extent that 𝑥! = 𝐴𝑥!"# is only an approximation or model of some real system, we must
be careful when interpreting the results.
• We can carry out what-if simulations, to see what would happen if the system
changes in some way, or if a particular set of inputs occurs.
Linear Dynamical System with Input
• There are many variations on and extensions of the basic linear dynamical
system model, one of which we will encounter later:
𝑥!6# = 𝐴𝑥! + 𝐵𝑢! + 𝑐.
• Here,
• 𝑢 is an 𝑚-vector called the input,
• 𝐵 is the 𝑛×𝑚 input matrix,
• and 𝑛-vector 𝑐 is called the offset.
• Input and offset are used to model other factors that affect the time evolution of
the state.
Example
Model of Epidemics
Epidemics: SIR-Model
• Consider vector 𝑥! of length 4 that gives proportions of population in 4 infection
states:
• Susceptible: can acquire the disease the next day
• Infected: have the disease
• Recovered: had the disease, recovered, and, now immune
• Deceased: had the disease, and, unfortunately, died
• E.g., 0.75
0.1
𝑥! =
0.1
0.05
Epidemics: SIR-Model Cont.
• Each day,
• among the susceptible population,
• 5% acquire the disease and 95% remain susceptible
• among the infected population,
• 1% dies, 10% recover with immunity, 4% recover without immunity (i.e., become susceptible
again), and 85% remain infected
• 100% of immune and dead people remain in their state
• The dynamics of the epidemic can be written as a 4 dimensional linear
dynamical system of the form 𝑥!6# = 𝐴𝑥! , where
0.95 0.04 0 0
0.05 0.85 0 0
𝐴= .
0 0.1 1 0
0 0.01 0 1
SIR-Model: Simulation
• Simulation from 𝑥& = 1, 0, 0, 0 7 .
Example
Motion of a Mass
A Continuous-Time Linear Dynamical System
• Linear dynamical systems can be used to (approximately) describe the motion
of many mechanical systems, for example, an airplane that is not undergoing
extreme maneuvers.
• A simple example is a single mass moving in 1-D (i.e., a straight line), with an
external force and a drag force (“air friction”) acting on it.
• The (scalar) position of the mass at time is given by 𝑝(𝜏). (Here, 𝜏 is
continuous, i.e., a real number.)
Differential Equation of Order 2
• The position satisfies Newton’s law of motion, the differential equation
𝑑$ 𝑝 𝜏 𝑑𝑝 𝜏
𝑚 $
= −𝜂 + 𝑓 𝜏 .
𝑑𝜏 𝑑𝜏
• Here, 𝑚 > 0 is the mass, 𝑓 𝜏 is the external force acting on the mass at time 𝜏,
and 𝜂 > 0 is the drag coefficient.
• The right-hand side is the total force acting on the mass; the first term is the
drag force, which is proportional to the velocity and in the opposite direction.
Coupled Differential Equations of Order 1
• Introducing the velocity of the mass, 𝑣 𝜏 = 𝑑𝑝 𝜏 ⁄𝑑𝜏, we can write the equation
above as two coupled differential equations,
𝑑𝑝 𝜏 𝑑𝑣 𝜏
=𝑣 𝜏 , 𝑚 = −𝜂𝑣(𝜏) + 𝑓 𝜏 .
𝑑𝜏 𝑑𝜏
st nd
• The 1 equation relates position and velocity; the 2 is from the law of motion.
• Next, to develop an (approximate) linear dynamical system model from the
differential equations above, we first discretise time.
Discretisation
• We let ℎ > 0 be a time interval (called the ‘sampling interval’) that is small
enough that the velocity and forces do not change very much over ℎ seconds.
• We define 𝑝% = 𝑝 𝑘ℎ , 𝑣% = 𝑣 𝑘ℎ , and 𝑓% = 𝑓 𝑘ℎ , which are the continuous
quantities ‘sampled’ at multiples of ℎ seconds. We now use the following
approximations, which are justified for small ℎ:
𝑑𝑝 𝑘ℎ 𝑝%6# − 𝑝% 𝑑𝑣 𝑘ℎ 𝑣%6# − 𝑣%
≈ , ≈ .
𝑑𝜏 ℎ 𝑑𝜏 ℎ
• This leads to the following (approximate) equations (replacing ≈ with =):
𝑝%6# − 𝑝% 𝑣%6# − 𝑣%
= 𝑣% , 𝑚 = 𝑓% − 𝜂𝑣% .
ℎ ℎ
State Space Representation
• Finally, using state 𝑥% = 𝑝% , 𝑣% 7 , we write this as
1 ℎ 0
𝑥%6# = 𝑥% + 𝑓, 𝑘 = 1,2, … .
0 1 − ℎ𝜂/𝑚 ℎ/𝑚 %
• This is a discrete-time linear dynamical system, with input 𝑓% and the
following dynamics matrix and input matrix:
1 ℎ 0
𝐴= , 𝐵= .
0 1 − ℎ𝜂/𝑚 ℎ/𝑚
• When including the state variables that we can measure, this representation of
a linear dynamical system is called the state space representation.
Euler Method
• This linear dynamical system gives an approximation of the true motion, due
to our approximation of the derivatives.
• But for ℎ small enough, it is accurate.
• This linear dynamical system can be used to simulate the motion of the mass,
if we know the external force applied to it.
• This approximation, which turns a set of differential equations into a set of
difference equations that approximate it, is called the Euler method, named
after the mathematician Leonhard Euler.
• There are other, more sophisticated, methods for approximating differential
equations as recursions.
Example
• As a simple example, we consider the case with 𝑚 = 1 (kilogram), 𝜂 = 1
(Newtons per meter per second), and sampling period ℎ = 0.01 (seconds).
• The external force is
0.4 1
p fk
v
0.3
0.5
0.2
0.1
-0.5
-1
-0.1
-0.2 -1.5
0 1 2 3 4 5 6 0 1 2 3 4 5 6
in s in s
Exercise
Equilibrium Point of a Linear Dynamical
System
• Consider a time-invariant linear dynamical system with offset, 𝑥!6# = 𝐴𝑥! + 𝑐 ,
where 𝑥! is the state 𝑛-vector.
• We say that a vector 𝑧 is an equilibrium point of the linear dynamical system if
𝑥# = 𝑧 implies 𝑥$ = 𝑧, 𝑥8 = 𝑧, ….
• In words: If the system starts in state 𝑧, it stays in state 𝑧.
• Find a matrix 𝐹 and vector 𝑔 for which the set of linear equations 𝐹𝑧 = 𝑔
characterises equilibrium points.
• This means: If 𝑧 is an equilibrium point, then 𝐹𝑧 = 𝑔; conversely if 𝐹𝑧 = 𝑔,
then 𝑧 is an equilibrium point.
• Express 𝐹 and 𝑔 in terms of 𝐴 and 𝑐 .
Remark
• Equilibrium points often have interesting interpretations.
• For example, if the linear dynamical system describes the population dynamics
of a country, with the vector 𝑐 denoting immigration (emigration when entries of
𝑐 are negative) then an equilibrium point is a population distribution that does
not change, year to year.
• In other words, immigration exactly cancels the changes in population
distribution caused by aging, births, and deaths.
Further Exercises
1. Reproduce the SIR Model simulation presented.