Ece451 Lec 2
Ece451 Lec 2
𝑋1 , 𝑋2 , … … … , 𝑋𝑛
State
x1 a 11 a 12 a 1n x1
b11 b1m u1
a 2n x 2
d x 2 a 21 a 22
dt
b n1 b nm u m
x n a n1 a n2 a nn x n
The column matrix consisting of the state variables is called the state vector
and is written as
x1
x
x 2
x n
• The outputs y1(t), y2(t), ……… yl(t) of the system may
be given by
y1
y
Y (t ) 2 output vector
yl
x A x B u
This differential equation is also commonly called the state equation. The
matrix A is an nxn square matrix, and B is an nxm matrix. The state differential
equation relates the rate of change of the state of the system to the state of the
system and the input signals. In general, the outputs of a linear system can be
related to the state variables and the input signals by the output equation
y C xDu
Where y is the set of output signals expressed in column vector form. The
state-space representation (or state-variable representation) is comprised of
the state variable differential equation and the output equation.
State Space Representation
• A continuous linear time invariant state space model takes the
following form:
But , i t c dvc dt
i Vc vt
di R 1 1 dVc 1
And , i (t )
dt L L L dt c
x1 (t ) x1 x2 u t
R 1 1 1
x2 (t ) x1
L L L c
y vR t Ri (t )
For an RLC Circuit:
x Ax Bu u vt
i (t ) di dt
x(t ) x
Vc(t ) dVc dt
R / L 1 / L 1 L
A B
1/ C 0 0
y Cx Du y vR t Ri (t )
C R 0 D0
Example-2
• Consider the mechanical system shown in figure. We assume that the system is linear. The
external force u(t) is the input to the system, and the displacement y(t) of the mass is the
output. The displacement y(t) is measured from the equilibrium position in the absence of the
external force. This system is a single-input, single-output system.
𝑚𝑦(𝑡)
ሷ + 𝑏𝑦(𝑡)
ሶ + 𝑘𝑦(𝑡) = 𝑢(𝑡)
𝑥1 𝑡 = 𝑦(𝑡)
𝑥2 𝑡 = 𝑦(𝑡)
ሶ
Example-2
𝑥1 𝑡 = 𝑦(𝑡) 𝑥2 𝑡 = 𝑦(𝑡)
ሶ 𝑚𝑦(𝑡)
ሷ + 𝑏𝑦(𝑡)
ሶ + 𝑘𝑦(𝑡) = 𝑢(𝑡)
• Then we obtain
𝑥ሶ 1 𝑡 = 𝑥2 (𝑡)
𝑏 𝑘 1
𝑥ሶ 2 𝑡 = − 𝑦ሶ 𝑡 − 𝑦 𝑡 + 𝑢 (𝑡)
𝑚 𝑚 𝑚
• Or
𝑥ሶ 1 𝑡 = 𝑥2 (𝑡)
𝑏 𝑘 1
𝑥ሶ 2 𝑡 = − 𝑥2 𝑡 − 𝑥1 𝑡 + 𝑢 (𝑡)
𝑚 𝑚 𝑚
• The output equation is
𝑦 𝑡 = 𝑥1 𝑡
Example-2
𝑏 𝑘 1
𝑥ሶ 1 𝑡 = 𝑥2 (𝑡) 𝑥ሶ 2 𝑡 = − 𝑥2 𝑡 − 𝑥1 𝑡 + 𝑢 (𝑡) 𝑦 𝑡 = 𝑥1 𝑡
𝑚 𝑚 𝑚
• In a vector-matrix form,
x1 (t ) 0 1 x (t ) 0
x (t ) k b 1 1 u (t )
x2 (t )
2 m m m
x1 (t )
y (t ) 1 0
2
x (t )
Example-2
• State diagram of the system is
𝑥ሶ 1 𝑡 = 𝑥2 (𝑡)
𝑏 𝑘 1
𝑥ሶ 2 𝑡 = − 𝑥2 𝑡 − 𝑥1 𝑡 + 𝑢 (𝑡)
𝑚 𝑚 𝑚
𝑦 𝑡 = 𝑥1 𝑡
-k/m
-b/m
1/m 𝑥ሶ 2 𝑥1
𝑢(𝑡) 1/s 1/s 𝑦(𝑡)
𝑥2 = 𝑥ሶ 1
Example-2
• State diagram in signal flow and block diagram format
-k/m
-b/m
1/m 𝑥ሶ 2 𝑥1
𝑢(𝑡) 1/s 1/s 𝑦(𝑡)
𝑥2 = 𝑥ሶ 1
Liquid Level System
Example-3
∵ 𝒊𝒏𝒑𝒖𝒕 𝒒𝒊 𝒕
output 𝒒𝒐 𝒕
𝒅 𝑪 𝟏 𝒉𝟏 𝒕 ሶ
𝒒𝒊 𝒕 − 𝒒𝟏 𝒕 = = 𝑪𝟏 𝒉𝟏 𝒕 ....(1)
𝒅𝒕
𝟏
𝒒𝟏 𝒕 = 𝒉𝟏 𝒕 − 𝒉𝟐 𝒕 .................................(2)
𝑹𝟏
𝒅 𝑪 𝟐 𝒉𝟐 𝒕 ሶ
𝒒𝟏 𝒕 − 𝒒𝒐 𝒕 = = 𝑪𝟐 𝒉𝟐 𝒕 ....(3)
𝒅𝒕
𝒉 𝒕
𝒒𝒐 𝒕 = 𝟐 ................(4)
𝑹𝟐
𝒅 𝑪 𝟐 𝒉𝟐 𝒕 dh2 1 1 1
𝒒𝟏 𝒕 − 𝒒𝒐 𝒕 = = 𝑪 𝟐 𝒉𝟐 ሶ 𝒕 h1 ( )h2
𝒅𝒕 dt c2 R1 c2 R1 c2 R2
1 1 1
𝒉𝟐 𝒕 x2 (t ) x1 ( ) x2
𝒒𝒐 𝒕 = 𝑹𝟐
c2 R1 c2 R1 c2 R2
1 1
1
x1 (t )
c1 R1 c1 R1 x1 (t )
x (t ) c1 u (t )
x2 (t ) 1 1 1 2
c R -( ) 0
2 1 c2 R1 c2 R2
1
qo (t ) x2 (t )
R2
1 x1 (t )
y (t ) 0
R2 x2 (t )
ANALYSIS OF STATE VARIABLE MODELS USING MATLAB
x Ax Bu Y(s) G(s)U(s)
x Ax Bu y Cx Du
State-space object
y Cx Du
sys_ss=ss(sys_tf)
sys_tf=tf(sys_ss)
sys=ss(A,B,C,D) x Ax Bu
Y(s) G(s)U(s)
y Cx Du
The ss function
Y(s) 2 s2 8 s 6
G(s)
R (s) s3 8 s 2 16 s 6
b=
8 4 1.5 2
u1
x1 2
A 4 0 , B 0
x2 0
0 x3 0
0 0 0
c=
1 y1
x1 x2 x3
1 1 0.75
d=
Continuous-time model.
8 4 1.5 2
A 4 0 0 , B 0
0 1 0 0
1
R(s) x1 x2
x3 Y(s)
2 1/s 4 1/s 1 1/s 0.75
-8
-4
-1.5