System Modeling
System Modeling
System Modeling
2.1 Introduction
21
22 CHAPTER 2. SYSTEM MODELING
3 M=1
x’=Mx−y−x
y’=x
1.5
0.5
0
y
−0.5
−1
−1.5
−2
Figure 2.1: Illustration of a state model. A state model gives the rate of
change of the state as a function of the state. The velocity of the state are
denoted by arrows.
Input Output
System
there are simple dynamical systems that are extremely sensitive to initial
conditions, small perturbations may lead to drastic changes in the behavior
of the system. The behavior of the system could also be extremely compli-
cated. The emergence of chaos also resolved the problem of determinism,
even if the solution is uniquely determined by the initial conditions it is in
practice impossible to make predictions because of the sensitivity of initial
conditions.
The differential equation (2.1) is called an autonomous system because
there are no external influences. Such a model is natural to use for celestial
mechanics, because it is difficult to influence the motion of the planets. The
situation in control is quite different because the external influences are quite
important. One way to capture this is to replace equation (2.1) by
dx
= f (x, u) (2.2)
dt
where u represents the effect of external influences. The model (2.2) is called
a controlled differential equation. The model implies that the velocity of the
state can be influenced by the input u. Adding the input makes the model
richer. New questions arises, for example, what influence can the control
variable have on the trajectories of the system? Is it possible to reach all
points in the state space by proper choices of the control?
where g is the impulse response of the system. If the input u is a unit step
the output becomes
Z t Z t
y(t) = h(t) = g(t − τ )dτ = g(τ )u(τ )dτ (2.4)
0 0
The function h is called the step response of the system. Notice that the
impulse response is the derivative of the step response.
Another possibility to describe a linear, time-invariant system is to rep-
resent a system by its response to sinusoidal signals, this is called frequency
response. A rich powerful theory with many concepts and strong, useful re-
sults have emerged. The results are based on the theory of complex variables
and Laplace transforms. The input-output view lends it naturally to exper-
imental determination of system dynamics, where a system is characterized
by recording its response to a particular input, e.g. a step.
The words input-output models, external descriptions, black boxes are
synonyms for input-output descriptions.
dx
= f (x, u)
dt (2.5)
y = g(x, u)
dk dy1k dy1k
(αy 1 + βy 2 ) = α + β
dtk dtk dtk
If (u, y) is a pair of inputs and outputs it follows that (u0 , y 0 ) is also an
input output pair. Simlarly, if the (u1 , y1 ) and (u2 , y2 ) are pairs of inputs
and outputs that satisfy the Equation (2.6) αu1 + βu2 , αy1 + βy2 ) is also
an input output pair, which is the principle of superposition.
dn y dn−1 y dn−2 y
+ a 1 + a 2 + . . . + an y = 0, (2.7)
dtn dtn−1 dtn−2
which is called the homogeneous equation associated with equation (2.6).
The characteristic polynomial of Equations (2.6) and (2.7) is
where Ck are arbitrary constants. The Equation (2.7) thus has n free pa-
rameters.
α<0 aneg
3
1
2.5
0.8
2
0.6
1.5
y
PSfrag replacements 0.4 1
0.2 0.5
0 0
0 1 2 3 4 0 0.2 0.4 0.6 0.8 1
α>0 αt αt
Figure 2.3: The exponential function y(t) = eαt . The linear approximations
of of the functions for small αt are shown in dashed lines. The parameter
T = 1/α is the time constant of the system.
which have oscillatory behavior, see Figure 2.4. The distance between zero
crossings is π/ω and corresponding amplitude change is eσπ/ω .
Multiple Roots
When there are multiple roots the solution to Equation (2.7) has the form
n
X
y(t) = Ck (t)eαk t , (2.10)
k=1
Where Ck (t) is a polynomial with degree less than the multiplicity of the
root αk . The solution (2.10) thus has n free parameters.
σ = −0.25ω σ = 0.25ω
40
0.6
30
0.4 20
0.2 10
y
y
PSfrag replacements 0 0
−0.2 −10
−0.4 −20
0 5 10 15 0 5 10 15
ωt ωt
Figure 2.4: The exponential function y(t) = eσt sin ωt. The linear approx-
imations of of the functions for small αt are shown in dashed lines. The
dashed line corresponds to a first order system with time constant T = 1/σ.
The distance between zero crossings is π/ω.
dn h dn−1 h
+ a 1 + . . . + an h = 0 (2.13)
dtn dtn−1
The solution (2.12) is thus a sum of two terms, the general solution to the
homogeneous equation and a particular solution which depends on the input
u. The solution has n free parameters which can be determined from initial
conditions.
To show that (2.12) satisfies (2.11) we first observe that the sum in (2.12)
satisfies the homogeneous equation (2.7). Consider
Z t
v(t) = h(t − τ )u(τ )dτ,
0
30 CHAPTER 2. SYSTEM MODELING
It follows from (2.13) and (2.14) that v satisfies the differential equation
(2.11).
dn y dn−1 y dn−2 y du
n
+ a 1 n−1
+ a 2 n−2
+ . . . + an y =
dt dt dt dt
Repeating this argument for higher derivatives we find that the Equation (2.6)
has the solution
n
X Z t
y(t) = Ck−1 (t)eαk t + g(t − τ )u(τ )dτ, (2.15)
k=1 0
The solution is thus the sum of two terms, the general solution to the ho-
mogeneous equation and a particular solution. The general solution to the
homogeneous equation does not depend on the input and the particular
solution which depends on the input. The particular solution is given by
Z t
y(t) = g(t − τ )u(τ )dτ
0
It thus has the same form as the general solution to the homogeneous equa-
tion (2.10). The coefficients ck are given by the conditions (2.14). If the
characteristic equation has distinct roots ck (t) are constants. If αk is a root
of multiplicity m then ck (t) is a polynomial of degree m − 1.
The impulse response is also called the weighting function because the
second term of (2.15) can be interpreted as a weighted sum of past inputs.
The function H is called the unit step response or the step response for
short. It follows from the above equation that
dh(t)
g(t) = (2.20)
dt
The step response can easily be determined experimentally by waiting for the
system to come to rest and applying a constant input. In process engineering
the experiment is called a bump test. The impulse response can then be
determined by differentiating the step response.
10
u(τ ) y(τ )
5
−5
0 1 2 3 4 5 6 7 8 9 10
g(10 − τ )
0.5
0
0 1 2 3 4 5 6 7 8 9 10
2
u(τ ) g(10 − τ )
PSfrag replacements 1
−1
τ 0 1 2 3 4 5 6 7 8 9 10
Figure 2.5: Illustration of the convolution integral for the impulse response
g(t) = e−4t . The top shows the input u in full lines and the output y in
dashed lines. The lower graphs illustrates how y(10) is obtained.
Mathematically the output is called a convolution of the input u and the im-
pulse response g. This integral has a nice interpretation which is illustrated
in Figure Figure 2.5. The figure illustrates that the output is obtained as a
weighted average of the input. The top plot shows the input u in full lines
and the output y in dashed lines. The lower graphs illustrates how the value
y(10) is obtained. The middle curve shows the impulse response g(10 − τ )
and the lower plot shows the product u(τ )g(10 − τ ). The value y(10) is
simply the integral of u(τ )g(10 − τ ). By understanding of the interpretation
of the convolution integral it is easy to develop an intuitive understanding
of the qualitative behavior of a system from the impulse response.
u(t) = eαt .
y(t) = y0 eαt
It thus follows that there the equation has a solution of the form y0 eαt and
that
b1 αn−1 + b2 αn−2 + · · · + bn
y0 = = G(α)
αn + a1 αn−1 + · · · + an
where G(s) is the transfer function of the system. Let λk be the zeros of the
characteristic polynomial a(s) of the system we thus find that the general
solution of the differential equation is
X
y(t) = Ck (t)eλk t + G(α)eαt (2.21)
k
We have
Separating the real and imaginary parts of the input and the output we find
that the input u(t) = sinωt gives the output
X
y(t) = Ck (t)eλk t + |G(iω)| sin (ωt + arg G(iω)) (2.22)
k
This result is of particular interest for stable systems. For such systems we
have λk < 0. After an initial transient the response to a sinusoidal input
will thus be sinusoidal with the same frequency as the input. The output is
thus amplified by the factor |G(iω)| and the phase is shifted by arg G(iω) in
relation to the input. This is discussed further in Section 2.4.
0.2
0.15
0.1
Output
0.05
−0.05
−0.1
0 5 10 15
0.5
Input
−1
0 5 10 15
Time
If the system is stable, i.e. Reλk < 0 for all k, the first term will decay
exponentially and the solution will converge to the steady state response
given by
y(t) = |G(iω)| sin (ωt + arg G(iω)) (2.23)
This is illustrated in Figure 2.6 which shows the response of a linear time-
invariant system to a sinusoidal input. The figure shows the output of the
system when it is initially at rest and the steady state output given by (2.23).
The figure shows that after a transient the output is indeed a sinusoid with
the same frequency as the input.
The steady state response to a sinusoid is completely characterized by
the function G(iω) which is called the frequency response of the system. The
argument of the function is frequency ω and the function takes complex val-
ues. The magnitude |G(iω)| is called the gain and the angle arg G(iω) is
36 CHAPTER 2. SYSTEM MODELING
called the phase. The phase is often negative and the quantity -arg G(iω),
called the phase lag, is therefore also used. The gain |G(iω)| is a generaliza-
tion of the static gain G(0) which tells steady state output when the input
is a constant. It is thus possible to talk about the gain of the system for
signals of different frequencies. The propagation of any signal can then be
obtained by representing it as a sum of sinusoids, investigating each sinusoid
individually and adding the outputs using superposition.
The frequency response can be determined experimentally by injecting
a sinusoid and measuring the ratio of the amplitudes and the phase shift
between input and output. Very accurate measurements are possible by
using correlation techniques. This is very important in practice because it
may be very time consuming or even impossible to obtain a mathematical
model from first principles.
dx
= f (x, u)
dt (2.24)
y = g(x, u)
The dimension of the state vector is called the order of the system.
The system is called time-invariant because the functions f and g do not
depend explicitly on time t. It is possible to have more general time-
varying systems where the functions do depend on time. The model thus
consists of two functions. The function f gives the velocity of the state
vector as a function of state x, control u and time t and the function g
gives the measured values as functions of state x, control u and time t. The
function f is called the velocity function and the function g is called the
sensor function or the measurement function. A system is called linear if
the functions f and g are linear in x and u. A linear system can thus be
2.5. STATE MODELS 37
PSfrag replacements
l
θ x
represented by
dx
= Ax + Bu
dt
y = Cx + Du
where A, B, C and D are constant varying matrices. Such a system is said
to be linear and time-invariant, or LTI for short. The matrix A is called
the dynamics matrix, the matrix B is called the control matrix, the matrix
C is called the sensor matrix and the matrix D is called the direct term.
Frequently systems will not have a direct term indicating that the control
signal does not influence the output directly. We will illustrate by a few
examples.
Example 1 (The Double Integrator). Consider a system described by
· ¸
dx 0 1 £ ¤
= x+ 0 1 u
dt 0 0 (2.25)
£ ¤
y= 1 0 x
R L +
M M J ω
u e
− D
i
(a) (b)
This is a linear time-invariant system with three state variables and one
input.
Example 4 (The Water Tank). Consider a tank with water where the input
is the inflow and there is free outflow, see Figure 2.9 Assuming that the
density is constant a mass balance for the tank gives
dV
= qin − qout
dt
The outflow is given by p
qout = a 2gh
There are several possible choices of state variables. One possibility is to
characterize the storage of water by the height of the tank. We have the
40 CHAPTER 2. SYSTEM MODELING
2.7 References