ENGG 1203 Tutorial Difference Equation Construction (1) Difference

ENGG 1203 Tutorial
„
„
„
Systems and Control
12 April
Learning Objectives
‰
‰
‰
„
Difference Equation Construction (1)
„
Newton’s law of cooling states that:
The change in an object’s temperature from one time
step to the next is proportional to the difference (on the
earlier step) between the temperature of the object and
the temperature of the environment, as well as to the
length of the time step.
„
Let o[n] be temperature of object, s[n] be temperature of
environment, T be the duration of a time step, K be the
constant of proportionality
Difference Equations
Z-transform
Poles
Ack.: MIT OCW 6.01, 6.003
1
2
Difference Equation Construction (2)
„
The difference equation for Newton’s law of cooling
‰
‰
‰
i) the difference (on the earlier step) between the temperature of
the object and the temperature of the environment
ii) as well as to the length of the time step
Be sure the signs are such that the temperature of the object will
eventually equilibrate with that of the environment.
Grow, baby, grow (1)
„
„
„
„
„
The system function corresponding to this equation
„
„
„
3
In each time period, every cell in the bioreactor divides to
yield itself and one new daughter cell. However, due to
aging, half of the cells die after reproducing.
Po : The number of cells at each time step.
→ Po[n] = 2Po[n−1] − 0.5Po[n−2]
Suppose that Po[0]= 10 and Po[n]= 0 if n<0.
Po[0] = 10
Po[1] = 2Po[0] − 0.5Po[-1] = 20 + 0 = 20
Po[2] = 2Po[1] − 0.5Po[0] = 40 − 5 = 35
Po[3] = 2Po[2] − 0.5Po[1] = 70 − 10 = 60
4
Grow, baby, grow (2)
„
„
„
„
Your goal is to create a constant population of cells, that
is, to keep Po constant at some desired level Pd. You are
to design a proportional controller that can add or
remove cells as a function of the difference between the
actual and desired number of cells.
Assume that any additions/deletions at time n are based
on the measured number of cells at time n−1. Denote the
number of cells added or removed at each step Pinp.
The difference equations
Po[n] = 2Po[n − 1] − 0.5Po[n − 2] + Pinp[n]
Pinp[n] = k(Pd[n] − Po[n − 1])
Grow, baby, grow (3)
„
Draw a block diagram that represents the system
Po[n] = 2Po[n − 1] − 0.5Po[n − 2] + Pinp[n]
Pinp[n] = k(Pd[n] − Po[n − 1])
Delays +
Adders +
Gains
5
6
Stepping Up and Down (1)
„
Use a small number of delays, gains, and 2-input adders
(and no other types of elements) to implement a system
whose response (starting at rest) to a unit-step signal
[1,1,1,…]
is
„
„
First find a system whose unit-sample response is the
desired sequence. The periodicity of 3 suggests that y[n]
depends on y[n − 3].
The resulting difference equation is
y[n] = y[n − 3] + w[n] + 2w[n − 1] + 3w[n − 2].
[1,0,0,…]
[1,2,3,1,2,3,1,…]
„
Stepping Up and Down (2)
[1,2,3,1,2,3,1,…]
Draw a block diagram of your system.
7
8
Stepping Up and Down (3)
Z Transform (1)
„
„
„
Next compute w[n] which is the first difference of x[n]:
w[n] = x[n] − x[n − 1].
The result is the cascade of the first difference and the
previous result.
[1,0,0,…]
[1,2,3,1,2,3,1,…]
Z transform is discrete-time analog of Laplace transform.
Example: Fibonacci system
y[n] = x[n] + y[n − 1] + y[n − 2]
Difference equation:
Y = X + RY + R 2Y
Operator expansion:
System functional:
Y
1
=
X 1− R − R2
Unit-sample response:
h[n] :1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
[1,1,1,…]
What is the relation between system functional and h[n]?
9
10
Z Transform (2)
System functional:
Unit-sample response:
Z Transform (3)
Y
1
=
X 1− R − R2
h[n] :1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
Example: Fibonacci system
Difference equation:
Operator expansion:
y[n] = x[n] + y[n − 1] + y[n − 2]
Y = X + RY + R 2Y
System functional:
Y
1
=
X 1− R − R2
Unit-sample response:
h[n] :1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
What is the relation between system functional and h[n]?
Y
= ∑ h[n]R n
X
n
11
12
Z Transform (4)
Z Transform (5)
Example: Fibonacci system
Series expansion of system functional:
y[n] = x[n] + y[n − 1] + y[n − 2]
Difference equation:
Y
= ∑ h[n]R n
X
n
Y = X + RY + R 2Y
Operator expansion:
System functional:
Y
1
=
X 1− R − R2
Unit-sample response:
h[n] :1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
Substitute R →
Y
= ∑ h[n]R n
X
n
1
z
:
H ( z ) = ∑ h[n]z − n
Å Z transform !
n
What is the relation between H(z) and h[n]?
13
14
Z Transform (7)
Z Transform (6)
Z transform maps a function of discrete time n to a function of z.
Multiple representations of discrete-time systems:
X ( z ) = ∑ x[n]z − n
n
15
16
Z Transform (9)
Z Transform (8)
17
Poles (1)
18
Poles (2)
19
20
Z Transform Example (1)
Z Transform Example (2)
Solve difference equations with Z transforms
21
Z Transform Example (3)
23
22
Z Transform Example (4)
24
Z Transform Example (5)
25
Z Transform Example (7)
27
Z Transform Example (6)
26
Z Transform Example (8)
28
Z Transform Example (9)
Z Transform Example (10)
29
30
Z Transform Example (11)
Partial Fractions
1
x + 2x − 3
The denominator splits into two distinct linear factors :
f ( x) =
2
q ( x) = x 2 + 2 x − 3 = ( x + 3)( x − 1)
A
B
1
⇒ f ( x) = 2
=
+
x + 2x − 3 x + 3 x −1
Multiplying through by x 2 + 2 x − 3, we have the polynomial identity
1 = A( x − 1) + B( x + 3)
Substituting x = -3 into this equation gives A = -1/ 4,
and substituting x = 1 gives B = 1 / 4, so that
f ( x) =
31
1
−1/ 4 1/ 4
+
=
x + 2x − 3 x + 3 x −1
2
32