State-space models 10 models from a difference equation
J A Rossiter
1
Slides by Anthony Rossiter
Introduction
The previous videos focussed on continuous time models.
Next consideration is given to discrete time models.
It is shown that the modelling processes are almost identical and hence some effort is used to show analogies between the two.
Consequently, details are covered relatively quickly.
Slides by Anthony Rossiter
2
Discrete system It is assumed that viewers are familiar with z-transforms and discrete models. Without loss of generality (one can always use zero coefficients), take the numerator and denominator orders to be equal.
Slides by Anthony Rossiter
3
nknknknkk ububyayay 1111
)()()()(
)()()()1(
1
1
1
1
1
1
1
1
zubzbzyazaz
zuzbzbzyzaza
n
n
n
nn
n
n
n
n
The aim here is to look at state space model equivalents.
Discrete state space model
In an analogous fashion to continuous time, the key principle is to use a 1st order matrix equation to represent a high order model.
The number of states matches the model order.
Slides by Anthony Rossiter
4
1111 kkk ubxax First order model.
kkk BuAxx 1Discrete state space model
)()()( zBUzAXzzX Using transforms
Find a control canonical form for the following (see video 6)
Slides by Anthony Rossiter
5
)(32
246)(
234
2
sUssss
sssY
zyuxxdt
d
C
B
A
0642;
1
0
0
1213
1000
0100
0010
)()()( 1 sBUAsICsYBuAxsXCxy
BuAxx
Using analogies
We could use analogies between transfer functions to show that.
Slides by Anthony Rossiter
6
)(32
246)(
234
2
zUzzzz
zzzY
)(0642;
1
0
0
)(
1213
1000
0100
0010
)1( kZyukXkX
C
B
A
)()()( 11zBUAzICzYBUAXzX
Cxy
BuAxx kkk
DEVELOPMENT FROM FIRST PRINCIPLES
Slides by Anthony Rossiter
7
State space model for a generic 2nd order difference equation
Create two 1st order difference equations by creating a new state.
Slides by Anthony Rossiter
8
)(
0)(
)(
01)1(
)1(
1
21
1
kub
kx
kxaa
kx
kx
BzA
)()1()()1( 21 kbukxakxakx
)()()()1( 121 kbukxakxakx )1()(1 kxkx
High order discrete state space model Create n equations to form a state space model with n states.
Slides by Anthony Rossiter
9
)1()2()()1()( 11 nkxankxakxakxku nn
);()1();()2();()1( 121 kxnkxkxkxkxkx n
);()1()1(
);()1()1(
);()1(
21
12
1
kxnkxkx
kxkxkx
kxkx
nn
)()()()1()( 1211 kxakxakxakxku nnnn
Discrete state space model
Slides by Anthony Rossiter
10
)(
0
01
)(
)(
)(
000
010
001
)1(
)1(
)1(
1
1
21
1
1ku
kx
kx
kxaaa
kx
kx
kx
BX
n
A
n
n
);()1(
);()1(
);()1(
21
12
1
kxkx
kxkx
kxkx
nn
)()()()1()( 1211 kxakxakxakxku nnnn
Remark
The elements in the state vector X are all delayed versions of the underlying state ‘x’.
Slides by Anthony Rossiter
11
X
n nkx
kx
kx
kx
kx
kx
)1(
)1(
)(
)(
)(
)(
1
1
Delay of one sample x(k-1)=e2
TX
Delay of n-1 samples x(k-n+1)=en
TX
0010;001 21 TT ee
ei is terminology for the standard basis set
Extension for high order numerator
The previous slide showed that:
However, we also note that given the definition of the states (delayed versions of the first state):
Slides by Anthony Rossiter
12
Tnn
n
bebC
kBUkAXkXzU
azazaz
bzzY
101
1
1
1
00
)()()1()()(
)()(01
1
1
zUazazaz
zbzYebC
nn
in
iT
i i
)()(01
1
1
zUazazaz
zb
zYebCnn
i
in
i
i
T
i i
EXAMPLE
Slides by Anthony Rossiter
13
)(1.08.02.0
132)(
234
2
zUzzzz
zzzY
)(1320)(
)(
0
01
)(
)(
)(
0100
0010
0001
1.018.02.0
)1(
)1(
)1(
)(
1
1
1
1
kZkY
ku
kx
kx
kx
kx
kx
kx
BkZ
n
A
n
REMARKS
We will not repeat state space to transfer function for discrete systems as this is identical to video 5 with the only change being the use of ‘z’ instead of ‘s’.
We will not repeat discussion of canonical forms as again this is identical to videos 6, 7.
Slides by Anthony Rossiter
14
Use of MATLAB
The resource on use of MATLAB carries across almost entirely with just one minor change – ensure that the models are defined as being discrete where this is necessary.
1. When using ss.m, add the sampling time and MATLAB will automatically make this discrete.
2. When using tf2ss.m, ensure the coefficients are done as powers of ‘z’ as in the examples earlier in this resource. MATLAB assumes the maximum power from the length of the vector.
Slides by Anthony Rossiter
15
ss.m
Slides by Anthony Rossiter
16
Sample time
Sample time
tf2ss
Slides by Anthony Rossiter
17
654
2123
zzz
z
654
223
2
zzz
zz
Summary
Given a quick illustration of state space models for discrete systems.
Shown that the conversion from transfer function to state-space and vice-versa are equivalent to the mechanisms used for continuous time systems.
Slides by Anthony Rossiter
18
)()()(
)()()1(
zBUzXAzI
kBukAxkx
)()()(
)()(
sBUsXAsI
tButAxx
© 2016 University of Sheffield This work is licensed under the Creative Commons Attribution 2.0 UK: England & Wales Licence. To view a copy of this licence, visit http://creativecommons.org/licenses/by/2.0/uk/ or send a letter to: Creative Commons, 171 Second Street, Suite 300, San Francisco, California 94105, USA. It should be noted that some of the materials contained within this resource are subject to third party rights and any copyright notices must remain with these materials in the event of reuse or repurposing. If there are third party images within the resource please do not remove or alter any of the copyright notices or website details shown below the image. (Please list details of the third party rights contained within this work. If you include your institutions logo on the cover please include reference to the fact that it is a trade mark and all copyright in that image is reserved.)
Anthony Rossiter Department of Automatic Control and
Systems Engineering University of Sheffield www.shef.ac.uk/acse