0% found this document useful (0 votes)
147 views

State-Space Models and The Discrete-Time Realization Algorithm

Uploaded by

Obada Zezo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
147 views

State-Space Models and The Discrete-Time Realization Algorithm

Uploaded by

Obada Zezo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

ECE4710/5710: Modeling, Simulation, and Identification of Battery Dynamics 5–1

State-Space Models and the


Discrete-Time Realization Algorithm

5.1: Introduction to state-space models


■ The coupled PDEs derived in earlier chapters of notes are too
complex to be used in real-time applications.
• They are “infinite dimensional.” For every point in time t, there are
an infinite number of x- and r- dimension variables to solve for.
• i.e., cs (x, r, t), c̄e (x, t), φ̄s (x, t), φ̄e (x, t), for a pseudo-two
dimensional model.
cell scale empirically empirical
based
ODEs predictions
modeling
empirical system ID

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

■ We desire to create cell-scale ODEs that retain, as much as possible,


the fidelity of the continuum-scale PDEs, but which reduce their order
from infinite order to some (small) finite order.
• The result is a small coupled set of ODEs, which can be simulated
very easily and quickly.
■ In this chapter, we introduce “state-space” models, which is the final
form of the reduced-order models we will develop.
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–2
■ We then preview the approach to generate the state-space models
from the PDEs of the variables of interest:
• We start by generating transfer functions for each PDE;
• We then use the “discrete-time realization algorithm” to convert
transfer functions to state-space form.

A quick introduction to state-space models


■ Transfer functions provide a system’s input-output mapping only:
u[k] → G(z) → y[k].
■ State-space models provide access to what is going on inside the
system, in addition to the input-output mapping.
• What’s going on inside the system is called the system’s “state”.

DEFINITION : The internal state of a system at time k0 is the minimum


amount of information at k0 that, together with the input u[k], k ≥ k0,
uniquely determines the behavior of the system for all k ≥ k0.
■ State-space models describe a system’s dynamics via two equations:
• The “state equation” describes how the input influences the state;
• The “output equation” describes how the state and the input both
directly influence the output.
■ Discrete-time LTI state-space models have the following form:
x[k + 1] = Ax[k] + Bu[k]

y[k] = C x[k] + Du[k],


where u[k] ∈ Rm is the input, y[k] ∈ R p is the output, and x[k] ∈ Rn is
the state vector.
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–3

■ Different systems have D


different n, A, B, C, and D. x[k + 1] x[k]
u[k] B −1 C y[k]
z
■ A block diagram can help
visualize the signal flows: A

EXAMPLE : Convert the following single-input single-output difference


equation into a discrete-time state-space form,

y[k]+a1 y[k−1]+a2 y[k−2]+a3 y[k−3] = b1u[k−1]+b2u[k−2]+b3u[k−3].

■ We’re going to do the conversion by first recognizing that the transfer


function of this system is,
b1 z 2 + b2 z + b3 Y (z)
G(z) = 3 = .
z + a1 z 2 + a2 z + a3 U (z)
■ Break up transfer function into two parts. G p (z) = V (z)/U (z) contains
all of the poles:
1 V (z)
G p (z) = 3 =
z + a1 z 2 + a2 z + a3 U (z)
➠ v[k + 3] + a1v[k + 2] + a2v[k + 1] + a3v[k] = u[k].

■ Choose current and advanced versions of v[k] as state (this is a


choice: there are other equally valid choices, as we will see)
! "T
x[k] = v[k + 2] v[k + 1] v[k] .

■ 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),

or, y[k] = b1v[k + 2] + b2v[k + 1] + b3v[k].


■ In summary, we have the state-space model:
⎡ ⎤ ⎡ ⎤
−a1 −a2 −a3 1
⎢ ⎥ ⎢ ⎥
x[k + 1] = ⎣ 1 0 0 ⎦ x[k] + ⎣ 0 ⎦ u[k]
0 1 0 0
! " ! "
y[k] = b1 b2 b3 x[k] + 0 u[k].

■ 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

State-space to transfer function


■ In the prior example, we saw it is possible to convert from a difference
equation (or transfer function) to a state-space form quite easily.
■ Now, we’ll see that the opposite translation is also straightforward.
■ Start with the state equations
x[k + 1] = Ax[k] + Bu[k]

y[k] = C x[k] + Du[k].


■ Take the z-transform of both sides of both equations
z X(z) − zx[0] = AX(z) + BU(z)

Y (z) = C X(z) + DU(z),


or
(z I − A)X(z) = BU(z) + zx[0]

X(z) = (z I − A)−1 BU(z) + (z I − A)−1 zx[0].


■ This gives,
−1 −1
Y (z) = [C(z
- I − A)
./ B + D]
0 U(z) + C(z
- I − ./ zx[0]0 .
A)
transfer function of system response to initial conditions

■ 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]

y[k] = C x[k] + Du[k],


where we let x[k] = T w[k], where T is an invertible (similarity)
transformation matrix. Then,
(T w[k + 1]) = A (T w[k]) + Bu[k]

y[k] = C (T w[k]) + Du[k].

■ Multiplying the first equation by T −1 gives


w[k + 1] = -T −1./AT0 w[k] + -T −1
./ B0 u[k]
Ā B̄
y[k] = -./0
C T w[k] + -./0
D u[k]
C̄ D̄

so, w[k + 1] = Āw[k] + B̄u[k]

y[k] = C̄w[k] + D̄u[k].

■ To show that H 1(z) = H 2(z),


H 1(z) = C(z I − A)−1 B + D

= 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

= (C T)[T −1(z I − A)T ]−1(T −1 B) + D

= C̄(z I − Ā)−1 B̄ + D̄ = H 2(z).

■ Transfer function not changed by similarity transform

CONCLUSION: Can arrive at state-space representations having identical


input-output relationship but different ( A, B, C, D) matrices.

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.

■ We can find the transfer function of this new form as

G(z) = C̄(z I − Ā)−1 B̄ + D̄


⎛⎡ ⎤ ⎡ ⎤⎞−1 ⎡ ⎤
! " z 0 0 0 1 0 0
⎜⎢ ⎥ ⎢ ⎥⎟ ⎢ ⎥
= b3 b2 b1 ⎝ ⎣ 0 z 0 ⎦ − ⎣ 0 0 1 ⎦⎠ ⎣ 0 ⎦ + 0
0 0 z −a3 −a2 −a1 1
⎛⎡ ⎤⎞−1 ⎡ ⎤
! " z −1 0 0
⎜⎢ ⎥⎟ ⎢ ⎥
= b3 b2 b1 ⎝ ⎣ 0 z −1 ⎦⎠ ⎣ 0 ⎦
a3 a2 z + a1 1
⎡ 2 ⎤⎡ ⎤
! " z + a1 z + a2 a1 + z 1 0
⎢ ⎥⎢ ⎥
b3 b2 b1 ⎣ −a3 z 2 + a1 z z ⎦ ⎣ 0 ⎦
−a3 z −a2 z − a3 z 2 1
=
z 3 + a1 z 2 + a2 z + a3
⎡ ⎤
! " 1
⎢ ⎥
b3 b2 b1 ⎣ z ⎦
z2 b1 z 2 + b2 z + b3
= 3 = 3 ,
z + a1 z 2 + a2 z + a3 z + a1 z 2 + a2 z + a3
which was the transfer function we started with before transformation.

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

■ It turns out that the discrete unit-pulse response of a state-space


system has a special form that is important to us later.
■ For example, let’s look at the unit-pulse response of a single-input
state-space system. (Note that, by definition, x[0] = 0 when finding a
unit-pulse response).
■ We find that
y[0] = C x[0] + Du[0] = D, x[1] = B
y[1] = C x[1] + Du[1] = C B, x[2] = AB
y[2] = C x[2] + Du[2] = C AB, x[3] = A2 B
... ...
y[k] = C Ak−1 B, k ≥ 1.

■ These unit-pulse-response values, { D, C B, C AB, C A2 B, C A3 B, . . .}


are called the Markov parameters of the system.

• This turns out to be of critical importance to realizing our transfer


functions, as we will see.
■ Specifically, we define the Markov parameters to be:

⎨ D, k = 0;
gk =
⎩ C Ak−1 B, k > 0.

CLARITY ISSUE : ■ For SISO systems, the Markov parameters are


scalars.
■ For a single-input multi-output (SIMO) system the Markov
parameters are (column) vectors.

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

• The ith entry (row) of each Markov parameter is computed as


the unit-pulse response from the input to the ith output.
• Equivalently, the entire vector Markov parameter is the
unit-pulse response from the input to the vector output.
■ For multi-input single-output (MISO) systems, the Markov
parameters are row vectors.
• The jth entry (column) of each Markov parameter is computed
via the unit-pulse response from the jth input to the output.
■ For multi-input multi output (MIMO) systems, the Markov
parameters are matrices.
• The (i, j)th entries yield the the unit-pulse response from the jth
input to the ith output.
• Equivalently, the jth column of each Markov parameter is vector
(as in the SIMO case) which is computed via the unit-pulse
response from the jth input to the vector output.
EXAMPLE : Given the following discrete-time system, with zero initial
condition, find the unit-pulse response:
: ; : ;
0.5 0 1 ! "
A= , B= , C = 1 −1 , D = 0.
0 1 0
■ The Markov parameters are given by

g k = { D, C B, C AB, C A2 B, . . .}

= {0, 1, 0.5, 0.25, . . .}.

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...

■ We have now quickly previewed state-space models, with the claim


that there will be a method to represent our battery models in that
particular form.
■ We now begin to investigate that claim—the first step is to create
transfer-function models for the variables of interest.
■ In this chapter, we look at representing cs as a transfer function; in the
next chapter we look at the remainder of the model equations.

• Note that in chapter 3 we used symbols without an over-line to


indicate point-wise values for variables of interest: i.e., cs , ce , φs , φe .
• In chapter 4 we used symbols with an over-line to indicate volume
average versions of these point-wise variables: i.e., c̄e , φ̄s , and φ̄e .
• We now drop the over-line notation, because otherwise the
equations get so highly decorated that they are impossible to
parse. We are still talking about the volume-average quantities of
chapter 4.

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

anywhere within the particle.


■ However, we are most interested in determining the concentration at
the surface of the particle, where r = Rs . So, we substitute r = Rs
<s,e (s) C D
C Rs exp(β(Rs )) − exp(−β(Rs ))
= .
J (s) Ds (1 − β(Rs )) exp(β(Rs )) − (1 + β(Rs )) exp(−β(Rs ))
■ To compact the notation yet again, write β(Rs ) as simply β,
<s,e (s) C D
C Rs exp(β) − exp(−β)
=
J (s) Ds (1 − β) exp(β) − (1 + β) exp(−β)
: ;
Rs exp(β) − exp(−β)
= + ,
Ds exp(β) − exp(−β) − β exp(β) + exp(−β)
: exp(β)−exp(−β) ;
Rs exp(β)+exp(−β)
=
Ds exp(β)−exp(−β) − β
exp(β)+exp(−β)
C D C D
Rs tanh(β) Rs 1
= = .
Ds tanh(β) − β Ds 1 − β coth(β)
@
■ To recap to this point, re-expanding notation, where β(s, r) = r s/Ds ,
C D
<s,e (s) = sR 1
C J (s).
Ds 1 − β(s, Rs ) coth (β(s, Rs ))

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

■ While not immediately obvious by looking at the transfer function, it


<s,e (s)/J (s) is unstable: There is a pole at s = 0.
turns out that C

• This is intuitively clear, however, because we know that a step


input will result in ever-increasing concentration.
• This will be important when we look at how to convert the transfer
function to a state-space model.
■ To make a stable transfer function, define
%C<s,e (s) = C
<s,e (s) − C
<s,avg (s), where C
<s,avg (s) is the bulk (average)
concentration in the solid, less cs,0.
■ Note that we can write c̃s,avg (t1) for some arbitrary point in time t1 as
E t1
Influx of Li, [mol s−1]
c̃s,avg(t1) = 3
dt.
0 Volume of particle [m ]

■ Note two things:


4
• The volume of a sphere of radius Rs is π Rs3 [m3];
3
• The influx of lithium is − j (t) [mol m−2 s−1 ], occurring over the
surface area 4π Rs2 [m2].
■ This gives
E t1
− j (t) · 4π Rs2
c̃s,avg(t1) = 4 3
dt
0 3
π R s
E
3 t1
=− j (t) dt
Rs 0
d 3
c̃s,avg (t) = − j (t).
dt Rs
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–17
■ Note that this result is perfectly general. We made no assumptions on
how the lithium concentration is distributed inside the particle.
■ Taking Laplace transforms, we find:
<s,avg (s)
C 3 1
=− .
J (s) Rs s
■ Therefore,
<s,e (s) C
%C <s,e (s) C <s,avg (s)
= −
J (s) J (s) J (s)
C D
Rs tanh(β) 3
= +
Ds tanh(β) − β Rs s
: 3Ds ;
Rs tanh(β) + s Rs2
(tanh(β) − β)
=
Ds tanh(β) − β
: 3
;
Rs tanh(β) + β 2 (tanh(β) − β)
=
Ds tanh(β) − β
C D
Rs β 2 tanh(β) + 3 (tanh(β) − β)
=
Ds β 2 (tanh(β) − β)
C D
Rs (β 2 + 3) tanh(β) − 3β
= .
Ds β 2 (tanh(β) − β)
State-space realization problem
■ It turns out that for this specific case, we can find all the poles and
zeros using a simple numeric method, and use that information to
make a discrete-time state-space model.
■ For the transfer functions we develop in the next chapter, however,
this cannot be done.
■ So, we must turn to alternative implementation approaches.
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–18

• One method is to use nonlinear optimization to select poles and


residues to attempt to match the frequency response of the
transfer functions.
• This is fraught with problems.

• We next introduce another approach, which directly gives us a


discrete-time state-space approximate model of our transfer
functions.
■ This system-identification problem for state-space systems is
sometimes called the “realization problem.”

• That is, we wish to find a realization (a set of A, B, C, and D


matrices) that describe a system’s dynamics.

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.

• Knowledge of g 0 gives us D directly.

• Knowledge of the rest of the Markov parameters will ultimately


result in A, B, and C.
■ To use Ho–Kalman, we must first form the Hankel matrix H.
■ The next step is to factor H = OC into its O and C components.
■ The third step is to use O and C to find A, B, and C.

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?

PRELIMINARY ANSWER : The rank of H is equal to n. Keep adding


data until the rank doesn’t increase.

ISSUE II : How do we compute A, B, and C from O and C?

ANSWER: C is extracted as the first block row of O; B is extracted as


the first block column of C. We’ll see how to get A shortly.

ISSUE III : How do we do the factoring of H into O and 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–21
ANSWER: It doesn’t matter, at least in principle. Any matrices O and
C such that OC = H are okay.
■ To see this latter point, consider what happens to O and C when the
state-space model undergoes a similarity transformation.

• Recall that Ā = T −1 AT , B̄ = T −1 B, and C̄ = C T .

• The observability and controllability matrices of the new


representation are
⎡ ⎤ ⎡ ⎤
'
C CT
⎢ ⎥ ⎢ ⎥
⎢ ' C '
A ⎥ ⎢ C T T −1 AT ⎥
' =⎢
O ⎥=⎢ ⎥ = OT
⎢ ... ⎥ ⎢ ... ⎥
⎣ ⎦ ⎣ ⎦
n−1
'
C'A −1
C T (T AT ) n−1

! "
' 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

• If we factor H one way, we end up with a representation that has


one set of O and C.
• If we factor H any other way, we end up with a representation that
has an alternate set of Ō and C̄.
• But, these representations are related via a similarity
transformation T .
■ That is, no matter how we factor H, we end up with different A, B,
and C matrices, but the same input-output relationship (same transfer
function, same unit-pulse response, but different state descriptions).

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.”

ISSUE IV : Is there a “best” way to factor H? Yes. . . enter the SVD.

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

FACT : Any rectangular matrix A ∈ Rm×n , where rank( A) = r, can be


factored into the form:
A = U!V T .
■ U = [u1, . . . , ur ] ∈ Rm×r , and U T U = I, and ui are the left or
output singular vectors of A.
■ V = [v 1, . . . , vr ] ∈ Rn×r , and V T V = I, and v i are the right or input
singular vectors of A.
■ ! = diag(σ1, . . . , σr ) where σ1 ≥ · · · ≥ σr > 0, and σi are the
(nonzero) singular values of A.
■ The above is called a compact SVD. Most often, we compute a full
SVD, where
m×m
• U = [u1 , . . . , um ] ∈ R , and U T U = I,
• V = [v 1 , . . . , v n ] ∈ Rn×n , and V T V = I,

• The matrix ! ∈ Rm×n is “diagonal”


⎡ ⎤
⎡ ⎤ ⎡ ⎤ σ1 0
σ1
0 0 σ1 0 ⎢ ... ⎥
⎢ ... ⎥ ⎢ . ⎥ ⎢ ⎥
!=⎣ 0⎦ or ! = ⎣ . . ⎦ or ! = ⎢ ⎥
⎢ 0 σn ⎥
⎣ ⎦
0 σm 0 0 σn
0 0 0
when m < n, m = n and m > n, respectively.
• In this case, σ1 ≥ · · · ≥ σr > 0, and σi = 0 for i > r.

• In MATLAB, svd.m and svds.m

■ We often write the full SVD as partitioned:

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

• Computing coefficients of x along the input directions v 1 , . . . , v r


(rotating by V T )
◆ v 1 is the most sensitive (highest gain) input direction
• Scaling the coefficients by σi (dilation)
• Reconstituting along output directions u1 , . . . , ur .
◆ u1 is the highest gain output direction. Av 1 = σ1 u1.
■ SVD gives a picture of gain as a function of input/output directions.
EXAMPLE : Consider A ∈ R4×4 with ! = diag(10, 7, 0.1, 0.05).
■ Input components along directions v 1 and v 2 are amplified (by about
10) and come out mostly along the plane spanned by u1 and u2.
■ Input components along directions v 3, v 4 are attenuated (by about
10).
■ ∥ Ax∥ / ∥x∥ can range between 10 and 0.05; A is nonsingular.
■ For some applications you might say that A is effectively rank 2 (this
will be important for us later).
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–25
Low-rank approximations
■ Suppose that A ∈ Rm×n and rank( A) = r, with SVD
Fr
T
A = U!V = σi ui viT .
i =1

■ We want to approximate GA by Â,G where rank( Â) ≤ p < r such that


G G
 ≈ A in the sense that G A − ÂG is minimized.
p
F
■ The optimal rank p approximator is  = σi ui viT and hence
i =1
G G
G G GG F r G
G
G G G TG
G A − Â =
G G σi i i G = σ p+1
u v
Gi = p+1 G
because σ p+1 is the maximum remaining singular value.
INTERPRETATION: SVD dyads ui v iT are ranked in order of ‘importance’;
take p of them to get a rank p approximant.
APPLICATION : We can use this idea to simplify models (very useful).
Suppose that
■ y = Ax + v where A ∈ R100×30 has SVs 10, 7, 2, 0.5, 0.01, . . . , 0.0001.
■ ∥x∥ is on the order of 1, and unknown error or noise v has norm on
the order of 0.1.
■ Then, the terms σi ui viT x for i = 5, . . . , 30 are substantially smaller
than the noise term v.
■ So, we can approximate y = Ax + v by the much simplified model
F4
y= σi ui v iT x + v.
i =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–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 · · · ⎦
... ... ... ... . . .

where the entries g k correspond to the Markov parameters for the


given system.
■ This form is called an infinite Hankel matrix, or Hankel operator.
■ We can also define a finite Hankel matrix, formed by the first k rows
and l columns of H ⎡ ⎤
g1 g2 g3 · · · gl
⎢ ⎥
⎢ g2 g3 g 4 · · · gl+1 ⎥
⎢ ⎥
⎢ g 5 · · · gl+2 ⎥
Hk,l = ⎢ g 3 g 4 ⎥.
⎢ .. ... ... ... ⎥
⎣ . ⎦
g k g k+1 g k+2 · · · g k+l−1
■ This finite Hankel matrix factors into Hk,l = Ok Cl where:
⎡ ⎤
C
⎢ ⎥ ! "
⎢ CA ⎥
⎢ ⎥ 2 l−1
Ok = ⎢ ... ⎥ , C l = B AB A B · · · A B .
⎣ ⎦
C Ak−1
■ The approach we will take is to make a Hk,l of larger size than we
expect for a hypothesized value of n. That is, k > n and l > 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–27

• Therefore O k ̸ = O and C l ̸ = C even though the matrices have the


same general form. We call Ok the extended observability matrix
and C l the extended controllability matrix.
■ We then apply the SVD to Hk,l
Hk,l = U!V T = U! 1/2! 1/2 V T

= U! 1/2 T T −1! 1/2 V T


1/2 −1 1/2 T
= (U!
- ./ 0 -T ) (T !./ V 0) .
Ok Cl

■ 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;

■ As before, we extract B from the first block column of the


controllability matrix we derived via SVD.
■ Also, extract C from the first block row of the observability matrix we
derived via SVD, and set D = g 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–29
5.9: Ho–Kalman summary and example

STEP I : Collect the unit-pulse response values into two Hankel matrices

1. An original finite Hankel matrix


2. A shifted version matrix of the original Hankel matrix (same size)

STEP II : Compute the SVD of the (unshifted) Hankel matrix


■ Identify system order from the singular values
■ May need to iterate on choice of Hankel matrix (discussed later)

STEP III : Compute the extended observability and controllability matrices


■ Use appropriately dimensioned SVD components
■ Typically use T = I n
STEP IV : Identify the system matrices ( A, B, C). D = g 0.
EXAMPLE : Suppose that a unit pulse yields the following response:

y = (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, · · · ).

■ We recognize this output as the Fibonacci sequence generated by


gk = gk−1 + gk−2 with initial conditions g0 = 0 and g1 = 1.
■ A typical realization for this sequence is given by the state-space
system:
: ; : ;
0 1 1 ! "
A= , B= , C = 1 0 , D = 0.
1 1 1
■ We’ll try to come up with an equivalent realization based on only the
unit-pulse response.

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

■ The Hankel matrices that we will require are:


⎡ ⎤ ⎡ ⎤
1 1 2 3 1 2 3 5
⎢ ⎥ ⎢ ⎥
⎢1 2 3 5 ⎥ ↑
⎢2 3 5 8 ⎥
H4,4 = ⎢⎢ ⎥ , H5,4 = ⎢ ⎥.
⎥ ⎢3 13 ⎥
⎣2 3 5 8 ⎦ ⎣ 5 8 ⎦
3 5 8 13 5 8 13 21

% Form H{4,4} and shifted H{5,4}. Note: Do not include "zero-th"


% parameter (first element of y), which corresponds to the matrix D.
bigHankel = hankel(y(2:end)); % don't forget to omit h(0) term = y(1)
H = bigHankel(1:4,1:4); % for this example, keep only 4x4 portion
Hup = bigHankel(2:5,1:4); % shifted H{5,4}

■ The SVD yields

σ1 = 54.56 σ2 = 0.43988 σi = 0, i ≥ 3

which indicates that n = 2.


% Compute singular values of Hankel matrix
[U,S,V] = svd(H);

% Identify system order off-line as n = 2 based on values of S


n = 2;

■ We now extract the two left columns of U and V


⎡ ⎤
−0.1876 0.7947
⎢ ⎥
⎢ −0.3035 −0.4911 ⎥
U =V =⎢ ⎥
⎢ −0.4911 0.3035 ⎥ .
⎣ ⎦
−0.7947 −0.1876

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 .

% Compute extended observability and controllability matrices, sized to


% the order for the system inferred by the singular values.
Us = U(:,1:n); Ss = S(1:n,1:n); Vs = V(:,1:n);
Ok = Us*sqrtm(Ss); Cl = sqrtm(Ss)*Vs';

■ Identify the system matrices (H A, H ! up to similarity transform


B, C)
: ;
1.6180 0
A = O†k H↑k+1,l C l† =
H
0 −0.6180
: ;
H −0.8057
B = Cl (1 : n, 1 : m) = C l (1 : 2, 1) =
0.5257
! "
H
C = Ok (1 : p, 1 : n) = O k (1, 1 : 2) = −0.8057 0.5257

H
D = g0 = 0.

% Identify system assuming p = m = 1 (SISO), using shifted Hankel matrix


Ahat = (Ok\Hup)/Cl; Bhat = Cl(:,1); Chat = Ok(1,:); Dhat = y(1);
sysEst = ss(Ahat, Bhat, Chat, Dhat, dt);

■ Now, let’s compare the true and identified (“estimated”) systems

• Same pole-zero mapping (eigenvalues...transfer function)

• Same unit-pulse responses

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

COMMENTS : Selecting an appropriate amount of output data to store


may require iteration (“how big an H do I need?”)
■ Until rank(Hk,l )= rank(Hk−1,l−1), or
■ Until the next singular value is “insignificant.”
■ Interesting to note that A = AT and that B = C T for the identified
system in the example.

• This property holds for square Hankel matrices

• The identification process will work so long as the Hankel matrix


dimensions exceed the system order (H need not be square)

REMAINING QUESTION : From whence come the g k ?


■ This is key to making the DRA work.

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)

■ Given a continuous-time transfer function in the Laplace domain,


H(s) = Y (s)/U(s), and a sampling period, Ts , we want to derive a
reduced-order discrete-time state-space realization of the form

x[k + 1] = Ax[k] + Bu[k]

y[k] = C x[k] + Du[k],

■ A sufficient condition for the DRA to operate is that H(s) be an


element of the Hardy space H∞, which implies that it is a strictly
stable and proper system.
■ This is not a necessary condition, however, as we will later generalize
the method to work with systems having isolated pole(s) on the
imaginary axis.
■ Note that we do not restrict H(s) to be formulated as a quotient of
polynomials in the Laplace variable “s” (for which well-known methods
exist to find the discrete-time system).
■ We describe the algorithm in four steps, which we preview here, and
discuss in more detail in the following subsections.

STEP 1: Sample the continuous-time transfer function H (s) in the


frequency domain at a high rate, and take the inverse discrete
Fourier transform (IDFT) of the samples to get an approximation to
the continuous-time impulse response h(t).
STEP 2: Use h(t) to approximate the continuous-time step response
h step (t), also sampled at the high rate.

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

STEP 3: Compute discrete-time unit-pulse response gk with


inter-sample period Ts from continuous-time step response h step(t),
assuming a sample and hold circuit connected to system input.
STEP 4: Generate a discrete-time state-space realization using the
deterministic Ho–Kalman algorithm.
■ We note that a system having a pole at the origin does not meet the
strictly-stable requirement. However, we also show that this pole can
be automatically accounted for.

Building the DRA from the end to the beginning

STEP 3: If we have the system’s unit-pulse response, we can use


Ho–Kalman to find a state-space representation.
■ But, how to find the unit pulse response? Let’s assume that we know
the continuous-time step response h step(t):

step function step response

subtract shifted step function shifted step response

Ts
unit−pulse response
unit−pulse function

■ The continuous-time response to a unit pulse of length Ts seconds is


h pulse (t) = h step(t) − h step(t − Ts ).
■ The discrete-time response is found by sampling: gk = h pulse (kTs ).
STEP 2: If we have the system’s continuous-time step response, we can
find a state-space representation.
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–35
■ But, how to find the step response? Let’s assume that we know the
continuous-time impulse response h(t). Then,
E t
h step (t) = h(τ ) dτ .
0

■ In fact, since the DRA is a numeric algorithm, we can’t deal with


continuous time directly. Instead, we select a fast sample frequency
1
F1 such that T1 = ≪ Ts .
F1
■ Then, the finely sampled continuous-time step response is:

k−1
F
h step(kT1) = T1 h(i T1).
i =0

STEP 1: Given the system’s finely sampled continuous-time impulse


response, we can find a state-space representation.
■ How to find the finely sampled continuous-time impulse response?
■ We approximate the continuous-time impulse response via a “discrete
equivalent” approach (frequency-domain emulation).
■ We use the bilinear transform to write a high-sample-rate discrete-
time approximation to the original continuous-time transfer function

H (z) ≈ H (s)|s= 2 z−1 ,


T1 z+1

where T1 is the same emulation sampling period as before.3

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

= H (s)|s= 2 j tan(π f /N ) , 0 ≤ f < N,


T1

where N is the number of points chosen for the underlying sequence,


and is usually chosen to be a power of 2 for efficient computations.
■ The inverse DFT of H [ f ] gives h(nT1), which is the approximation of
the continuous-time impulse response at the emulation sampling
period, T1
N −1
1 F
h(nT1) = H [ f ]e j 2π f n/N ,
N f =0
which is indexed from n = 0 to n = N − 1.

Examples of the DRA


■ We will ultimately look at three examples to illustrate the DRA.
■ The first two are rational-polynomial transfer functions, which we use
because we can calculate the exact solution using other methods.

• We can then compare the exact solutions to the approximate


solutions obtained by the DRA.
■ The third does not have a closed-form solution, but we can use a 1-D
parabolic-elliptic partial differential equation solver to find an accurate
near-exact solution against which to compare the DRA solution.
■ We find excellent agreement between the exact solutions and DRA
solutions in all cases.

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

■ The DRA method is first applied to a simple second-order system.


■ We require a discrete-time realization with the a sampling period of
Ts = 0.1 seconds from the continuous-time transfer function
s 2 + 20s + 100
H1 (s) = .
s 2 + 2s + 8
■ We compute the Bode plot to estimate the system bandwidth.
omega = logspace(-1,3,100); % create freq. axis in rad/sec
s = 1j*omega; % create s = j*omega
H = (s.^2+20*s+100)./(s.^2+2*s+8); % compute cplx. freq. response
semilogx(omega,20*log10(abs(H))); % display the magnitude response

■ Poles at −1 ± j2.65 rad s−1, two 30


Bode magnitude plot for H1 (s)

zeros at 10 rad s−1. 25


Magnitude (dB)

■ The magnitude response of 20

H1(s) is shown in the figure. 15

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 )

STEP 1: The sampling frequency is selected as 256 Hz which is (much)


greater than 20 times the system bandwidth.
■ Transfer function is sampled at discrete frequencies; inverse DFT
yields an approximate continuous-time impulse response.
F1 = 256; T1 = 1/F1; % Interp. freq. of 256 Hz
minTlen = 6.5; % min. h(t) length in sec.
N = 2^(ceil(log2(minTlen*F1))); % # of samples at rate F1
f = 0:N-1; % normalized freq. vector
s = (2j/T1)*tan(pi*f/N); % substitute to get Hd[f]

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)

H1 = tf([1 20 100],[1 2 8]); % true transfer function


[himpTrue,timpTrue] = impulse(H1,5); % true impulse response
plot(timpTrue,himpTrue,'r'); axis([0 5 -10 26]); % plot on top

■ The figure compares the


Continuous-time impulse responses
approximate continuous-time 25
Exact
20 Approximate
impulse response computed
15
via the inverse DFT to the exact

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)

STEP 2: The approximation to the continuous-time step response is


found by doing a cumulative summation of the impulse response.
hstep = T1*cumsum(hd); % h_s(t)
plot(td,hstep,'bx','markersize',8); hold on % plot h_s(t)

[hstepTrue,tstepTrue] = step(H1,5); % true step resp.


plot(tstepTrue,hstepTrue,'r'); axis([0 5 0 18]); % plot on top

Continuous-time step responses


■ The results are shown in the
15
figure and show excellent
Response

agreement with the exact step 10

response of the continuous


5
time system.
Exact
Approximate
0
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]);

■ Note that in new versions of


Discrete-time unit-pulse responses
MATLAB, the “impulse” 2.5
Exact
command works differently 2 Approximate

1.5
from old versions for
Response

1
discrete-time systems. 0.5

■ We need to scale MATLAB’s 0

−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

unit-pulse response and the exact solution, except at single point


t = 0.
■ This is often the case because of some properties of the inverse DFT.
■ But it causes no problems since the unit-pulse response value at
t = 0 is computed differently, using

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

STEP 4: The Ho–Kalman algorithm is used to find state-space realization


from approximate discrete-time unit-pulse response of Step 3.
■ 64 points from the discrete-time unit-pulse response are used, which
allows a maximum Hankel matrix of 32 × 32.
■ We first compute and plot the singular values of the Hankel matrix.
bigHankel = hankel(hdisc(2:66)); % don't forget to omit h(0) term!
% for this example, keep only 32x32 portion
Hankel = bigHankel(1:32,1:32);
HankelUp = bigHankel(2:33,1:32); % shifted Hankel matrix
[U, S, V] = svd(Hankel); % compute singular values
plot(log10(diag(S)),'bx','markersize',8); axis([0 33 -20 5]);

■ Hankel-matrix SVD gives insight into the system’s order.


■ A log plot of the singular values
Hankel matrix singular values
is shown in the figure.
0

■ The first two are almost three


log10 (σn )

−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

n = 2; % select via singular values


Us = U(:,1:n); % Compute extended observability, controlability
Ss = S(1:n,1:n); % matrices, sized to the order for the system
Vs = V(:,1:n); % inferred by the singular values.
Ok = Us*sqrtm(Ss); Cl = sqrtm(Ss)*Vs';

Ahat = (Ok\HankelUp)/Cl; % calculate A from Ok, Cl


Bhat = Cl(1:n,1); Chat = Ok(1,1:n); % calculate B and C
Dhat = 1; % calculated manually
sysDRA = ss(Ahat,Bhat,Chat,Dhat,Ts); % final DRA ss model

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]);

Discrete-time unit-pulse responses


2.5
■ The results agree very well Exact
2 Approximate
(note that h[0] has been 1.5
Response

corrected by the correct 1

calculation of the H
D matrix in 0.5

0
Step 4).
−0.5

−1
0 1 2 3 4 5
Time (s)

■ Because the unit-pulse responses agree very well, the response of


the reduced-order model will also agree well with the exact response
for any input signal u[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–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).

■ To re-incorporate the effect of the pole at s = 0 into the final


reduced-order model, recall that this pole corresponds to an
integrator. The discrete-time equivalent can be implemented as
xi [k + 1] = xi [k] + Ts u[k].
■ We combine this with the DRA-produced state-space form
: ; : ;: ; : ;
x[k + 1] H
A 0 x[k] H
B
= + u[k]
xi [k + 1] 0 1 xi [k] Ts
- ./ 0 - ./ 0 - ./ 0 - ./ 0
x aug [k+1] H
Aaug x aug [k] H
B aug
: ;
! " x[k]
y[k] = H
C res0 + Du[k]
- ./ 0 xi [k]
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–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 .

Example 2: Rational polynomial transfer function with pole at origin

■ In this example, we demonstrate how to handle a single pole at the


origin. The continuous-time transfer function is given by
= >
1 1
H2 (s) = .
s s 2 + 6s + 8
■ This system has real poles at 0, 2 and 4 rad s−1.
■ Desire a discrete-time transfer function with sample period Ts = 0.1 s.
■ Prior to Step 1 we remove the pole at the origin.
■ This is accomplished by first calculating the residue for this pole.
■ In this example, the residue can be computed analytically as

res0 = lim s H (s) = 0.125.


s→0

■ In general, we find this residue by selecting a very small value for s


and numerically computing res0, or by using a software tool like
Mathematica to compute the limit.
■ The reduced transfer function, H2∗ (s) with the pole at the origin
removed is = >
1 1 0.125
H2∗(s) = − .
s s 2 + 6s + 8 s
■ The figures below shows the magnitude plot of the original system
and the system with the pole at the origin removed.

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 )

STEP 1. H2∗(s) is sampled at 256 Hz which is (much) more than 50 times


greater than the system bandwidth. We could implement either
Hd = 1./(s.^3+6*s.^2+8*s) - 0.125./s; % Hd[f]
Hd(1) = -6/64; % analytic solution

where lim H2∗(s) = −6/64, or compute by hand


s→0
= > = 2 >
1 1 0.125 s + 6s + 8
H2∗ (s) = −
s s 2 + 6s + 8 s s 2 + 6s + 8
= 2 > = >
0.125 s + 6s s+6
=− = −0.125 2 ,
s s 2 + 6s + 8 s + 6s + 8
Continuous-time impulse responses
and implement
0

Hd = -0.125*(s+6)./(s.^2+6*s+8); −0.02

−0.04
Response

■ The approximate continuous- −0.06

time impulse response is −0.08

−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

Continuous-time step responses


0 Exact
STEP 2: The approximation to the Approximate
−0.02
continuous-time step response

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

sampled at Ts = 0.1 seconds, −4

−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)

STEP 4. The system Hankel matrix is generated from the discrete-time


unit-pulse response found in Step 3.
■ 64 discrete time points are used, resulting in a 32×32 Hankel matrix.
■ The figure depicts the 32 Hankel matrix singular values
0
singular values of the system
Hankel matrix. −5
log10 (σn )

■ The first two singular values −10

are two orders of magnitude


−15
greater than the third, indicating
that H2∗(s) is a second order −20
0 5 10 15 20 25 30
system. 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–46

■ The Ho–Kalman algorithm generates the H B, and H


A, H C matrices after
truncating all but the first two states. We find that
: ; : ;
H 0.8617 −0.0906 H 0.1162
A= , B=
0.0906 0.6274 −0.0340
! "
H
C = −0.1162 −0.0340 .

In this example, we also compute H D = lim H2∗(s) = 0, which can also


s→∞
be quite easily seen in the high-frequency response of H2∗(s).
■ The state-space representation for H2∗(s) is augmented to include the
pole at the origin to create a representation for Hs (s).
Aaug = [Ahat, zeros(n,1); zeros(1,n), 1];
Baug = [Bhat; Ts];
Caug = [Chat, res0];
sysDRA = ss(Aaug,Baug,Caug,Dhat,Ts) % final DRA state-space sys.

■ The discrete-time realization of H2(s) is


⎡ ⎤ ⎡ ⎤
0.8617 −0.0906 0 0.1162
H ⎢ ⎥ H ⎢ ⎥
Aaug = ⎣ 0.0906 0.6274 0 ⎦ , B aug = ⎣ −0.0340 ⎦
0 0 1 0.1
! "
H
C aug = −0.1162 −0.0340 0.125 , H
D = [0].

Discrete-time unit-pulse responses


12
Response (×10−3 )

10
■ The figure shows close
8
comparison of the unit-pulse 6

response found from the DRA 4

and the exact solution. 2


Exact
0 Approximate
0 1 2 3 4
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–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

where we have used the relationship


<s,avg(s) res0
C −3/Rs
= = .
J (s) s s
■ Parameter values for the transfer functions used in this example are
listed in the table, from which we can compute that res0 = −3 × 105.

Parameter name Interpretation Value


Ts Sampling period 1s
Rs Particle radius 10−5 m
Ds Diffusivity 10−12 m2 s−1
c(r, 0) Initial lithium concentration 10 000 mol m−3
STEP 1. The magnitude responses of H3 (s) and H3∗(s) are shown below:
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–48
Bode magnitude plot for H3(s) Bode magnitude plot for H3*(s)
220 130

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 )

■ H3∗(s) is sampled at 256 Hz for a total of 256 seconds.


■ The frequency vector for H3∗ (s) can be calculated as
beta = Rs*sqrt(s/Ds);
Hd = (Rs/Ds)*(1./(1-beta.*coth(beta))) + (3/Rs)./s;
Hd(1) = -Rs/(5*Ds); % analytic solution

where MATLAB numerically removes the integrator pole, or as


beta = Rs*sqrt(s/Ds);
Hd = (beta.^2+3-3*beta.*coth(beta))./(s.*Rs.*(1-beta.*coth(beta)));
Hd(1) = -Rs/(5*Ds); % analytic solution

■ Note that both computations of Hd initially produce NaN for s = 0 due


to numeric attempts to evaluate zero divided by zero.
■ This entry must be manually replaced by a value computed
analytically
B I B J
s Rs2
Ds
+ 3 − 3Rs Ds coth Rs Dss
s
Rs
lim H3∗ (s) = lim I B I B JJ = − .
s→0 s→0 s
s Rs 1 − Rs Ds coth Rs Ds s 5D s

■ Direct by-hand computation returns 0/0. We must use l’Hôpital’s rule


repeatedly until an answer is reached.
■ When using transcendental transfer functions, we recommend
computer tools such as Mathematica for symbolic manipulation.
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–49
Continuous−time impulse response for H3*(s)
■ The approximate 0
6
x 10

continuous-time impulse −1

response is shown. −2

Response
−3

■ There is no known exact −4

solution against which to −5


Approximate via DRA Step 1
−6
compare this result. 0 2 4 6
Time (sec)
8 10

STEP 2. The approximate continuous-time step response is calculated by


performing a cumulative sum of the impulse response of Step 1.
Continuous−time
6
step response for H3*(s)
x 10
0
■ The figure shows approximated Approximate via DRA Step 2

continuous-time step response. −0.5

Response
−1
■ Again, there is no known exact
solution against which to −1.5

compare this result. −2


0 10 20 30 40 50
Time (sec)
Approximate discrete−time impulse resp. for H3*(s)
3: The approximate
5
STEP 0
x 10

continuous-time step response −2

is sampled at Ts = 1 second,
Response

−4

and differenced to produce the −6

discrete-time unit-pulse −8

Approximate via DRA Step 2


response, shown here. −10
0 5 10 15 20 25
Time (sec)

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

■ H3∗(s) represents a distributed- 5

log(σn)
parameter system that actually 0

has an infinite number of poles. −5

■ However, only a few of them are −10


0 20 40 60 80 100 120 140
n
significant to the solution.
■ In particular, we choose to use a reduced-order model dimension

n = 2 in the results we present here, imposing a tradeoff between the


complexity and accuracy of the solution.
■ The Ho–Kalman algorithm generates the H B, and H
A, H C matrices to
approximate H3∗ (s) after truncating all but the first two states.
: ; : ;
H 0.4695 0.3296 H 919.1
A= , B=
0.3296 0.4355 −220
! "
H
C = −919.1 220 .

■ In this example, we also compute H D = lim H3∗(s) = 0, which can also


s→∞
be quite easily seen in the high-frequency response of H3∗(s).
■ This state-space realization is augmented with the integrator state to
give the final third-order model of the diffusion equation H3 (s).
⎡ ⎤ ⎡ ⎤
0.4695 0.3296 0 919.1
H ⎢ ⎥ H ⎢ ⎥
Aaug = ⎣ 0.3296 0.4355 0 ⎦ , B aug = ⎣ −220 ⎦
0 0 1 1
! "
H
C aug = −919.1 220 −3 × 105 , H
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–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;

Simulation of Example 3a: Surface Concentration


■ All discrete-time model states 10000
Exact PDE solution

are initialized to zero. DRA model with order=3

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

■ We compare this result against the “truth” produced by simulating the


PDE using MATLAB’s 1-D parabolic-elliptic PDE solver.
function [cse,t] = simCsePDE
dr = 0.1e-6; % Radial resolution = 0.1 micro-meter
dt = 0.001; % Time step in simulation, s
Tfinal = 20; % Length of simulation, s
Rp = 10e-6; % Radius of particle = 10 micro-meters
Ds = 1e-12; % Solid diffusivity, m^2/s
j = 1e-5; % mol/m^2/s

x = 0:dr:Rp; % locations for solution


t = 0:dt:Tfinal; % time steps for solution

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

■ The code comprises nested functions, where the main function


initializes variables and calls MATLAB’s solver with pointers (function
handles) to nested helper functions:
• csefun implements the parameter values of the PDE;
• cseic implements the initial conditions; and
• csebc implements the boundary conditions.

■ 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.

Where from here?


■ We have now seen the form that the final model will take, and
examples of the general methodology to go from the PDE
continuum-scale model to the reduced-order model.
■ We now proceed to develop transfer functions for all cell variables of
interest, and see how well the overall cell model works.

Lecture notes prepared by G.L. Plett and J.L. Lee. Copyright © 2011, 2012, 2014, 2016, G.L. Plett and J.L. Lee

You might also like