Part6 Review State - Space
Part6 Review State - Space
⮚ Mathematically, the knowledge of the initial values of the state variables at t0 (namely
xi (t0),i = 1,...,n), together with the knowledge of the system inputs for time t ≥ t0, are
sufficient to predict the behavior of the future system state and output variables (for t
≥ t0).
⮚ The state of a system is a set of variables whose values, together with the input signals
and the equations describing the dynamics, will provide the future state and output of the
system.
⮚ A state variable model helps us understand some complex general concepts about
control systems, such as controllability and observability.
1- The State Equations
In the standard form, the mathematical description of the system is expressed as a set of n coupled
first-order ordinary differential equations, known as the state equations, in which the time
derivative of each state variable is expressed in terms of the state variables.
In the general case the form of the n state equations is:
For an LTI system of order n, and with r inputs, the above equations become a set of n coupled
first-order linear differential equations with constant coefficients:
Where the coefficients aij and bij are constants that describe the system. Which may be
summarized as:
Where the state vector x is a column vector of length n, the input vector u is a column vector
of length r,
A: is an n × n square matrix of the constant coefficients aij
B: is an n × r matrix of the coefficients bij that weight the inputs.
2- Output Equations
An arbitrary output variable in a system of order n with r inputs may be written:
Where the ci and di are constants. If a total of m system variables are defined as outputs,
the m such equations may be written as:
Where y is a column vector of the output variables yi(t), C is an m×n matrix of the constant
coefficients cij that weight the state variables, and D is an m × r matrix of the constant
coefficients dij that weight the system inputs.
For many physical systems the matrix D is the null matrix, and the output equation reduces to a
simple weighted combination of the state variables:
Summary
A system is represented in state space by the following equations:
State space: The n-dimensional space whose bases are the state variables
► State-space has other advantages that we will see later on. For
example:
■ Natural representation for nonlinear systems, time varying
systems (variable mass systems, …)
Selecting the state variables must follow these rules
❖ From the transfer: The order of the differential equation is the order of the denominator
of the TF after canceling common factors in the numerator and denominator.
❖ A practical way to determine the number of state variables is to count the number of
independent energy-storage elements in the system
⮚ For electricalsystem: for inductors, choose current as the state variable, for
capacitors choose voltage Another perspective is to consider the relevant quantities in
the energy equations:
Kinetic Energy Inductor E = ½ L i2
Potential Energy Capacitor E = ½ C v2
Dissipative Energy Resistor E = R i2
⮚ For mechanical system (translational and rotational), choose position x and speed
(v where v= dx/dt)
⮚
Kinetic Energy Mass E = ½ m v2
Inertia E = ½ J 𝜔2
Recommended procedure:
- Write the simple derivative eq for each energy-storage element.
- Solve for each derivative term as a linear combination of system variables and the input.
- Each differentiated variable is selected as a state variable.
- All other system variables and the output are written in terms of the state variables and the
input.
Note:-
A state space representation is not unique , since a different choice of state variables leads to
different representation of the same system.
Example
Find the state equations for the electrical network in figure below. The output is V c
𝑑𝑥2 𝑑𝑣𝐶
𝑥2 = 𝑣𝐶 → = 𝑥̇ 2 =
𝑑𝑡 𝑑𝑡
𝑣𝑖 = 𝑣𝑅 + 𝑣𝐿 + 𝑣𝐶
𝑣𝐿 = 𝑣𝑖 − 𝑣𝑅 − 𝑣𝐶
𝑑𝑖𝐿 𝑑𝑖𝐿 1 𝑅 1
𝐿. = 𝑣𝑖 − 𝑅. 𝑖𝐿 − 𝑣𝐶 → = 𝐿 𝑣𝑖 − 𝐿 . 𝑖𝐿 − 𝐿 𝑣𝐶
𝑑𝑡 𝑑𝑡
𝑅 1 1
𝑥̇ 1 = − . 𝑥1 − 𝑥2 + 𝑣𝑖
𝐿 𝐿 𝐿
𝑥̇ 1 = −𝑥1 − 𝑥2 + 𝑣𝑖
𝑑𝑣𝐶
𝐶. = 𝑖𝐶 But 𝑖𝐶 = 𝑖𝐿
𝑑𝑡
𝑑𝑣𝐶 1
𝑑𝑡
=
𝐶 𝐿
𝑖
1
𝑥̇ 2 = 𝑥1 = 𝑥1
𝐶
The output
𝑦 = 𝑣0 = 𝑣𝐶
𝑦 = 𝑥2
𝑥̇ −1 −1 𝑥1
State Equations [ 1] = [ ] [𝑥 ] + [1] 𝑣𝑖
𝑥̇ 2 1 0 2 0
𝑥1 0 𝑥1
Output Equation [ ] [ ]
𝑦 = 0 1 [𝑥 ] + [ ] 𝑣𝑖 = 0 1 [𝑥 ]
2 0 2
Example
Find a state-space representation of the system shown in the figure if the output is the
current through the resistor (iR).
Step 2 Select the state variables: write the derivative equation for all energy-storage elements
(L and C) and choose the differentiated quantities as the state variables (V c, il )
Step 3 Write the right-had sides of “step 2” and the output equations as linear combinations of
the state variables and the input. Network theory (Kirchhoff, etc.) will be used for the electric
systems.
Consider the parallel electrical circuit shown in figure below. We take the input to be the current
produced by the independent current source u(t) = i(t) and the output to be the capacitor voltage
y(t) = v(t).
It is often convenient to associate state variables with the energy storage elements in the network,
namely, the capacitors and inductors. Specifically, capacitor voltages and inductor currents.
Example
Find the state equations for the electrical network in figure if the output y(t)is the current
through the resistor R1.
Example
Using Newton’s second law, the dynamic force balance for the free body diagram yields the
following second-order ordinary differential equation
Because this is a single second-order differential equation, we need to select a 2 × 1 state vector.
In general, energy storage is a good criterion for choosing the state variables. The total system
energy at any time is composed of potential spring energy plus kinetic energy associated with
the mass displacement and velocity. We then choose to define the state variables as the mass
displacement and velocity:
The original single second-order differential equation can be written as a coupled system of two
first-order differential equations, that is,
Example
Consider the translational mechanical system as shown in figure below, in which y 1(t) and y2(t)
denote the displacement of the associated mass from its static equilibrium position, and f (t)
represents a force applied to the first mass m1. The input is the applied force u(t) = f (t), and
the outputs are taken as the mass displacements.
Newton’s second law applied to each mass yields the coupled second order differential
equations, that is,
Here, the energy-storage elements are the two springs and the two masses. Defining state
variables in terms of mass displacements and velocities yields
Example
Find the state equations for the translational mechanical system in figure below
EX: Represent the following system in state space. Give your answer in vector-matrix form.
Converting from the Differential Equation to State Space
Extract the state space using simulink]
>> [A,B,C,D]=linmod('DE_model')
A=
0 1 0
0 0 1
-4 -3 -2
B=
0
0
1
C=
1 0 0
D=
0
Converting from a Transfer Function to State Space
1- Converting a transfer function with constant term in numerator
This case corresponds to a linear system that can be represented as an nth-order linear
differential equation with constant coefficients like:
The classical Transfer Function (TF) representation of that system is obtained applying the
Laplace Transform to the diff. eq.
If
the
State Space (SS) representation has to be obtained, a convenient way to select state variables is
to choose the output, y(t), and its n-1 derivatives as the state variables. This is called the phase-
variable choice.
A SS representation using the phase-variable choice for the state variables is said to be in the
Controller Canonical Form (CCF).
Example
Find the state-space representation in phase-variable form for the following transfer function
𝐶(𝑠) 24
= 3
𝑅(𝑠) 𝑠 + 9𝑠 2 + 26𝑠 + 24
Cross-multiplying yields
𝑥1 = 𝑐
𝑥2 = 𝑐̇
𝑥3 = 𝑐̈
𝑦 = 𝑐 = 𝑥1
We draw three integral blocks as shown in figure below and label each output as one of the
state variables, x (t), as shown
Equivalent block diagram showing phase variables
In vector-matrix form
Matlab Code
clc
num=1;
den=[1 9 26 24];
G=tf(num,den)
[A,B,C,D]=tf2ss(num,den)
'statespace'
statespace = ss(Af,Bf,Cf,D)
2- Converting a transfer function with polynomial in numerator
For example, consider a third order SISO system with second-order numerator polynomial
We can write:
Example
Represent the following transfer function in state space. Give your answer in vector-matrix
form.
𝑌(𝑠) 𝑠 2 + 3𝑠 + 7
=
𝑅(𝑠) 𝑠 3 + 6𝑠 2 + 9𝑠 + 24
Writing the
differential equation for the first box:
Thus
'statespace'
statespace = ss(Af,Bf,Cf,D)
Example
Represent the following transfer function in state space. Give your answer in vector-matrix
form.
𝑌(𝑠) 5𝑠 2 + 7𝑠 + 9
=
𝑅(𝑠) 𝑠 2 + 2𝑠 + 15
𝑌(𝑠) −3𝑠 − 66
=5+ 2
𝑅(𝑠) 𝑠 + 2𝑠 + 15
𝑌2 (𝑠) −3𝑠−66
=
𝑅(𝑠) 𝑠 2 +2𝑠+15
𝑥̇ 1 1 𝑥1
] [𝑥 ] + [0] 𝑟
0
[ ]=[
𝑥̇ 2 −15 −2 2 1
𝑥
𝑦2 = [−66 − 3 ] [𝑥1 ] + 0 . 𝑟
2
𝑌1 (𝑠)
=5
𝑅(𝑠)
𝑦 = 𝑦1 + 𝑦2
𝑥̇ 1 1 𝑥1
] [𝑥 ] + [0] 𝑢
0
[ ]=[
𝑥̇ 2 −15 −2 2 1
𝑥
𝑦 = 𝑦1 + 𝑦2 = [−66 − 3] [𝑥1 ] + 5 . 𝑟
2
Converting from a State Space to a Transfer Function
Ex Convert the state space and output equations to a transfer function
Ex: Convert the state space and output equations to a transfer function
MATLAB code
A=[ -4 -1.5 ; 4 0 ];
B=[ 2 ; 0 ];
C=[1.5 0.625];
D=0;
[num,den]= ss2tf(A,B,C,D);
G= tf(num,den)
Conversion between different models using Matlab
Signal-Flow Graphs of State Equations
Example: Draw a signal-flow graph for the following state and output equations:
−2 1 0 0
𝑥̇ = [ 0 −3 1 ] 𝑥 + [0] 𝑟 , 𝑦 = [0 1 0]𝑥
−3 −4 −5 1
--------------------------------------------------------------------------------------
Example: Draw a signal-flow graph for the following state and output equations:
Alternative Representations in State Space
In previews section, systems were represented in state space in phase-variable form.
We will now look at a few representative forms and show how to generate the state-
space representation for each
1- Cascaded Form
The output of each first-order system block has been labeled as a state variable. These state
variables are not the phase variables.
Example
−9 1 0 0
𝑥̇ = [ 0 −8 1 ] 𝑥 + [ 0 ] 𝑟
0 0 −7 10
𝑦 = [1 0 0]𝑥
Example
𝑌(𝑠) 𝑠+3
=
𝑅 (𝑠) (𝑠 + 4)(𝑠 + 5)
𝑥̇ 2 = −4𝑥2 + 𝑟
𝑥̇ 1 = −5𝑥1 + 𝑥2
𝑦 = 𝑥̇ 1 + 3𝑥1 = −5𝑥1 + 𝑥2 + 3𝑥1 = −2𝑥1 + 𝑥2
2- Parallel Form
𝐶(𝑠) 10 5 10 5
= 𝐺 (𝑠) = 3 = − +
𝑅(𝑠) 𝑠 + 24𝑠 2 + 191𝑠 + 504 𝑠 + 7 𝑠 + 8 𝑠 + 9
𝑥̇ 1 = −7𝑥1 + 5𝑟
𝑥̇ 2 = −8𝑥2 − 10𝑟
𝑥̇ 3 = −9𝑥3 + 5𝑟
𝑦 = 𝑥1 + 𝑥2 + 𝑥3
−7 0 0 5
𝑥̇ [ 0 −8 0 ] 𝑥 + [−10] 𝑟
0 0 −9 5
𝑦 = [1 1 1]𝑥
Notes
1. Diagonal system matrix.
2. Each equation is a first order differential equation is only one variable.
3. The equations are said to be decoupled.
Example
3- Phase Variable Form
0 1 0 0
𝑥̇ = [ 0 0 1 ]𝑥 + [ 0 ]𝑟
−504 −191 −24 10
𝑦 = [1 0 0]𝑥
4- Controller Canonical Form
This form is obtained from the phase-variable form simply by ordering the phase variables in
the reverse order. For example, consider the transfer function
numg=[l 7 2];
deng=[l 9 2 6 24];
[Acc,Bcc, Ccc, Dec] = tf 2ss(nurag, deng)