Modeling in the Time Domain
Modeling in the Time Domain
Introduction
Two approaches for analysis and design of feedback control systems
Transfer function approach (Classical, Frequency – domain)
• This approach is based on converting a system's differential equation to a transfer function, thus
generating a mathematical model of the system that algebraically relates a representation of the
output to a representation of the input.
• It can be applied only to linear time invariant systems or systems that can be approximated as
such.
Example:
1. Since the network is of second order, two simultaneous, first-order differential equations are
needed to solve for two state variables. We select i(t) and q(t), the charge on the capacitor, as the
two state variables.
2. Writing the loop equation yields
𝑑𝑖 1
𝐿 + 𝑅𝑖 + ∫ 𝑖 𝑑𝑡 = 𝑣(𝑡) 𝑒𝑞𝑛 1
𝑑𝑡 𝐶
Converting to charge, using i(t)=dq/dt, we get
𝑑2 𝑞 𝑑𝑞 1
𝐿 +𝑅 + 𝑞 = 𝑣(𝑡) 𝑒𝑞𝑛 2
𝑑𝑡 𝑑𝑡 𝐶
But an nth-order differential equation can be converted to n simultaneous first-order differential
equations, with each equation of the form
We can convert eqn2 into two simultaneous, first-order differential equations in terms of i(t) and
q(t). The first equation can be dq/dt = i. The second equation can be formed by substituting
∫ i dt = q into Eqn1 and solving for di/dt. Summarizing the two resulting equations, we get
𝑑𝑞
=𝑖 𝑒𝑞𝑛4
𝑑𝑡
𝑑𝑖 1 𝑅 1
= − 𝑞 − 𝑖 + 𝑣(𝑡) 𝑒𝑞𝑛 5
𝑑𝑡 𝐿𝐶 𝐿 𝐿
3. If you know the initial condition of all of the state variables at t0 as well as the system input for t
≥ t0, we can solve the simultaneous differential equations for the state variables for t≥t0.
𝑠𝑄(𝑠) − 𝑞(𝑡0 ) = 𝐼(𝑠)
1 𝑅
𝑠𝐼(𝑠) − 𝑖(𝑡0 ) = − 𝑄(𝑠) − 𝐼(𝑠) + 𝑉(𝑠)
𝐿𝐶 𝐿
4. Algebraically combine the state variables with the system's input and find all of the other system
variables for t ≥ t0. => Output equation
1
𝑣𝐿 (𝑡) = − 𝑞(𝑡) − 𝑅𝑖(𝑡) + 𝑣(𝑡)
𝐶
𝑣𝑅 (𝑡) = 𝑅𝑖(𝑡)
𝑑𝑖
𝑣𝑐 (𝑡) = −𝐿 − 𝑅𝑖 + 𝑣(𝑡)
𝑑𝑡
5. the state equations and the output equations => state-space representation.
𝑑𝑞 𝑑𝑖 1 𝑅 1 1
=𝑖 ; = − 𝑞 − 𝑖 + 𝑣(𝑡) ; 𝑣𝐿 (𝑡) = − 𝑞(𝑡) − 𝑅𝑖(𝑡) + 𝑣(𝑡)
𝑑𝑡 𝑑𝑡 𝐿𝐶 𝐿 𝐿 𝐶
𝒙̇ = 𝑨𝒙 + 𝑩𝒖
𝑑𝑞⁄ 0 1
𝑥̇ = [ 𝑑𝑡] ; 𝐴 = [− 1
𝑑𝑖⁄ ⁄𝐿𝐶 − ⁄𝐿]
𝑅
𝑑𝑡
𝑞 0
𝑥 = [ ]; 𝐵 = [1⁄ ] ; 𝑢 = 𝑣(𝑡)
𝑖 𝐿
𝑑𝑞⁄
[ 𝑑𝑡] = [ 0 1 𝑞 0
] [ ] + [1 ] 𝑣(𝑡)
𝑑𝑖⁄ − 1⁄𝐿𝐶 𝑅
− ⁄𝐿 𝑖 ⁄𝐿
𝑑𝑡
𝒚 = 𝑪𝒙 + 𝑫𝒖
𝑞
𝑦 = 𝑣𝐿 (𝑡) ; 𝐶 = [− 1⁄𝐶 −𝑅]; 𝑥 = [ ] ; 𝐷 = 1; 𝑢 = 𝑣(𝑡)
𝑖
𝑞
𝑣𝐿 (𝑡) = [− 1⁄𝐶 −𝑅] [ ] + 𝑣(𝑡)
𝑖
Linear independence: A set of variables is said to be linearly independent if none of the variables can be
written as a linear combination of the others.
State space: The n-dimensional space whose axes are the state
variables.
State equations: A set of n simultaneous, fist-order differential equations with n variables, where the n
variables to be solved are the state variables.
Output equation: The algebraic equation that expresses the output variables of a system as linear
combinations of the state variables and the inputs.
𝒙̇ = 𝑨𝒙 + 𝑩𝒖 State Equation
𝒚 = 𝑪𝒙 + 𝑫𝒖 Output Equation
x = state vector
A = system matrix
B = input matrix
C = output matrix
D = feedforward matrix
❖ Linear independence
The components of the state vector must be linearly independent.
if 𝑥1 , 𝑥2 , and 𝑥3 are chosen as state variables, but 𝑥3 =5𝑥1 +4𝑥2 then 𝑥3 is not linearly independent
of 𝑥1 and 𝑥2 , since knowledge of the values of 𝑥1 and 𝑥2 will yield the value of 𝑥3 .
Variables and their successive derivatives are linearly independent. For example, the voltage
across an inductor, 𝑣𝐿 , is linearly independent of the current through the inductor, 𝑖𝐿 , since 𝑣𝐿 =
L d𝑖𝐿 /dt. Thus, 𝑣𝐿 cannot be evaluated as a linear combination of the current, 𝑖𝐿 .
Given the electrical network below, find a state-space representation if the output is the current through
the resistor.
SOLUTION: The following steps will yield a viable representation of the network in state space.
1. Label all of the branch currents in the network. These include𝑖𝐿 , 𝑖𝑅 , and 𝑖𝐶 .
2. Select the state variables by writing the derivative equation for all energy storage elements, that
is, the inductor and the capacitor.
𝑑𝑣𝑐 𝑑𝑖𝐿
𝐶 = 𝑖𝐶 ; 𝐿 = 𝑣𝐿
𝑑𝑡 𝑑𝑡
Choose the state variables as the quantities that are differentiated, namely 𝑣𝐿 . and 𝑖𝐶 . Since 𝑖𝐶
and 𝑣𝐿 are not state variables, our next step is to express 𝑖𝐶 and 𝑣𝐿 as linear combinations of the
state variables, 𝑣𝐶 and 𝑖𝐿 , and the input, v(t).
3. Apply network theory, such as Kirchhoff’s voltage and current laws, to obtain 𝑖𝐶 and 𝑣𝐿 in terms
of the state variables, 𝑣𝐶 and 𝑖𝐿 . At Node 1,
1
𝑖𝐶 = −𝑖𝑅 + 𝑖𝐿 = − 𝑣𝐶 + 𝑖𝐿
𝑅
which yields 𝑖𝐶 in terms of the state variables, 𝑣𝐶 and 𝑖𝐿 .
Around the outer loop,
𝑣𝐿 = −𝑣𝐶 + 𝑣(𝑡)
which yields 𝑣𝐿 in terms of the state variable, 𝑣𝐶 , and the source, v(t).
4. Substitute the value of 𝑖𝐶 and 𝑣𝐿 from step 2 to obtain the following state equations.
𝑑𝑣𝑐 1
𝐶 = − 𝑣𝐶 + 𝑖𝐿
𝑑𝑡 𝑅
𝑑𝑣𝑐 1 1
=− 𝑣𝐶 + 𝑖𝐿
𝑑𝑡 𝑅𝐶 𝐶
𝑑𝑖𝐿
𝐿 = −𝑣𝐶 + 𝑣(𝑡)
𝑑𝑡
𝑑𝑖𝐿 1 1
= − 𝑣𝐶 + 𝑣(𝑡)
𝑑𝑡 𝐿 𝐿
5. Find the output equation. Since the output is 𝑖𝑅 (t).
1
𝑖𝑅 = 𝑣𝐶
𝑅
The final result for the state-space representation is found by representing state equations and output
equations into vector-matrix form:
1⁄ 1⁄ 𝑣
[
𝑣𝐶̇
] = [ 𝑅𝐶 𝐶 ] [ 𝐶 ] + [ 0 ] 𝑣(𝑡)
𝑖𝐿̇ 𝑖𝐿 1⁄
− 1⁄𝐿 0 𝐿
𝑣𝐶
𝑖𝑅 = [1⁄𝑅 0] [ 𝑖 ]
𝐿
Solution: Immediately notice that this network has a voltage-dependent current source.
Step 1 Label all of the branch currents on the network
Step 2 Select the state variables by listing the voltage-current relationships for all
of the energy-storage elements:
𝑑𝑣𝑐 𝑑𝑖𝐿
𝐶 = 𝑖𝐶 ; 𝐿 = 𝑣𝐿
𝑑𝑡 𝑑𝑡
select the state variables to be the differentiated variables. Thus, the state variables, 𝑥1 and 𝑥2 , are 𝑖𝐿 and
𝑣𝐶 respectively.
Step 3 Remembering that the form of the state equation is
𝒙̇ = 𝑨𝒙 + 𝑩𝒖
Using Kirchhoff’s voltage and current laws, we find vL and iC in terms of the state variables and the input
current source. Around the mesh containing L and C,
𝑣𝐿 = 𝑣𝐶 + 𝑣𝑅2 = 𝑣𝐶 + 𝑖𝑅2 𝑅2
Simultaneous equations 1 and 2 yielding 𝑣𝐿 and 𝑖𝐶 as linear combinations of the state variables 𝑖𝐿 and 𝑣𝐶 :
(1 − 4𝑅2 )𝑣𝐿 − 𝑖𝐶 𝑅2 = 𝑣𝐶
𝑣𝐿
− − 𝑖𝐶 = 𝑖𝐿 − 𝑖(𝑡)
𝑅1
Solving equations simultaneously for 𝑣𝐿 and 𝑖𝐶 yields
1
𝑣𝐿 = [𝑅 𝑖 − 𝑣𝐶 − 𝑅2 𝑖(𝑡)]
∆ 2𝐿
1 1
𝑖𝐶 = [(1 − 4𝑅2 )𝑖𝐿 + 𝑣𝐶 − (1 − 4𝑅2 )𝑖(𝑡)]
∆ 𝑅1
Where
𝑅2
∆= − [(1 − 4𝑅2 ) + ]
𝑅1
Substituting the value of 𝑖𝐶 and 𝑉𝐿 from step 2 into the equation, simplifying, and writing the result in
vector-matrix form renders the following state equation:
𝑅2 1
−
⁄𝐿 [(1 − 4𝑅 ) + 𝑅2 ] ⁄ 𝑅
𝐿 [(1 − 4𝑅2 ) + 𝑅2 ]
2 𝑅
𝑖̇ 1 1 𝑖
[ 𝐿]= 𝑅 [ 𝐿]
𝑣𝐶̇ (1 − 4𝑅2 ) 1 2 𝑣 𝐶
− ⁄ 𝑅2 − ⁄𝑅1 𝐶 [(1 − 4𝑅2 ) + 𝑅1 ]
𝐶 [(1 − 4𝑅2 ) + ]
[ 𝑅1 ]
𝑅2
⁄𝐿 [(1 − 4𝑅 ) + 𝑅2 ]
2 𝑅1
+ 𝑖(𝑡)
(1 − 4𝑅2 )
⁄ 𝑅
𝐶 [(1 − 4𝑅2 ) + 2 ]
[ 𝑅1 ]
Step 4 Derive the output equation. Since the specified output variables are 𝑣𝑅2 and 𝑖𝑅2 , we note that
around the mesh containing C, L, and 𝑅2 ,
𝑣𝑅2 = −𝑣𝐶 + 𝑣𝐿
𝑖𝑅2 = 𝑖𝐶 + 4𝑣𝐿
Substitute the value of 𝑖𝐶 and 𝑣𝐿 from the equation, 𝑣𝑅2 and 𝑖𝑅2 are obtained as linear combinations of
the state variables, 𝑖𝐿 and 𝑣𝐶 . In vector-matrix form, the output equation is
𝑅2
−(1 + 1⁄
⁄− [(1 − 4𝑅 ) + 𝑅2 ] 𝑅
− [(1 − 4𝑅2 ) + 𝑅2 ]
𝑣𝑅2 2 𝑅1 1 𝑖
[𝑖 ] = [ 𝐿]
𝑅2 1 (1 − 4𝑅2 ) 𝑣 𝐶
⁄ 𝑅2 ⁄ 𝑅2
− [(1 − 4𝑅2 ) + ] −𝑅 1 [(1 − 4𝑅2 ) + ]
[ 𝑅 1 𝑅 ] 1
𝑅2
⁄[(1 − 4𝑅 ) + 𝑅2 ]
2 𝑅1
+ 𝑖(𝑡)
1
⁄ 𝑅2
)
[ − [(1 − 4𝑅2 + 𝑅 ]] 1
Example: Representing a Translational Mechanical System
PROBLEM: Find the state equations for the translational mechanical system
SOLUTION: First write the differential equations for the network to find the Laplace-transformed
equations of motion. Next take the inverse Laplace transform of these equations, assuming zero initial
conditions, and obtain:
𝑑2 𝑥1 𝑑𝑥1
𝑀1 2
+𝐷 + 𝐾𝑥1 − 𝐾𝑥2 = 0
𝑑𝑡 𝑑𝑡
𝑑2 𝑥2
−𝐾𝑥1 + 𝑀2 + 𝐾𝑥2 = 𝑓(𝑡)
𝑑𝑡 2
𝑑 2 𝑥1 𝑑𝑣1 𝑑 2 𝑥2 𝑑𝑣2
Now let 𝑑𝑡 2
=
𝑑𝑡
, and 𝑑𝑡 2
= 𝑑𝑡
, and then select 𝑥1 , 𝑣1 , 𝑥2 , and 𝑣2 as state variables. Next form two of
𝑑𝑣1 𝑑𝑣2 𝑑𝑥 𝑑𝑥
the state equations for and and add 1 = 𝑣1 and 2 = 𝑣2 to complete the set of equations.
𝑑𝑡 𝑑𝑡 𝑑𝑡 𝑑𝑡
𝑑𝑥1
= +𝑣1
𝑑𝑡
𝑑𝑣1 𝐾 𝐷 𝐾
=− 𝑥1 − 𝑣1 + 𝑥
𝑑𝑡 𝑀1 𝑀1 𝑀2 2
𝑑𝑥2
= 𝑣2
𝑑𝑡
𝑑𝑣2 𝐾 𝐾 1
= 𝑥1 − 𝑥2 + 𝑓(𝑡)
𝑑𝑡 𝑀2 𝑀2 𝑀2
In vector-matrix form,
0 1 0 0 0
𝑥1̇ 𝐾⁄ 𝑥1
𝐾
− ⁄𝑀 𝐷
− ⁄𝑀 0 0
𝑣̇ 𝑀1 𝑣
[ 1] = 1 1
[𝑥1 ] + 0 𝑓(𝑡)
𝑥2̇ 0 0 0 1 2
1
𝑣2̇ 𝐾
[ ⁄𝑀2 0 − 𝐾⁄𝑀 0] 𝑣2 [ ⁄𝑀2 ]
2
where the dot indicates differentiation with respect to time. What is the output equation if the output is
x(t)?
𝐾 𝐷 𝐾
𝑣1̇ = − 𝑥1 − + 𝑥
𝑀1 𝑀1 𝑀2 2
𝐾 𝐾 1
𝑣2̇ = 𝑥1 − 𝑥2 + 𝑓(𝑡)
𝑀2 𝑀2 𝑀2
PROBLEM: Represent the translational mechanical system shown below in state space, where 𝑥3 (t) is the
output.
𝑑2 𝑥1 𝑑𝑥1 𝑑𝑥2
2
+ + 𝑥1 − = 𝑓(𝑡) 𝑥1̈ = −𝑥1̇ − 𝑥1 + 𝑥2̇ + 𝑓
𝑑𝑡 𝑑𝑡 𝑑𝑡
𝑑2 𝑥2 𝑑𝑥2 𝑑𝑥1
2
+ + 𝑥2 − − 𝑥3 = 0 𝑥2̈ = 𝑥1̇ − 𝑥2̇ − 𝑥2 + 𝑥3
𝑑𝑡 𝑑𝑡 𝑑𝑡
𝑑2 𝑥3 𝑑𝑥3
+ + 𝑥3 − 𝑥2 = 0 𝑥3̈ = 𝑥2 − 𝑥3̇ − 𝑥3
𝑑𝑡 2 𝑑𝑡
Let: 𝑧1 = 𝑥1 ; 𝑧2 = 𝑥1̇ ; 𝑧3 = 𝑥2 ; 𝑧4 = 𝑥2̇ ; 𝑧5 = 𝑥3 ; 𝑧6 = 𝑥3̇
𝑧1̇ = 𝑧2 = 𝑥1̇
𝑧2̇ = 𝑥1̈ = −𝑥1̇ − 𝑥1 + 𝑥2 + 𝑓
𝑧3̇ = 𝑧4 = 𝑥2̇
𝑧4̇ = 𝑥2̈ = 𝑥1̇ − 𝑥2̇ − 𝑥2 + 𝑥3
𝑧5̇ = 𝑧6 = 𝑥3̇
𝑧6̇ = 𝑥̈3 = 𝑥2 − 𝑥3̇ − 𝑥3
Output is y= 𝑧5 = 𝑥3
Converting a Transfer Function to State Space
One advantage of the state-space representation is that it can be used for the simulation of physical
systems on the digital computer. Thus, if we want to simulate a system that is represented by a transfer
function, we must first convert the transfer function representation to state space.
How to represent a general, nth order, linear differential equation with constant coefficients in state space
in the phase – variables.
At first, we select a set of state variables, called phase variables, where each subsequent state variable is
defined to be the derivative of the previous state variable. Let us begin by showing how to represent a
general, nth-order, linear differential equation with constant coefficients in state space in the phase-
variable form. We will then show how to apply this representation to transfer functions.
Choose the output, y(t), and its (n-1) derivatives the state variables. This choice is called the phase-variable
choice. Choosing the state variables, 𝑥𝑖 , we get
where the dot above the x signifies differentiation with respect to time.
Substituting the definitions of above equations, the state equations are evaluated as
In vector-matrix form, it becomes
and this is the phase-variable form of the state equations. This form is easily recognized by the unique pattern
of 1’s and 0’s and the negative of the coefficients of the differential equation written in reverse order in the last
row of the system matrix.
Finally, since the solution to the differential equation is y(t), or 𝑥1 , the output equation is
SOLUTION:
𝑥1 = 𝑐
𝑥2 = 𝑐̇
𝑥3 = 𝑐̈
Differentiating both sides and making use of the above equations to find 𝑥1̇ , 𝑥2̇ while 𝑥3̇ from the equation
on step 1.
Since the output is c = 𝑥1 , the combined state and output equations are
𝑥1̇ = 𝑥2
𝑥2̇ = 𝑥3
𝑥3̇ = −24𝑥1 − 26𝑥2 − 9𝑥3 + 24𝑟
𝑦 = 𝑐 = 𝑥1
𝑥1̇ 0 1 0 𝑥1 0
[𝑥2̇ ] = [ 0 0 1 ] [𝑥 2 ] + [ 0 ]𝑟
𝑥3̇ −24 −26 −9 𝑥 3 24
𝑥1
𝑦 = [1 0 𝑥
0] [ 2 ]
𝑥3
Notice that the third row of the system matrix has the same coefficients as the denominator of the
transfer function but negative and in reverse order.
At this point, we can create an equivalent block diagram of the system to help visualize the state
variables. We draw three integral blocks and label each output as one of the state variables. Since the
input to each integrator is 𝑥𝑖 (𝑡) use the equations for 𝑥1̇ , 𝑥̇ 2 , 𝑥3̇ to determine the combination of input
signals to each integrator. Form and label each input. Finally, use equation for the value of y to form and
label the output y(t) = c(t).
Converting a Transfer Function with Polynomial in Numerator
PROBLEM: Find the state-space representation of the transfer function shown below
SOLUTION: This problem differs from converting the transfer function with constant term in numerator
since the numerator has a polynomial in s instead of just a constant term.
Step 1 Separate the system into two cascaded blocks. The first block contains the denominator and the
second block contains the numerator.
Step 2 Find the state equations for the block containing the denominator. We notice that the first block’s
numerator is 1/24 that of the first example.
𝑥1̇ 0 1 0 𝑥1 0
[𝑥2̇ ] = [ 0 0 1 ] [𝑥2 ] + [0] 𝑟
𝑥3̇ −24 −26 −9 𝑥3 1
Step 3 Introduce the effect of the block with the numerator. The second block of the diagram where 𝑏2 =
1; 𝑏1 = 7, and 𝑏0 = 2, states that
𝑐 = 𝑥̈ 1 + 7𝑥1̇ + 2𝑥1
But 𝑥1 = 𝑥1 ; 𝑥1̇ = 𝑥2 ; 𝑥̈ 1 = 𝑥3
Thus, the last box in Step 2 diagram ‘‘collects’’ the states and generates the output equation.
𝑥1 𝑥1
𝑦 = [𝑏0 𝑏1 𝑏2 ] [ 𝑥2 ] = [2 7 1] [ 𝑥2 ]
𝑥3 𝑥3
Although the second block of step 1 diagram shows differentiation, this block was implemented without
differentiation because of the partitioning that was applied to the transfer function. The last block simply
collected derivatives that were already formed by the first block.
Once again, we can produce an equivalent block diagram that vividly represents our state-space model.
𝒙̇ = 𝑨𝒙 + 𝑩𝒖
𝒚 = 𝑪𝒙 + 𝑫𝒖
Take the Laplace Transform assuming zero initial conditions:
or
We call the matrix [𝐶(𝑠𝐼 − 𝐴)−1 𝐵 + 𝐷] the transfer function matrix since it relates the output vector,
Y(s), to the input vector, U(s). However, if U(s) = U(s) and Y(s) = Y(s) are scalars, we can find the transfer
𝑌(𝑠)
function, 𝑇(𝑠) = 𝑈(𝑠) = 𝐶(𝑠𝐼 − 𝐴)−1 𝐵 + 𝐷
SOLUTION: The solution revolves around finding the term (sI – A)-1. All other terms are already defined.
Hence, first find (sI – A)-1.
𝑠 0 0 0 1 0 𝑠 −1 0
(𝑠𝐼 − 𝐴) = [0 𝑠 0] − [ 0 0 1 ] = [0 𝑠 −1 ]
0 0 𝑠 −1 −2 −3 1 2 𝑠+3
Now form the (sI – A)-1
𝑎𝑑𝑗𝑜𝑖𝑛𝑡(sI – A)
(𝑠𝐼 − 𝐴)−1 =
𝑑𝑒𝑡𝑒𝑟𝑚𝑖𝑛𝑎𝑛𝑡(𝑠𝐼 − 𝐴)
3𝑠 2 + 3𝑠 + 2 𝑠+3 1
[ −1 𝑠(𝑠 + 3) 𝑠]
𝑌(𝑠) −𝑠 −(2𝑠 + 1) 𝑠2 10 10(𝑠 2 + 3𝑠 + 2)
𝑇(𝑠) = = [1 0 0] [ 0 ] + 0 =
𝑈(𝑠) 𝑠 3 + 3𝑠 2 + 2𝑠 + 1 𝑠 3 + 3𝑠 2 + 2𝑠 + 1
0
10(𝑠 2 + 3𝑠 + 2)
𝑇(𝑠) =
𝑠 3 + 3𝑠 2 + 2𝑠 + 1
PROBLEM: Convert the state and output equations shown below to a transfer function.
−1 𝑠 −1.5
[ ]
𝑠 0 −4 −1.5 𝑠+4 1.5 −1
(𝑠𝐼 − 𝐴) −1
= [[ ]−[ ]] =[ ] = 2 𝑠+4
4
0 𝑠 4 0 −4 𝑠 𝑠 + 4𝑠 + 6
𝑠 −1.5
𝑌(𝑠) [ ] 3𝑠 + 5
2
𝑇(𝑠) = = [1.5 0.625] 24 𝑠 + 4 [ ] + 0 = 2
𝑈(𝑠) 𝑠 + 4𝑠 + 6 0 𝑠 + 4𝑠 + 6