Part 2 State Space Control LTI Systems V3
Part 2 State Space Control LTI Systems V3
Can be used: a) To represent non-linear systems that have backlash, saturation, dead zone.
b) It can handle systems with nonzero initial conditions.
c) Multiple-inputs, multiple-outputs systems can easily be represented.
d) Many commercial software packages are available.
State-space approach is rich in information (state variable) with regards to the transfer function
which is considered as a black Box
3
The General State-Space Representation
Some Terminology
none of the variables can be written as
• Linear combination: (of 𝑛 variables 𝑥𝑖 ) a linear combination of the others.
• Linear independence: S is zero if every 𝐾𝑖 is zero and no 𝑥𝑖 is zero: variables 𝑥𝑖 are linearly independent.
• System variable: Any variable that responds to an input or initial conditions in a system.
• State variables: The smallest set of linearly independent system variables that completely determines (knowing the value at
𝑡0) the value of system variables for 𝑡 ≥ 𝑡0
• State vector: A vector whose elements are state variables.
• State space: The 𝑛-dimensional space whose axes are the state variables.
• State equations: A set of 𝑛 simultaneous, first-order differential equations with 𝑛 variables (state variables).
• Output equation: The equation that expresses the output variables of a system as linear combinations of the state variables and
the inputs.
4
State-space Representation
• A system is represented in state-space by the following equations: 𝑥: 𝑠𝑡𝑎𝑡𝑒 𝑣𝑒𝑐𝑡𝑜r
𝑥:ሶ 𝑑𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒 𝑜𝑓 𝑡ℎ𝑒 𝑠𝑡𝑎𝑡𝑒 𝑣𝑒𝑐𝑡𝑜𝑟 𝑤. 𝑟. 𝑡. 𝑡𝑖𝑚𝑒
𝑦: 𝑂𝑢𝑡𝑝𝑢𝑡 𝑣𝑒𝑐𝑡𝑜𝑟
𝑥ሶ = 𝐴 𝑥 + 𝐵 𝑢 State equation 𝑢: 𝑖𝑛𝑝𝑢𝑡 𝑜𝑟 𝑐𝑜𝑛𝑡𝑟𝑜𝑙 𝑣𝑒𝑐𝑡𝑜𝑟
ቊ 𝐴: 𝑠𝑦𝑠𝑡𝑒𝑚 𝑚𝑎𝑡𝑟𝑖𝑥
𝑦 = 𝐶 𝑥 + 𝐷 𝑢 Output equation 𝐵: 𝑖𝑛𝑝𝑢𝑡 𝑚𝑎𝑡𝑟𝑖𝑥
𝐶: 𝑜𝑢𝑡𝑝𝑢𝑡 𝑚𝑎𝑡𝑟𝑖𝑥
𝐷: 𝑓𝑒𝑒𝑑𝑓𝑜𝑟𝑤𝑎𝑟𝑑 𝑚𝑎𝑡𝑟𝑖𝑥
• This representation of a system provides complete knowledge of all variables of the system at any 𝑡 ≥ 𝑡0
• is not unique.
• The choice of state variables: • minimum number (equals the order of the differential equation).
• are linearly independent.
Problem:
Given the following system:
Set the system on the following state-space form:
Solution:
State-space model:
5
Example-1: State-space Representation
Problem:
Find a state-space representation of the following electrical network if
the output is 𝑖𝑅 the current through the resistor, (𝑣(𝑡) is the input).
Solution:
The following steps will yield a viable (practicable) representation of the network in state space.
Step 1: Label all the branch currents in the network (These include 𝑖𝐿 , 𝑖𝑅 , and 𝑖𝐶 ).
Step 2: Select the state variables (quantities that are differentiated 𝑣𝐶 and 𝑖𝐿 , energy-storage elements, the inductor L and the
capacitor C) and write derivative equations.
𝑠𝑡𝑎𝑡𝑒
𝑣𝑒𝑐𝑡𝑜r
𝑣𝐶 𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒 𝑣ሶ𝑐
𝑥= 𝐼 𝑥ሶ =
𝐿 𝐼𝐿ሶ
Step 3: Express non-state variables (right-hand side: 𝑖𝐶 and 𝑣𝐿 ) as a linear combinations of the state variables (differentiated
variables: 𝑣𝐶 and 𝑖𝐿 ) and the input, 𝑣 𝑡 .
𝑣𝑅 = 𝑣𝐶 .
𝑖𝑐 = 𝑓(𝑣𝐶 , 𝑖𝐿 , 𝑣) Apply Kirchhoff’s voltage and current laws, to obtain 𝑖𝐶 and
𝑣𝐿 in terms of the state variables, 𝑣𝐶 and 𝑖𝐿 and the input 𝑣(𝑡).
𝑣𝐿 = 𝑓(𝑣𝐶 , 𝑖𝐿 , 𝑣)
6
Example-1: State-space Representation-contd.
Step 4: Obtain state equations: (by substituting the values and rearranging)
Matrix Form
𝑑𝑣𝐶 1 1
=− ∙ 𝑣𝐶 + ∙ 𝑖 + 0 ∙ 𝑣(𝑡)
𝑑𝑡 𝑅𝐶 𝐶 𝐿 State
𝑑𝑖𝐿 1 1 equation
=− ∙ 𝑣 + 0 ∙ 𝑖𝐿 + ∙ 𝑣(𝑡)
𝑑𝑡 𝐿 𝐶 𝐿
𝑖𝑅 = and 𝑣𝑅 = 𝑣𝑐
𝑅
Final result: Convert into vector-matrix form
𝑥ሶ = 𝐴 𝑥 + 𝐵 𝑢
ቊ
𝑦 =𝐶𝑥+𝐷𝑢
7
Example-2: State-space Representation
(Translational Mechanical System)
For M1:
Time domain
(1)
For M2:
State vector State equations:
𝑥1 𝑥ሶ 1 (3)
(2)
𝑣 𝑣ሶ
𝑋 = 𝑥1 𝑋ሶ = 1 1 , (4)
2 𝑥ሶ 2
Let, 𝑣2 𝑣ሶ 2
(5)
(acceleration = derivative of velocity)
2 , (6)
Select x1, x2, v1, v2 as state variables. matrix form.
𝑑𝑥1 𝑑2 𝑥1 𝑑𝑣1 𝑥ሶ 1
0 1 0 0
𝑥1 0
= 𝑣1 (3) = = 𝑣ሶ1 (4) 𝑣ሶ 1 − 𝐾ൗ𝑀 − 𝐷ൗ𝑀 + 𝐾ൗ𝑀 0 𝑣 0
𝑑𝑡 𝑑𝑡 2 𝑑𝑡 = 1 1 1 1
+ 0 𝑓(𝑡)
𝑥ሶ 2 0 0 0 1 𝑥2
1ൗ
𝑋ሶ = 𝐴 𝑋 + 𝐵 𝑈
𝑑𝑥2 𝑑2 𝑥2 𝑑𝑣2 𝑣ሶ 2 𝐾ൗ
𝑀2 0 − 𝐾ൗ𝑀 0 𝑣2 𝑀2
= 𝑣2 (5) = = 𝑣ሶ 2 (6) 2
𝑑𝑡 𝑑𝑡 2 𝑑𝑡 8
Converting a Transfer Function to State Space
Phase variables: A set of state variables where each state variable is defined to be the derivative of the previous state variable.
Choose the output, y(t), and its derivatives as the state variables, 𝑥𝑖 .
9
Converting a Transfer Function to State Space
matrix form,
output 𝑥1
𝑥ሶ1 𝑥1 0 𝑥2
𝑥ሶ 2 𝑥2 0 𝑥3
𝑥ሶ 3 𝑥3 0 𝑢 𝑦= 1 0 0 … 0 ⋮
= ⋮ + ⋮
⋮ 𝑥𝑛−1
𝑥ሶ 𝑛−1 𝑥𝑛−1 0 𝑥𝑛
𝑥ሶ 𝑛 𝑥𝑛 𝑏0
PROBLEM: Find the state-space representation in phase-variable form for the transfer function
10
Converting a Transfer Function to State Space
Converting a Transfer Function to State Space
Converting a Transfer Function to State Space Cont.
Converting a Transfer Function to State Space Cont.
4. State Space Representation to Transfer Function
Example: find out how many poles are in the left half-plane, in the right half-plane, and on the 𝑗𝜔-axis.
We have to determine the the characteristic equation of the system and afterwards, use the Routh Hurwitz creteria.
18
5- Time domain solution of state equations
SOLUTION:
• 5- Time domain solution of state equations cont
5- Time Domain Solution of State Equations
5- Time Domain Solution of State Equations
Time Domain Solution of State Equations
6 - Controllability and Observability
• 6-1 Controllability
Note that The maximum number of linearly independent columns (or rows ) of a matrix is called the rank of a matrix.
Using MATLAB rank of Cm =rank(Cm)
Example:
Feedback Control using Pole Placement
• Solution
1- The desired C. E. 𝑠 3 +69 𝑠 2 + 1179 𝑠 + 10094. 2- The third pole is chosen at (-10) to eliminate the zero. The
The C.E. with feedback control: 𝑢 𝑡 = −𝐾 𝑥 𝑡 + 𝑟 𝑡 Desired C.E. is 𝑠 3 + 29.74 𝑠 2 + 401.9 𝑠 + 2045.4= D𝑒𝑡(𝑆𝐼 −
D𝑒𝑡(𝑆𝐼 − 𝐴 − 𝐵𝐾 = 𝑠 3 + 15 + 𝐾3 𝑠 2 + 36 + 𝐾2 𝑠 + 𝐾1 𝐴 − 𝐵𝐾 = 𝑠 3 + 15 + 𝐾3 𝑠 2 + 36 + 𝐾2 𝑠 + 𝐾1
= 𝑠 3 +69 𝑠 2 + 1179 𝑠 + 10094 The gain K is 𝐾 = 2045.4 365.9 14.7
The gain K is 𝐾 = 10094 1143 54 ; We use MATLAB to check the obtained result:
We use MATLAB to check the obtained result: >>A=[0 1 0;0 0 1;0 -36 -5];B=[0;0;1];K= 2045.4 365.9 14.7
>>A=[0 1 0;0 0 1;0 -36 -15];B=[0;0;1];K=[10094 1143 54]; >> eig(A-B*K)-→poles are {-9.96, -986j 10.38}
>> eig(A-B*K)-→poles are {-49.2096, −9.89 ±j 10.35} The step response is given in the nest slide
The step response is given in the nest slide
Feedback Control using Pole Placement: MATLAB Simulation of the step response
MATLAB Code: MATLAB Code:
>> A=[0 1 0;0 0 1;0 -36 -15];B=[0;0;1];K=[10094 1143 54]; >> A=[0 1 0;0 0 1;0 -36 -15];B=[0;0;1];K= [2045.4 365.9 14.7]
>> C=[1000 100 0]; >> C=[1000 100 0]; [a,b]=ss2tf(A-B*K,B,C,0);
>> [a,b]=ss2tf(A-B*K,B,C,0); >> sys=tf(a,b)
>> sys=tf(a,b) sys =
sys =
100 s + 1000 100 s + 1000
-------------------------------- -------------------------------
s^3 + 69 s^2 + 1179 s + 1.009e04 s^3 + 29.7 s^2 + 401.9 s + 2045
Continuous-time transfer function. Continuous-time transfer function.
>> step(sys) >> step(sys)
The achieved overshoot is 21.6% and Tp=0.126s The achieved overshoot is4.99 % and Tp=0.3s
Feedback Control using Pole Placement for systems under general form
Assume that the physical system is not under the phase-variable form or canonical form, and it requires feedback from state
Variable. For these systems we have some choices for a design methodology:
1- Controller Design by Matching Coefficients
MATLAB Simulation:
>> sys=tf(10,conv([1 1],[1 2]));
>> [A,B,C,D]= tf2ss(10, conv([1 1],[1 2]));
>> p=roots([1 16 239.5]); % the desired poles
>> K=place(A,B,p);
>> sys_cl=ss(A-B*K,B,C,D);
>> step(sys_cl) % Step response of closed loop system
K= 13.0000 237.5000
Or
If the eigenvalues of (A-LC) are all negative, the estimated state vector error ex, and output error will decay to
zero. Note that the poles of observer should be faster (10 times) than the control poles.
When the system is given under observable form with 𝑦 = 𝑥1
The solution is
Note that, when the system is not under the observable form,
we use the same steps as for the pole placement method.
The transformation
Observer Design: Example
RELATIONSHIP AMONG CONTROLLABILITY, OBSERVABILITY, AND TRANSFER FUNCTIONS
where T(s) is the closed-loop transfer function. The error can be written as:
we obtain
But
Steady-State Error Design via Integral Control: Example
Steady-State Error Design via Integral Control: Example
8- Discrete-time state space equations
𝑡
The solution of state equation of is 𝒙 𝑡𝑓 = 𝑒 𝐴 𝑡𝑓 −𝑡0
𝒙 𝑡0 + 𝐴 𝑒 𝑓 𝑡 𝑡𝑓 −𝜏
𝐵𝒖 𝜏 𝑑𝜏
0
Obtain difference equation from the solution of the analog state, over a sampling period 𝑇. Initial time 𝑡0 = 𝑘𝑇,
and final time 𝑡𝑓 = 𝑘 + 1 𝑇 :
𝑘+1 𝑇
𝒙 𝑘 + 1 = 𝑒 𝐴𝑇 𝒙 𝑘 + 𝑇𝑘 𝑒𝐴 𝑘+1 𝑇−𝜏 𝐵𝒖 𝜏 𝑑𝜏 with 𝒙 𝑘 = 𝒙 𝑘𝑇 = state vector at time 𝑘𝑇
𝒖 𝑡 =𝒖 𝑘 , 𝑘𝑇 ≤ 𝑡 ≤ 𝑘 + 1 𝑇
• Move input outside the integral
𝑘+1 𝑇
𝒙 𝑘+1 = 𝑒 𝐴𝑇 𝒙 𝑘 + න 𝑒𝐴 𝑘+1 𝑇−𝜏 𝐵𝑑𝜏 𝒖 𝑘
𝑘𝑇
• Discrete-time state equation
𝒙 𝑘 + 1 = 𝐴𝑑 𝒙 𝑘 + 𝐵𝑑 𝒖 𝑘
𝑇
𝐴𝑑 = 𝑒 𝐴𝑇 , 𝐵𝑑 = න 𝑒 𝐴𝜆 𝐵𝑑𝜆
0
Discrete-time state space equations
• Change of variable of integration
0, 𝜏 = 𝑘 + 1 𝑇
𝜆 = 𝑘 + 1 𝑇 − 𝜏, 𝜆 = ቊ ; 𝑑𝜆 = −𝑑𝜏
𝑇, 𝜏 = 𝑘𝑇
𝑘+1 𝑇 0 𝑇
න 𝑒𝐴 𝑘+1 𝑇−𝜏 𝐵𝑑𝜏 = න 𝑒 𝐴𝜆 𝐵 −𝑑𝜆 = න 𝑒 𝐴𝜆 𝐵𝑑𝜆
𝑘𝑇 𝑇 0
Or in compact form:
𝒙 𝑘 + 1 = 𝐴𝑑 𝒙 𝑘 + 𝐵𝑑 𝒖 𝑘 , 𝑘 = 0,1, …
𝑇
𝐴𝑑 = 𝑒 𝐴𝑇 , 𝐵𝑑 = 0 𝑒 𝐴𝜏 𝐵𝑑𝜏 ; 𝒚 𝑘 = 𝐶𝒙 𝑘 + 𝐷𝒖 𝑘
• 𝐴𝑑 = 𝑛 × 𝑛 discrete state matrix ; 𝐵𝑑 = 𝑛 × 𝑚 discrete input matrix (same orders as their continuous
counterparts).
• Discrete state matrix = state transition matrix of the analog system evaluated at the sampling period 𝑇.
• Properties of the matrix exponential: integral of the matrix exponential for invertible matrix 𝐴
𝑇
𝑡𝐴 𝑒 = 𝐴−1 𝑒 𝐴𝑡 = 𝑒 𝐴𝑡 𝐴−1 = −1 𝐴𝑡
𝐴 𝑒 ቚ = 𝐴−1 𝑒 𝐴𝑇 − 1
0
𝐵𝑑 = 𝐴−1 𝑒 𝐴𝑇 − 𝐼𝑛 𝐵 = 𝑒 𝐴𝑇 − 𝐼𝑛 𝐴−1 𝐵
Discrete-time state space equations
• Discrete state & output equation.
• Discrete-time state equation: approximately valid for a general input vector 𝒖 𝑡 provided that the sampling period 𝑇
is sufficiently short: 𝒙 𝑘 + 1 = 𝐴𝑑 𝒙 𝑘 + 𝐵𝑑 𝒖 𝑘
• Output equation evaluated at time 𝑘𝑇: 𝒚 𝑘 = 𝐶𝒙 𝑘 + 𝐷𝒖 𝑘
• Example: Find the discrete-time state space model of a continuous-time system
State-space to transfer function
𝟏𝟎
Problem: Given a plant 𝑮 𝒔 = ; design a discrete
(𝒔+𝟏)(𝒔+𝟐)
state feedback to yield a 15% overshoot with a settling time
Of 0.5s.
𝒙 2 = 𝐴2𝑑 𝒙 0 + 𝐴2−𝑖−1
𝑑 𝐵𝑑 𝒖 𝑖
a= >> ad = expm(A * 0.01)
𝑖=0
𝑘−1
x1 x2 𝒙 𝑘 = 𝐴𝑘𝑑 𝒙 0 + 𝐴𝑘−𝑖−1 𝐵𝑑 𝒖 𝑖
x1 1.01 0.02051 𝑑
x2 0.03076 1.041 ad = 𝑖=0 𝑘−1
𝑘−𝑘0
b= 𝒙 𝑘 = 𝐴𝑑 𝒙 𝑘0 + 𝐴𝑘−𝑖−1
𝑑 𝐵𝑑 𝒖 𝑖
u1 𝑖=𝑘0
x1 0.0001017 1.0104 0.0205
x2 0.0102 0.0308 1.0411 • State-transition matrix for the DT system.
c= >>bd = A\ (ad-eye(2) )* B • State-transition matrix for time-varying DT system:
x1 x2 • not a matrix power
y1 1 1 • dependent on both time 𝑘 and initial time 𝑘0 .
bd =
d= • Solution=zero-input response+ zero-state response
u1 • Substitute in output equation
y1 0 0.0001 𝑘−1
Thus, the system can be represented as f (x)= 5 δx for small excursions of x about π=2.
9.2 Linearization of a nonlinear system
𝑑𝑥(𝑡)
let us represent a nonlinear system by the following vector-matrix state equations: = 𝑓(𝑥 𝑡 , 𝑢(𝑡)
𝑑𝑡
where x(/) represents the n x l state vector; u(t), the p x 1 input vector; and 𝑓(𝑥 𝑡 , 𝑢(𝑡) ], an n x I function vector. In
general, f is a function of the state vector and the input vector.
2
As a simple example, the following nonlinear state equations are given: ቊ 𝑥ሶ 1 = 𝑥1 + 𝑥2
𝑥ሶ = 𝑥1 + 𝑢(𝑡)
Using the Taylor approximation, the system can be linearized around 𝑋0 , 𝑈0 2
𝑛 𝑝
𝜕𝑓𝑖 (𝑥, 𝑢) 𝜕𝑓𝑖 (𝑥, 𝑢)
∆𝑋ሶ = 𝐴 ∆𝑋 + 𝐵 ∆𝑈 or ∆𝑋ሶ = อ ∆𝑥𝑗 + อ ∆𝑢𝑗 +
𝜕𝑥𝑗 𝜕𝑢𝑗
𝑗=1 𝑥0 ,𝑢0 𝑗=1 𝑥0,𝑢0
For example for n=3 and p=2 may be written in vector-matrix form:
9.2 Linearization of a nonlinear system: Example
Solution: The nonlinear state space representation
Another example:
Where
9.2 Linearization of a nonlinear system: Example
Ball-suspension system. The state equations are
Mathematical model:
Solution: