State-Space Models and The Discrete-Time Realization Algorithm
State-Space Models and The Discrete-Time Realization Algorithm
micro− physics−
physics-
molecular continuum− cell scale
(particle−) based based
scale PDEs scale PDEs scale PDEs ODEs predictions modeling
direct parameter direct parameter volume created via model−
measurement measurement averaging order reduction
■ Then
⎡ ⎤ ⎡ ⎤⎡ ⎤ ⎡ ⎤
v[k + 3] −a1 −a2 −a3 v[k + 2] 1
⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥
x[k +1] = ⎣ v[k + 2] ⎦ = ⎣ 1 0 0 ⎦ ⎣ v[k + 1] ⎦ + ⎣ 0 ⎦ u[k].
v[k + 1] 0 1 0 v[k] 0
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–4
) *
■ We now add zeros, G(z) = b1 z 2 + b2 z + b3 G p (z). Equivalently,
+ 2 ,
Y (z) = b1 z + b2 z + b3 V (z),
■ Note: There are many other equally valid state-space models of this
particular transfer function. We will soon see how they are related.
■ Many discrete-time transfer functions are not strictly proper. Solve by
polynomial long division, and setting D equal to the quotient.
■ MATLAB command [A,B,C,D]=tf2ss(num,den,Ts) converts a
rational-polynomial transfer function form to state-space form.
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–5
5.2: Working with state-space systems
■ So,
Y (z)
G(z) = = C(z I − A)−1 B + D.
U(z)
adj(z I − A)
■ Note that (z I − A)−1 = , so we can write a system’s
det(z I − A)
transfer function as
C adj(z I − A)B + D det(z I − A)
G(z) = .
det(z I − A)
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–6
■ Extremely important observation: The poles of the system are where
det(z I − A) = 0, which (by definition) are the eigenvalues of A.
Transformation
■ State-space representations of a particular system’s dynamics are
not unique. Selection of state x[k] is somewhat arbitrary.
■ To see this, analyze the transformation of
x[k + 1] = Ax[k] + Bu[k]
= C T T −1(z I − A)−1 T T −1 B + D
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–7
EXAMPLE :
Consider transforming the system
⎡ ⎤ ⎡ ⎤
−a1 −a2 −a3 1 ⎡ ⎤
⎢ ⎥ ⎢ ⎥ 0 0 1
A=⎣ 1 0 0 ⎦, B = ⎣ 0 ⎦,
⎢ ⎥
0 1 0 0 with T = T −1 = ⎣ 0 1 0 ⎦.
! " ! " 1 0 0
C = b1 b2 b3 , D= 0
■ Note that multiplying on the right by T flips the original entries left-to-
right; multiplying on the left flips the original entries top-to-bottom.
■ So, for this transformation matrix, we get:
⎡ ⎤⎡ ⎤⎡ ⎤
0 0 1 −a1 −a2 −a3 0 0 1
⎢ ⎥⎢ ⎥⎢ ⎥
Ā = T −1 AT = ⎣ 0 1 0 ⎦ ⎣ 1 0 0 ⎦⎣ 0 1 0 ⎦
1 0 0 0 1 0 1 0 0
⎡ ⎤
0 1 0
⎢ ⎥
=⎣ 0 0 1 ⎦
−a3 −a2 −a1
⎡ ⎤⎡ ⎤ ⎡ ⎤
0 0 1 1 0
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
B̄ = T −1 B = ⎣ 0 1 0 ⎦ ⎣ 0 ⎦ = ⎣ 0 ⎦
1 0 0 0 1
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–8
⎡ ⎤
! " 0 0 1 ! "
⎢ ⎥
C̄ = C T = b1 b2 b3 ⎣ 0 1 0 ⎦ = b3 b2 b1
1 0 0
D̄ = D = 0.
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–9
5.3: Discrete-time Markov parameters
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–10
g k = { D, C B, C AB, C A2 B, . . .}
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–11
Unit-pulse response of sample system
1.0
■ MATLAB’s impulse.m
command confirms this result:
A = [0.5 0; 0 1];
Value
0.5
B = [1 ; 0];
C = [1 -1]; D = 0;
sys = ss(A,B,C,D,-1);
y = impulse(sys,0:15);
stem(0:15,y,'filled'); 0
0 5 10 15
Time (samples)
Before proceeding...
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–12
5.4: Equations describing the solid dynamics
<s,e (s)/J (s)
Finding the transfer function C
■ To find the transfer function for cs , we follow the approach by
Jacobsen and West1
■ We start with the underlying partial-differential equation,
= >
∂cs (r, t) 1 ∂ ∂c s (r, t)
= 2 Ds r 2 ,
∂t r ∂r ∂r
with standard boundary conditions,
∂cs (0, t) ∂cs (Rs , t)
Ds = 0, and Ds = − j (t), t ≥ 0,
∂r ∂r
and with initial equilibrium concentration,
cs (r, 0) = cs,0, 0 ≤ r ≤ Rs .
■ Note that we run into problems solving this PDE directly if cs,0 ̸= 0.
■ So, to enforce a homogeneous PDE in later steps, we define
c̃s (r, t) = cs (r, t) − cs,0. The “tilde” notation denotes the difference
between an absolute quantity and its equilibrium set-point.
■ If we assume constant Ds , the differential equations become:
= >
∂ c̃s (r, t) Ds ∂ ∂ c̃ s (r, t)
= 2 r2 ,
∂t r ∂r ∂r
with boundary conditions,
∂ c̃s (0, t) ∂ c̃s (Rs , t)
Ds = 0, and Ds = − j (t), t ≥ 0,
∂r ∂r
and with initial equilibrium concentration,
c̃s (r, 0) = 0, 0 ≤ r ≤ Rs .
1
Jacobsen, T., and West, K., “Diffusion Impedance in Planar, Cylindrical and Spherical
Symmetry,” Electrochimica Acta, 40(2), 1995, pp. 255–62.
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–13
■ We continue by taking the Laplace transform of the PDE:
= >
D
<s (r, s) − c̃0 = s ∂ 2 ∂ <s (r, s)
sC 2
r C
r ∂r ∂r
= < 2< >
D
<s (r, s) = s 2r s∂ C (r, s) 2 ∂ C s (r, s)
sC 2
+ r 2
.
r ∂r ∂r
■ This is a 2nd-order ordinary differential equation in r, which may be
written
∂ 2C <s (r, s)
<s (r, s) 2 ∂ C s <
+ − C s (r, s) = 0.
∂r 2 r ∂r Ds
■ This homogeneous differential equation has a solution of the form
= ? > = ? >
A
<s (r, s) = exp r s B s
C + exp −r
r Ds r Ds
A B
= exp(β(r)) + exp(−β(r)),
r r
@
where we define β(r) = r s/Ds . We note that β(r) is also a function
of s, but we omit this dependence in the notation for compactness.
■ The constants A and B are chosen to satisfy the boundary conditions.
■ Consider first the outer boundary condition at r = Rs , which is
A
∂ c̃s (r, t) AA
Ds = − j (t).
∂r Ar =Rs
■ The equivalent Laplace-domain boundary condition is
A
<s (r, s) A
∂C
Ds A = −J (s).
∂r Ar =Rs
■ <s (r, s)/∂r
To substitute this in, we will need to compute ∂ C
B
<s (r, s)
∂C A Ds s r exp(β(r)) − B exp(−β(r))
=
∂r r2
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–14
B
s
A exp(β(r)) + B Ds
r exp(−β(r))
−
r2
A(β(r) − 1) exp(β(r)) − B(1 + β(r)) exp(−β(r))
= .
r2
■ We substitute r = Rs and the boundary condition
A
<s (r, s) A
∂C A(β(Rs ) − 1) exp(β(Rs )) − B(1 + β(Rs )) exp(−β(Rs ))
A =
∂r A r =Rs R2 s
J (s) A(β(Rs ) − 1) exp(β(Rs )) − B(1 + β(Rs )) exp(−β(Rs ))
− = .
Ds Rs2
■ This gives us an expression for J (s),
Ds
J (s) = − 2 ( A(β(Rs ) − 1) exp(β(Rs )) − B(1 + β(Rs )) exp(−β(Rs ))) .
Rs
■ If we immediately substitute the second boundary condition at r = 0,
we run into some divide-by-zero issues.
■ So, instead, we substitute r = rδ , which we think of as a very small
value. We will then later take the limit as rδ → 0.
A(β(rδ ) − 1) exp(β(rδ )) − B(1 + β(rδ )) exp(−β(rδ ))
0= .
rδ2
■ This allows us to write
A(β(rδ ) − 1) exp(β(rδ )) B(1 + β(rδ )) exp(−β(rδ ))
=
rδ2 rδ2
(1 + β(rδ )) exp(−β(rδ ))
A=B .
(β(rδ ) − 1) exp(β(rδ ))
■ We now take the limit as rδ → 0, and find that A = −B.
■ <s (s, r)/J (s)
We are now ready to construct the transfer function C
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–15
<s (r, s) −Rs2 C
C A exp(β(r))+B exp(−β(r))
D
=
J (s) Ds r A(β(Rs )−1) exp(β(Rs ))−B(1+β(Rs )) exp(−β(Rs ))
C DC D
−Rs2 A exp(β(r))− exp(−β(r))
=
Ds r −A (1−β(Rs )) exp(β(Rs ))−(1+β(Rs )) exp(−β(Rs ))
C D
Rs2 exp(β(r))− exp(−β(r))
= .
Ds r (1−β(Rs )) exp(β(Rs ))−(1+β(Rs )) exp(−β(Rs ))
■ This expression can be used to determine the lithium concentration
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–16
5.5: Removing the integrator pole
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–19
5.6: State-space realization problem: Ho–Kalman method
■ For now, we assume that we are able to find the Markov parameters
of our transfer functions.
PROBLEM: Given a system’s Markov parameters, find the system
dimension n and ( A, B, C, D), up to similarity transforms.
■ One of the first (maybe the first) state-space realization methods was
introduced by Ho and Kalman.2
■ It is key to the discrete-time realization algorithm we will develop.
■ Notice that something curious happens when we multiply the
following matrices together:
⎡ ⎤
C
⎢ ⎥
⎢ CA ⎥! "
⎢ ⎥
⎢ C A2 ⎥ B AB A2 B · · · An−1 B =
⎢ ⎥
⎢ ... ⎥- ./ 0
⎣ ⎦ C
C An−1
- ./ 0
O
⎡ ⎤
2 n−1
CB C AB C A B · · · C A B
⎢ ⎥
⎢ C AB C A2 B C A3 B ⎥
⎢ ⎥
⎢ C A2 B C A3 B C A4 B ⎥.
⎢ ⎥
⎢ ... ... ... ⎥
⎣ ⎦
C An−1 B · · · C A2n−2 B
• For reasons beyond the scope of our discussion here, O is called
the “observability matrix” and C is called the “controllability matrix.”
2
B.L. Ho and R.E. Kalman, “Effective Construction of Linear State Variable Models from
Input/Output Functions,” Regelungstechnik, vol. 14, no. 12, pp. 545–8, 1966.
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–20
■ Notice that we get a Hankel matrix—a matrix having constant skew
diagonals (an upside-down Toeplitz matrix).
■ Note also that the values on the skew diagonals are the Markov
parameters of the system (excluding g0 and gk for k > 2n − 1)
⎡ ⎤
g g · · · gn
⎢ 1 2 ⎥
⎢ g2 g3 ⎥
H = OC = ⎢ ⎢ ... ...
⎥
... ⎥ .
⎣ ⎦
gn · · · g 2n−1
■ Ho–Kalman assumes that we know the Markov parameters.
ISSUE I : We don’t know n. So, how do we form H in the first place? That
is, when do we stop adding unit-pulse-response values to H?
! "
' n−1
C= ' B 'A'B ··· '
A ' B
! "
= T B T AT T B · · · (T AT ) T B = T −1C.
−1 −1 −1 −1 n−1 −1
■ ''
Therefore, O C = (OT )(T −1C) = OC
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–22
• For example, we could choose to let O = I, and then C = H. This
will result in an A, B, and C that are in “observability canonical
form.” (cf. ECE5520)
• Or, we could choose to let C = I, and then O = H. This will result
in an A, B, and C that are in “controllability canonical form.”
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–23
5.7: Singular value decomposition
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–24
⎡ ⎤⎡ ⎤
! " !1 0r ×(n−r ) V 1T
A = U1 U2 ⎣ ⎦⎣ ⎦,
0(m−r )×r 0(m−r )×(n−r ) V 2T
where A = U 1! 1 V 1T is the compact SVD.
■ Note that the singular values are related to matrix norm. In particular,
∥ A∥ = σ1.
■ Can view operation y = Ax as y = (U!V T )x, decomposing the
operation into
VT x !V T x
x VT ! U Ax
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–26
5.8: Back to Ho–Kalman
■ Recall Ho–Kalman “ISSUE I,” how do we form the Hankel matrix H if
we don’t know the dimension of the system state n?
■ To address this issue, consider the infinite, skew-diagonal matrix H∞:
⎡ ⎤
g1 g2 g3 g4 · · ·
⎢ ⎥
⎢ g2 g3 g4 g5 · · · ⎥
⎢ ⎥
H∞ = ⎢ g 3 g 4 g 5 g 6 · · · ⎥
⎢
⎥
⎢ ⎥
⎣ g4 g5 g6 g7 · · · ⎦
... ... ... ... . . .
■ The first n non-zero singular values provide insight into model order.
• Problem: Noisy data yields more than n non-zero singular values.
• Need to look at a few and determine when there is a “significant”
drop off in the magnitude of the SVDs.
■ Note that this approach also gives us O k and C l automatically in a
“balanced realization”. Solves “ ISSUE III” and “ISSUE IV ”.
• T must be invertible, but selection of T is otherwise arbitrary.
Usually use T = I.
■ How to decompose further into ( A, B, C) to solve “ISSUE II”?
■ Note the shift property of a Hankel matrix. If we shift H up by one
block row, we get H↑k+1,l = Ok ACl .
⎡ ⎤
g2 g3 g 4 · · · gl+1
⎢ ⎥
⎢ g3 g4 g 5 · · · gl+2 ⎥
⎢ . . . . ⎥
↑ ⎢
Hk+1,l = ⎢ . . .
. .
. . ⎥
.
⎥
⎢ ⎥
⎣ g k g k+1 g k+2 · · · g k+l−1 ⎦
g k+1 g k+2 g k+3 · · · g k+l
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–28
⎡ ⎤
2 3 l
C AB CA B CA B ··· CA B
⎢ ⎥
⎢ C A2 B C A3 B C A4 B C Al+1 B ⎥
⎢ ... ... ... ... ... ⎥
=⎢
⎢
⎥
⎥
⎢ k−1 k k+1 ⎥
⎣ CA B CA B CA B · · · C Ak+l−2 B ⎦
C Ak B C Ak+1 B C Ak+2 B · · · C Ak+l−1 B
= O ↑k+1Cl = Ok Cl+1
←
= O k AC l .
↑
■ Using the pseudo-inverse to solve for A gives A = O †k Hk+1,l C l†.
■ In MATLAB, we can compute either
Ahat = pinv(Ok)*HankelUp*pinv(Cl);
or
Ahat = (Ok\HankelUp)/Cl;
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–29
5.9: Ho–Kalman summary and example
STEP I : Collect the unit-pulse response values into two Hankel matrices
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–30
% Define true system, compute the Markov parameters as "y"
A = [0 1; 1 1]; B = [1; 1]; C = [1 0]; D = 0; dt = 1;
sysTrue = ss(A,B,C,D,dt); % "typical" Fibonacci ss model
y = dt*impulse(sysTrue); % scale by dt to get unit-pulse response
σ1 = 54.56 σ2 = 0.43988 σi = 0, i ≥ 3
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–31
■ Compute the extended observability and controllability matrices
: ;
−0.8507 −1.3764 −2.2270 −3.6034
C l = ! 1/2 V T =
0.5257 −0.3249 0.2008 −0.1241
Ok = U! 1/2 = C lT .
H
D = g0 = 0.
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–32
Pole−zero map Unit-pulse responses
1 25
True system
Estimated system
20
0.5
Imaginary axis
15
Output
0
10
−0.5
5
−1 0
−1 −0.5 0 0.5 1 1.5 2 1 2 3 4 5 6 7 8
Real axis Time step k
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–33
5.10: Discrete-Time Realization Algorithm (DRA)
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–34
Ts
unit−pulse response
unit−pulse function
k−1
F
h step(kT1) = T1 h(i T1).
i =0
3
In order to arrive at an accurate estimation of the continuous time transfer function, the
sampling frequency, F1 = 1/T1 , must be high enough to capture the system dynamics.
As a rule of thumb, the sampling frequency must be at least 20 times the as great as
the bandwidth of the system to get an rough approximation in the frequency domain.
A higher emulation sampling frequency gives more accurate results.
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–36
■ We now recognize that the discrete Fourier transform (DFT) of a
sequence is related to its z-transform via the relationship
A
H [ f ] = H (z) Az=exp( j 2π f /N ) = H (s)|s= 2 ! e j 2π f /N −1 "
T1 e j 2π f /N +1
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–37
5.11: Example 1: Rational polynomial transfer function
10
■ The system bandwidth is on the
5
order of 3 rad s−1 (about 0.5 Hz).
0 −1 0 1 2 3
10 10 10 10 10
−1
Frequency (rad s )
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–38
Hd = (s.^2+20*s+100)./(s.^2+2*s+8); % Hd[f]
hd = real(ifft(Hd)) * F1; % approximation to h(t)
td = T1*(0:N-1); % time vector for h(t)
plot(td,hd,'bx','markersize',8); hold on % plot h(t)
Response
10
continuous-time impulse 5
response of H1(s). 0
−5
■ The solutions are coincident. −10
0 1 2 3 4 5
Time (s)
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–39
STEP 3: We now resample the continuous-time approximate step
response at the final sample rate Ts , and compute the discrete-time
unit-pulse response as h step[k] − h step[k − 1]
Ts = 0.1; tdisc = 0:Ts:6.5; % final time vector
hdisc = [0 diff(interp1(td,hstep,tdisc))]; % h[k]
stem(tdisc,hdisc,'filled'); hold on
[himpDiscTrue,timpDiscTrue] = impulse(c2d(H1,Ts),5);
% next line scales IMPULSE in new MATLAB to give unit-pulse resp.
himpDiscTrue = Ts*himpDiscTrue;
plot(timpDiscTrue,himpDiscTrue,'r.','markersize',8);
axis([-0.01 5 -1 2.6]);
1.5
from old versions for
Response
1
discrete-time systems. 0.5
−0.5
output by Ts to compute the
−1
0 1 2 3 4 5
unit-pulse response that we Time (s)
desire.
■ Again, there is excellent agreement between the approximate
D = g0 = lim H (s).
s→∞
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–40
−5
orders of magnitude greater
than the third, so we select a
−10
reduced-order model
dimension p = 2. −15
0 5 10 15 20 25 30
n
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–41
■ Truncating to the first two states only, the Ho–Kalman algorithm gives
a state-space realization with the following A, B, and C matrices
: ; : ;
0.8656 −0.2367 −1.624 ! "
H
A= ,H
B= , H
C = −1.624 −0.7692 .
0.2367 0.8811 0.7692
■ The H
D matrix is found from the initial value theorem and, for this
example, is H
D = [1].
■ We compare the true discrete-time unit-pulse response and the final
DRA model unit-pulse response:
% next line scales IMPULSE in new MATLAB to give unit-pulse resp.
[himpDRA,timpDRA] = impulse(sysDRA,5); himpDRA = Ts*himpDRA;
stem(timpDRA,himpDRA,'filled'); hold on
plot(timpDiscTrue,himpDiscTrue,'r.','markersize',8);
axis([-0.01 5 -1 2.6]);
calculation of the H
D matrix in 0.5
0
Step 4).
−0.5
−1
0 1 2 3 4 5
Time (s)
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–42
5.12: Example 2: Dealing with a pole in H (s) at the origin
■ This example has a pole in H (s) at s = 0, so is not strictly stable, and
violates the necessary conditions that make the DRA work.
■ However, it is quite simple to deal with this case.
• We first subtract the pole at the origin from the transfer function,
• Then execute the DRA on the residual system,
• Then compute a final discrete-time state-space model that
augments the DRA result with additional dynamics to implement
the function of the s-domain pole at the origin.
■ A pole at the origin is removed by first calculating the residue of this
pole and then subtracting it from the original transfer function.
res0
H ∗ (s) = H (s) − where res0 = lim s H (s).
s s→0
∗
■ The remainder of the DRA is executed using H (s) instead of H (s).
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–43
where dotted lines delineate boundaries between block sub-matrices
of the overall augmented state-space matrices H B aug, and H
Aaug, H C aug .
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–44
Bode magnitude plot for H2 (s) Bode magnitude plot for H2∗ (s)
0 −20
−20
−30
Magnitude (dB)
Magnitude (dB)
−40
−60 −40
−80
−50
−100
−120 −1 0 1 2
−60 −1 0 1 2
10 10 10 10 10 10 10 10
−1 −1
Frequency (rad s ) Frequency (rad s )
Hd = -0.125*(s+6)./(s.^2+6*s+8); −0.02
−0.04
Response
−0.1
computed and plotted. Exact
−0.12 Approximate
0 1 2 3 4 5
Time (s)
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–45
Response
of H2∗(s) is calculated as in the −0.04
−0.06
first example and plotted.
−0.08
−0.1
0 1 2 3 4 5
Time (s)
Discrete-time unit-pulse responses
0
STEP 3: This step response is
Response (×10−3 )
−2
−6
and differenced to yield the
−8
discrete-time unit-pulse
−10
response, plotted in the figure. −12
Exact
Approximate
0 1 2 3 4 5
Time (s)
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–46
10
■ The figure shows close
8
comparison of the unit-pulse 6
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–47
5.13: Example 3: Transcendental transfer function
■ In the first two examples, we used rational polynomials to illustrate the
DRA method where order of the system is known a priori, and the
exact answer could be calculated analytically.
■ We now demonstrate the DRA with an infinite-order distributed-
parameter system: Specifically the Jacobsen–West transfer function
of lithium diffusion in a single particle, where
<s,e (s) C D
C Rs 1
H3(s) = = √ √ ,
J (s) Ds 1 − Rs s/Ds coth(Rs s/Ds )
and where the integrator-removed transfer function is
%C <s,e (s) C <s,e (s) C <s,avg(s)
∗
H3 (s) = = −
J (s) J (s) J (s)
B I B J
s Rs2
Ds
+ 3 − 3Rs Ds coth Rs Ds s
s
= I B I B JJ ,
s Rs 1 − Rs Ds coth Rs Ds s
s
200
120
Magnitude (dB)
Magnitude (dB)
180
160 110
140 100
120
90
100
80 −4 −2 0 2
80 −4 −2 0 2
10 10 10 10 10 10 10 10
−1
Frequency (rad s ) Frequency (rad s−1 )
continuous-time impulse −1
response is shown. −2
Response
−3
Response
−1
■ Again, there is no known exact
solution against which to −1.5
is sampled at Ts = 1 second,
Response
−4
discrete-time unit-pulse −8
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–50
STEP 4. Hankel matrix is formed; Singular values of Hankel matrix for H3*(s)
singular values are plotted. 10
log(σn)
parameter system that actually 0
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–51
■ We demonstrate the the DRA-produced model by simulating a 10 s
discharge pulse where the surface lithium flux (leaving the particle)
was j = 1 × 10−5 mol m−2 s−1, followed by a 10 s rest.
■ The augmented state-space model was simulated with this input to
produce c̃s,e [k], and cs,e [k] was computed as cs,e [k] = c̃s,e [k] + cs,0.
cs0 = 10000;
uk = 1e-5*[ones(1,10),zeros(1,10)];
[cseTilde,tk] = lsim(sysDRA,uk);
cse = cseTilde + cs0;
Concentration (mol/m3)
9990
9980
■ The output of this discrete-time
9970
realization to a 10 second
9960
discharge followed by a 10
9950
second rest is shown. 0 5 10
Time (sec)
15 20
options = odeset('RelTol',1e-8,'AbsTol',1e-10);
sol = pdepe(2,@csefun,@cseic,@csebc,x,t,options);
cse = sol(:,end,1);
function[c,f,s] = csefun(~,~,~,DuDx)
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee
ECE4710/5710, State-Space Models and the Discrete-Time Realization Algorithm 5–52
c = 1/Ds; f = DuDx; s = 0;
end
function u0 = cseic(~,~)
c0 = 10000; u0 = c0;
end
function[pl,ql,pr,qr] = csebc(~,~,~,~,t)
pl = 0; ql = 1; qr = Ds; pr = 0;
if t<Tfinal/2, pr=j; end
end
end
■ Note that we achieve good results with the PDE solver only if a fine
time-step is used: here, we have used a 1 ms step size, which makes
the PDE solver execute much more slowly than the DRA-produced
model.
Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee