09 Signals and Systems 4up

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

Signals, Systems, and Control (Part #1)

Review: Digital Systems


1 System Diagram
Signals, Systems, and Control
“system”
input output
Dr. Edmund Lam
with help from Dr. Hayden So and Prof. Y.S. Hung 2 Digital Logic Primitives
Department of Electrical and Electronic Engineering AND OR NOT D Flip-flop
The University of Hong Kong
D Q
ENGG1015: Introduction to Electrical and Electronic Engineering clk
(First Semester, 2012–13)
http://www.eee.hku.hk/˜engg1015 3 Schematics ⇐⇒ Boolean expressions
y = a · b̄ + ā · b

E. Lam (University of Hong Kong) ENGG1015 November, 2012 1 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 2 / 86

Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

Signals and Systems Examples

Communication system Imaging system


The system diagram applies not only to digital logic (input/output not signal: light intensity
signal: digitized voice (or image or
necessarily binary). video or text) system: consists of lenses,
system: consists of antenna, base photodetectors
stations, etc output = input? e.g. lens distortion
“system” output = input? e.g. background
input “signal” output “signal”
noise filtering

Financial system Biomedical system


Also called a block diagram
signal: $$ e.g. Electroencephalography, or EEG
A system maps an input signal to an output signal
system: consists of lots of signal: electrical (voltage)
A “signals and systems” abstraction computers system: consists of electrodes and
Examples: Combinational logic system, computer system, . . . output = input? A complicated other components
function! output = input?

E. Lam (University of Hong Kong) ENGG1015 November, 2012 3 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 4 / 86
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

A “Signals and Systems” Viewpoint Discrete-time Systems

Very diverse applications “system”


input “signal” output “signal”
A similar viewpoint: flow of information
Abstraction: same “language” (mathematics) to deal with signals
A system can be very complicated
and systems
Goal is to describe the system with simple “behaviors” or “rules”
Good news: what you learn here is very useful
We restrict ourselves to discrete-time systems, i.e., input and
(or, why many electrical and electronic engineers are in Wall
output signals are a sequence of numbers
Street, Medicine, Business, Music, Psychology, Linguistics, . . . )
Conceptually, such discrete systems can be built by representing the
numbers in binary and using lots and lots of combinational and
sequential logic gates

E. Lam (University of Hong Kong) ENGG1015 November, 2012 5 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 6 / 86

Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

Four Different Representations #1: Signal flow graph

We restrict ourselves to three “primitives”:


Objective: Develop different ways to represent and understand a
discrete-time system a k·a
1 Multiplication (gain): k
(k can be integer, fraction, negative number. . . )
“Time-domain” methods:
Signal flow graph a a b b+c
+
Linear constant-coefficient difference equation (LCCDE) 2 Split/add (adder):
a c
“Transform” methods: (A value becomes two identical copies)
Operator notation and arithmetics (Two values added together)
z-transform and transfer function
{a, b, . . .} {0, 0, . . . , 0, a, b, . . .}
3 Delay: delay (d) 
They are equivalent representations, but differ in their use. d of them
(The sequence is delayed by d integer units)

E. Lam (University of Hong Kong) ENGG1015 November, 2012 7 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 8 / 86
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#1: Signal Flow Graph Example #1: Signal Flow Graph Example
Example (A):
Example (A): (cont.)
input = {0, 3, −1, 5, 2, 0} output =?
1
2 +
5
4 input
delay (1) 1 output
2 3
2
Assume: The system has no signal before the input.
1
1
0→ 2 · (0) = 0
1 1 3
sequence order
3→ 2 · (3) + 2 · (0) = 2 0 1 2 3 4 5
−1 → 1
· (−1) + 1
· (3) = 1 -1
2 2
1 1
5→ 2 · (5) + 2 · (−1) = 2
2→ 1
2 · (2) + 1
2 · (5) = 7
2 Observation: This output is a smoothed version of this input
1 1
0→ 2 · (0) + 2 · (2) = 1
Deduction: This discrete-time system achieves smoothing
Hence, output is {0, 32 , 1, 2, 72 , 1}.
E. Lam (University of Hong Kong) ENGG1015 November, 2012 9 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 10 / 86

Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#1: Signal Flow Graph Example #1: Signal Flow Graph Example
Example (B):
Example (B): (cont.)
input = {1, 0, 0, 0, . . .} output =?
+ 3 3 3
2 2 2
1 1 1
p delay (1)
0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5
Assume: The system has no signal before the input.
p = 0.8 p = 1.0 p = 1.2
1→1=1
0 → 0 + p · (1) = p
Observation: This output “decays” or “stays unchanged” or “grows
0 → 0 + p · (p) = p2 without bound” for a unit input
0 → 0 + p · (p2 ) = p3
0 → 0 + p · (p3 ) = p4 Deduction: The behavior of this discrete-time system depends a lot on
the value of p. This is extremely important for us later on!
Hence, output is {1, p, p2 , p3 , . . .}.
E. Lam (University of Hong Kong) ENGG1015 November, 2012 11 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 12 / 86
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#1: Signal Flow Graph Mini-conclusions #2: Difference Equations


Look at the input sequence as a discrete-time signal
Some conclusions about flow graphs:
1 Given an input, we can “follow the flow” to deduce the output 5
2 Hardware implementation by putting in the appropriate 4
components (assume we have them) according to the flow graph 3
3 It is not always obvious what the system achieves, but we can guess 2
4 Intuitively, some changes to the flow graphs are permitted: 1

k delay (d) ⇔ delay (d) k 0


n
1 2 3 4 5 6 7 8 9 10

k k Data present at regular time intervals


⇔ Often due to sampling of a continuous signal
Some data are naturally discrete, e.g. daily stock price
k
For our purpose here, we’ll just assume the input and output signals are
discrete without worrying how they come to be
E. Lam (University of Hong Kong) ENGG1015 November, 2012 13 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 14 / 86

Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#2: Difference Equations: The Mathematics #2: Difference Equations: The Mathematics
Exercise: Try plotting the following signals
Conventions:
1 x[n] = Cαn , where n = 0, . . . , 99.
Signal: x[n] (square bracket) 1 α = 0.99, C = 10
Often n = 0, 1, . . . N − 1 for a length-N signal. 2 α = 1.00, C = 1
Assume x[n] = 0 outside this range. 3 α = 1.01, C = 0.1

Use x[n] for an input signal, y[n] for an output signal 2 x[n] = A cos(ωn + φ), where n = 0, . . . , 99.
1 A = 1, φ = 0, ω = 0.01π (low frequency)
2 A = 1, φ = 0, ω = 0.1π (middle frequency)
Alternatives:
3 A = 1, φ = 0, ω = π (high frequency)
1 Can have negative n, e.g., n = −N, −N + 1, . . . N − 1, N for a length 4 A = 1, φ = π/2, ω = π
2N + 1 signal 
1 at n = 0
Can have infinite length signal (conceptually): n = all integers
3 x[n] =
2
0 otherwise.
This is the most important signal of all! It is called a delta function or a
unit impulse, denoted by δ[n].

E. Lam (University of Hong Kong) ENGG1015 November, 2012 15 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 16 / 86
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#2: Difference Equations and Flow Graphs #2: Difference Equations Example
Example (A):
The flow graphs now operate on the entire signal (vector vs scalar)
1
x[n] k · x[n] x[n] 2 x[n] y[n] = 12 x[n] + 12 x[n − 1]
1 Multiplication (gain): k 1
2 +
(k can be integer, fraction, negative number. . . )
1
x[n − 1] 2 x[n − 1]
delay (1) 1
x[n] x[n] x1 [n] x1 [n] + x2 [n] 2
+
2 Split/add (adder):
x[n] x2 [n]
Example (B):
(A signal becomes two identical copies)
(Two signals added together) x[n] y[n] = p · y[n − 1] + x[n]
+
x[n] x[n − d]
3 Delay: delay (d)
p · y[n − 1] y[n − 1] y[n]
p delay (1)
(A signal is delayed by d integer units)

E. Lam (University of Hong Kong) ENGG1015 November, 2012 17 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 18 / 86

Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#2: Difference Equations Example #2: Difference Equations Implementation


Example (C): The smoothing system in cascade
Software implementation: e.g. y[n] = p · y[n − 1] + x[n]
x[n] w[n] y[n]
1
+ 1
+
2 2 “Pseudo-code” in the computer

delay (1) 1
delay (1) 1 outside outside
2 2
p = 0.5;
Tedious to go through the flow graph for each point. Make use of y(-1) = 0;
A/D D/A
difference equations: n = 0;
1 1
LOAD x;
w[n] = x[n] + x[n − 1] REPEAT {
2 2
1 1 y(n) = p * y(n-1) + x(n);
y[n] = w[n] + w[n − 1]
2 2
1 1 1 1
n = n + 1;
= x[n] + x[n − 1] + x[n − 1] + x[n − 2] };
4 4 4 4
1 
= x[n] + 2x[n − 1] + x[n − 2] .
4
Effect: further smoothing
E. Lam (University of Hong Kong) ENGG1015 November, 2012 19 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 20 / 86
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#2: Difference Equations Implementation #2: Difference Equations Mini-conclusions

Real-time software implementation: e.g. y[n] = p · y[n − 1] + x[n] Some conclusions about difference equations:

“Pseudo-code” in the computer 1 Flow graphs and difference equations are equivalent
Can go from flow graphs to difference equations
outside outside Can go from difference equations to flow graphs (Do you know how?)
p = 0.5; 2 They correspond to different ways of implementation
y(old) = 0;
A/D D/A Flow graph is more “hardware”
REPEAT { Difference equation is more “software”
x(new) = INPUT;
y(new) = p * y(old) + x(new); 3 A general form of the difference equation:
OUTPUT = y(new);
y(old) = y(new); y[n] = a1 y[n − 1] + a2 y[n − 2] + . . . + b0 x[n] + b1 x[n − 1] + . . .
};

Hence, the name “constant-coefficient”

E. Lam (University of Hong Kong) ENGG1015 November, 2012 21 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 22 / 86

Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#1– #2: Time-domain Conclusions #3: Operator Notation and Arithmetics


Motivation: What does y[n] = 12 x[n] + 12 x[n − 1] mean?

Both flow graphs and difference equations are “time-domain” methods 5


y[3] = 12 (x[2]) + 12 (x[3])
4
1 Iterate for different n, e.g., for n = 3:
3
We compute the results as time passes 2
Generally speaking, these methods allow for easy computation of 1

the output 0 1 2 3 4 5
-1
Not so good with understanding the system behavior
2 Scale and add the entire signal together, i.e.,
As a result, if we want to analyze (understand) and even design a
5 5 5
discrete-time system, we need more advanced tools. 4 4 4
3 × 12 + 3 × 12 = 3
Next, we turn to “transform” methods. 2 2 2
1 1 1

0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5
-1 -1 -1

E. Lam (University of Hong Kong) ENGG1015 November, 2012 23 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 24 / 86
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#3: Operator Notations #3: Operator Notations

A very important operation is called a delay operation, written as


Assume we have the following: Y = D{X}. It means simultaneously the following:
1 X represents the entire input signal (x[n] for all n). y[0] = 0
2 Y represents the entire output signal (y[n] for all n). y[1] = x[0]
y[2] = x[1]
3 Y = S{X} represents an operation:
..
.
X Y = S{X}
S{·}
y[n] = x[n − 1]
From X, operate on it (called S), and output Y.
Often write this way instead of y[n + 1] = x[n].
e.g. Can think about S in qualitative terms: take X, halving every
value, and then add to a delayed version of X, also halving every value. In this specific case, we can omit the bracket and write Y = DX. It
behaves like ordinary multiplication: e.g. D(X1 + X2 ) = DX1 + DX2 .

E. Lam (University of Hong Kong) ENGG1015 November, 2012 25 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 26 / 86

Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#3: Operator Arithmetics #3: Operator Example


The flow graphs now acts as operators
X k·X Example (A):
1 Multiplication (gain): k
(k can be integer, fraction, negative number. . . ) 1
Y = 12 X + 12 DX
X 1 2X
2 +
X X X1 X1 + X2
+
2 Split/add (adder): 1
X X2 DX 1 2 DX
delay (1) 2
(Two identical copies / signals added together)

X Dd X We are allowed to write Y = 1


(1 + D) X. How to interpret this?
3 Delay: delay (d) 2
 
There is a direct correspondence with y[n] = 12 x[n] + x[n − 1] .
(A signal is delayed by d integer units)
(We write Dd X to mean D{. . . D{ X } . . .})

d of them
E. Lam (University of Hong Kong) ENGG1015 November, 2012 27 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 28 / 86
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#3: Operator Example #3: Operator Example

We can tackle composite flow graphs using operator arithemtics.


We can generalize the cascade system to the following:
Example (B): The smoothing system in cascade

X W Y X W Y
1
+ 1
+ S1 S2
2 2

delay (1) 1 delay (1) 1


2 2
W = S1 X
Y = S2 S1 X
W = 12 (1 + D)X
This gives us a “hierarchical” way of analyzing a system: look at the
Y = 12 (1 + D)W = 12 (1 + D) · 12 (1 + D)X = 14 (1 + 2D + D2 )X “big picture”, then more details of each sub-system, and further details
of each sub-system, etc.
Each of the sub-system is S = 12 (1 + D) and Y = S2 X.

E. Lam (University of Hong Kong) ENGG1015 November, 2012 29 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 30 / 86

Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#3: Operator Example #3: Operator Example


These expressions are algebraically equivalent:
Exercise: What are the respective operator equations? Y = (1 + D)2 (1 − D)X
1 X Y
+ + + Y = (1 + D)(1 − D2 )X
delay (1) delay (1) −1 delay (1) Y = (1 + 2D + D2 )(1 − D)X
Y = (1 + D − D2 − D3 )X
2 X Y
+ +
Hence the earlier three flow graphs are equivalent, as is the following:
delay (1) −1 delay (2)
X Y
3 X Y +
+ +
delay (1) +
−1 delay (1) 2 delay (1) +
−1 delay (2) +
delay (2)

delay (3)

E. Lam (University of Hong Kong) ENGG1015 November, 2012 31 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 32 / 86
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#3: Operator: Output #3: Operator Arithmetics for Feedback

Operation notation provides a powerful tool to analyze feedback,


Once we understand the system, we can compute the specific output when we
where output is “looped back” to the input.
are given a particular input.
Flow graph:
Often, we are concerned with an impulse input: x[n] is zero
everywhere, except x[0] = 1. x[n]/X y[n]/Y
+
Example: What’s the output of the previous system with x[n] = δ[n]?
Y = X + DX − D2 X − D3 X ;
p delay (1)
Dk X represents δ[n − k] ; therefore,
Output is y[n] = δ[n] + δ[n − 1] − δ[n − 2] − δ[n − 3].
Difference equation: y[n] = py[n − 1] + x[n]
You can try tracing the flow graph or the difference equation to see if you can
arrive at the same result. Operator equation: Y = pDY + X, or, (1 − pD)Y = X

E. Lam (University of Hong Kong) ENGG1015 November, 2012 33 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 34 / 86

Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#3: Operator Arithmetics for Feedback #3: Operator Arithmetics for Feedback
If we can work on D algebraically, we can express Y in terms of X: The corresponding flow graph:

X Y

+
1
Y= X
1 − pD p delay (1) +

p2 delay (2) +
What does it mean by “performing the delay operation in the
denominator”?
.. .. ..
Ans: Use the relationship X Y
Alternatively: +
(1 − pD)(1 + pD + p2 D2 + . . .) = 1. (why?)
p delay (1) +

Therefore, p delay (1) +


Y = (1 + pD + p2 D2 + . . .)X.
.. ..
E. Lam (University of Hong Kong) ENGG1015 November, 2012 35 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 36 / 86
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#3: Operator Arithmetics for Feedback #3: Operator Arithmetics for Feedback
“Stable” only if |p| < 1:
3 3 3
If x[n] = δ[n], what is y[n]? 2 2 2

Ans: Y = X + pDX + p2 D2 X + . . . implies 1 1 1

0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5
y[n] = δ[n] + pδ[n − 1] + p2 δ[n − 2] + . . .
p = 0.8 p = 1.0 p = 1.2

We had the same result when we studied the flow graph before! For 3 3 3

this feedback system, {1, 0, 0, . . .} −→ {1, p, p2 , . . .}. 2 2 2

1 1 1

Value of p determines whether the output in response to an impulse input is


0 2 3 5 0 2 3 5 0 2 3 5
stable or not! In particular, three cases: |p| < 1, |p| = 1, |p| > 1.
1 4 1 4 1 4
-1 -1 -1

-2 -2 -2

-3 -3 -3
p = −0.8 p = −1.0 p = −1.2

E. Lam (University of Hong Kong) ENGG1015 November, 2012 37 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 38 / 86

Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#3: Operator Mini-conclusions #4: z-transform and Transfer Function

We now have a good tool to analyze feedback systems. Two (related) questions:
The key to understanding the behavior of a feedback system: think
1 How to mathematically represent X that incorporates “the whole
about what happens to the signal when it goes through a loop or a cycle signal”?
2 How to mathematically represent the operations “multiplication”,
|p| < 1: signal weakens after the loop, so output decays
|p| = 1: signal magnitude remains the same after the loop, so output “addition”, and “delay”?
maintains
|p| > 1: signal is amplified after the loop, so output grows A brilliant way: X is a polynomial where the coefficients are the
various values of x[n].
We are most concerned with an input that is a unit impulse: it’s
called the impulse response convention to use negative power
Example: x[n] = {3, 4, 1, −1}
Feedback gives rise to a persistent response with only a transient input
The system has a “similar” behavior as long as the input is of a X(z) = (3) + (4)z−1 + (1)z−2 + (−1)z−3
finite duration. (Why?)
X is now a polynomial in terms of z

E. Lam (University of Hong Kong) ENGG1015 November, 2012 39 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 40 / 86
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#4: z-transform Notations #4: z-transform Notations

From x[n] to X(z), we call it the “z-transform”: The z-transform notation makes it very convenient to represent system
operations.
X(z) = x[0] + x[1]z−1 + x[2]z−2 + x[3]z−3 + . . .
A delay of one unit is equivalent to multiplication with z−1 , since
Using the summation symbol, we can write
z−1 X(z) = x[0]z−1 +x[1]z−2 + x[2]z−3 + x[3]z−4 + . . .

∞ 
value at time n = 1
X(z) = x[n] z−n
n=0
A delay of d units is multiplication with z−d .

We “build” X(z) by putting putting x[n] as its coefficients; conversely, This is very similar to the operator notation D! You can think of z-transform
we can recover x[n] by reading off the coefficients in X(z). as a “practical way” of realizing the operations.

E. Lam (University of Hong Kong) ENGG1015 November, 2012 41 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 42 / 86

Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#4: z-transform Arithmetics #4: z-transform Example

X, X1 , and X2 are now z-transforms of the time-domain signals. We Example (A):


omit the “(z)” when there is no ambiguity.

X k·X X
1
2X Y = 12 X + 12 z−1 X
1
1 Multiplication (gain): k 2 +
(k can be integer, fraction, negative number. . . )
1 −1
z−1 X 1 2z X
X1 X1 + X2 delay (1) 2
X X
+
2 Split/add (adder):
X X2
 
(Two identical copies / signals added together) We can write Y = 1
2 1 + z−1 X.
There are direct correspondences with:
−d
X z X Y= 1
(1 + D) X
3 Delay: delay (d) 2  
y[n] = 12 x[n] + x[n − 1]
(A signal is delayed by d integer units)

E. Lam (University of Hong Kong) ENGG1015 November, 2012 43 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 44 / 86
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#4: z-transform Example #4: Transfer Function

Example (B): Define the transfer function H(z) =


Y(z)
X(z) . (We’ll also omit “(z)” later on)

X Y = pz−1 Y + X
+ input X output Y = HX
H
pz−1 Y z−1 Y Y
p delay (1)
 
Example (A): H = 1
2 1 + z−1 .
  1
1 − pz−1 Y = X Example (B): H = .
1 − pz−1
1
Y= X The transfer function “blows up” when z = p. Hence, we call p the “pole” of
1 − pz−1 the system.

E. Lam (University of Hong Kong) ENGG1015 November, 2012 45 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 46 / 86

Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#4: z-transform Example #4: z-transform Example


Example (C): A second-order feedback system, first with flow graph. Using z-transform (g1 = 34 , g2 = − 18 ):
Assume g1 = 34 and g2 = − 18 :
X Y = g1 z−1 Y + g2 z−2 Y + X
x[n] y[n] +
+
g1 z−1 Y z−1 Y Y
+ g1 delay (1) + g1 delay (1)

g2 delay (2) g2 z−2 Y


g2 z−2 Y
delay (2)
1→1
0 → 0 + 34 (1) = 3
4
Algebra with polynomials provides a powerful tool for analysis!
0 → 0 + 34 ( 34 ) + (− 18 )(1) = 7
16
 
1 − 34 z−1 + 18 z−2 Y = X
3 7 1 3 15
0→0+ 4 ( 16 ) + (− 8 )( 4 ) = 64
0→0+ 3 15 1 7 31
4 ( 64 ) + (− 8 )( 16 ) = 256
  
1 − 12 z−1 1 − 14 z−1 Y = X
Do you see a pattern?
E. Lam (University of Hong Kong) ENGG1015 November, 2012 47 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 48 / 86
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#4: z-transform Example #4: z-transform Example


Verify with flow graph using {1, 0, 0, . . .} as input:
We can convert the above second-order feedback system to the
following equivalent form: cascade of two first-order feedback system x[n] w[n] y[n]
+ +
X W Y
+ +
1 delay (1) 1 delay (1)
2 4
1 delay (1) 1 delay (1)
2 4

1→ 1 →1
 
1 − 12 z−1 W = X 0→ 0 + 12 (1) = 1
2 → 12 + 14 (1) = 3
4
  1 1 3 7
1 − 14 z−1 Y = W 0→ 0 + 12 ( 12 ) = 1
4 → 4 + 4 ( 4 ) = 16
   0→ 0 + 12 ( 14 ) = → 1 1 7 15
8 + 4 ( 16 ) = 64
1
=⇒ 1 − 12 z−1 1 − 14 z−1 Y = X 8
1 1 15 31
0→ 0 + 12 ( 18 ) = 1
16 → 16 + 4 ( 64 ) = 256
A corollary: Can also interchange the order of the two systems
Do you see a pattern?
E. Lam (University of Hong Kong) ENGG1015 November, 2012 49 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 50 / 86

Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#4: z-transform Example #4: z-transform Example


Another equivalent form: two first-order feedback system in parallel
Further algebra reveals yet another form! X Y
+ 2 +
1
Y=   X
1 − 12 z−1 1 − 14 z−1 1
2
delay (1)
⎛ ⎞
⎜⎜ 2 −1 ⎟⎟ + −1
= ⎜⎜⎝ + ⎟⎟⎠ X (why?)
1 − 12 z−1 1 − 14 z−1
⎛ ⎞ ⎛ ⎞ 1
⎜⎜ 1 ⎟⎟ ⎜⎜ 1 ⎟⎟ 4
delay (1)
= ⎜⎝⎜ ⎟⎟ · (2) · X + ⎜⎜
⎠ ⎝
⎟⎟ · (−1) · X

1 − 12 z−1 1 − 41 z−1 1 → 2(1) − 1(1) = 1
0 → 2[0 + 12 (1)] − 1[0 + 14 (1)] = 3
4
1
Two first-order feedback system in parallel. Poles are at 2 and 14 . 0 → 2[0 + 1 1 1 1 7
2 ( 2 )] − 1[0 + (
4 4 )] = 16
1 1 1 1 15
0 → 2[0 + 2 ( 4 )] − 1[0 + 4 ( 16 )] = 64
The mathematics is called partial fraction.
1 1 1 1 31
0 → 2[0 + 2 ( 8 )] − 1[0 + 4 ( 64 )] = 256

Do you see a pattern?


E. Lam (University of Hong Kong) ENGG1015 November, 2012 51 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 52 / 86
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#4: z-transform Example #4: z-transform Example Mini-conclusions

z-transform allows us to use polynomials to analyze discrete-time


Remember that for a first-order feedback system with gain p, an
systems, particularly feedback systems
impulse input (x[n] = δ[n]) gives an output

The poles are the roots of the polynomial in the denominator


y[n] = pn
The poles (in particular, the one with the largest magnitude)
determine the stability of the feedback system
Hence for our second-order feedback system, we can analytically
represent the output as Partial fraction, as a technique in polynomial manipulation, is
very useful to give insight into the system behavior
y[n] = (2)( 12 )n + (−1)( 14 )n = ( 12 )n−1 − ( 14 )n
(Almost all) high-order feedback systems can be turned to a sum
This is not obvious at all from the original flow graph analysis! of first-order feedback systems

E. Lam (University of Hong Kong) ENGG1015 November, 2012 53 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 54 / 86

Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #2)

#3 – #4: Transform Conclusions Problems that Need Control


Transform method is less straightforward compared with time-domain A design problem: Fix the angle θ[n] of an antenna. You have
methods, but is more powerful, particularly in design. 1 A voltage source v[n] (assumed discrete-time)
2 A motor that produces an angular movement proportional to the
Control the rate of decay by designing the poles. voltage input
Can break into sub-systems and treat the system hierarchically.
A possible configuration:
For implementation, can always go back to time-domain.

1 − 32 z−1
Example: H = . Thus,
1 − 56 z−1 + 16 z−2
   
1 − 65 z−1 + 16 z−2 Y = 1 − 32 z−1 X
+
Y − 56 z−1 Y + 16 z−2 Y = X − 32 z−1 X v − θ
y[n] − 56 y[n − 1] + 16 y[n − 2] = x[n] − 32 x[n − 1]

E. Lam (University of Hong Kong) ENGG1015 November, 2012 55 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 56 / 86
Signals, Systems, and Control (Part #2) Signals, Systems, and Control (Part #2)

Problems that Need Control Problems that Need Control


Modification by adding feedback control:

The corresponding discrete-time model:


move by K2 K1 (θD − θ)
v[n] motor θ[n]
K1 θD K1 (θD − θ)
θD potentiometer comparator amplifier
Problems:
θ
Need to know initial angle
Need exact electrical and mechanical characteristics of the motor K1 θ
potentiometer
Need to give very precise instruction to the voltage source to first
accelerate and then decelerate the motor
A desired angle θD
This is called an open-loop system, which is generally not desirable. Potentiometer maps angle to voltage (K1 )
Comparator takes the difference
Amplifier magnifies the input signal (K2 )
E. Lam (University of Hong Kong) ENGG1015 November, 2012 57 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 58 / 86

Signals, Systems, and Control (Part #2) Signals, Systems, and Control (Part #2)

Problems that Need Control Problems that Need Control


The corresponding discrete-time model: Many problems benefit from feedback control. Examples:

θD [n] + gain motor θ[n] 1 Proper driving: controlling the steering wheel to stay in lane
desired actual
driver car
−1 position position

What about drunk driving?


gain = K1 K2 . This is our design parameter
Can disturb the antenna position — the system will correct itself 2 Air-conditioning: controlling the room temperature
No need to know initial angle, model the exact electrical and desired actual
thermostat heating/cooling
mechanical characteristics of the motor, or give very precise temperature temperature
instruction to the voltage source to first accelerate and then
decelerate the motor What if you don’t want to turn on and off the air-conditioning too
This is called a closed-loop system, which is generally desirable! frequently?
E. Lam (University of Hong Kong) ENGG1015 November, 2012 59 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 60 / 86
Signals, Systems, and Control (Part #2) Signals, Systems, and Control (Part #2)

Mathematics of Feedback Control Feedback Control Example


A general feedback pattern: Example (A): Reliable amplification with a constant K
 
X − GY K X − GY X K Y

+ K is huge (K  1) but unreliable. How to build a reliable gain system?


X + K(z) Y

Ans: Assume we can build an attenuator G reliably.
GY
G(z)
+
X + K Y

Negative gain is embedded in the “+” and “−” symbols G
 
Y = K X − GY
If KG  1: independent of the actual value of K,
Y K Y K 1
H= = = ≈
X 1 + KG X 1 + KG G

E. Lam (University of Hong Kong) ENGG1015 November, 2012 61 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 62 / 86

Signals, Systems, and Control (Part #2) Signals, Systems, and Control (Part #2)

Feedback Control Example Feedback Control Example


Example (A): (cont.) Reliable amplification using circuits Example (A): (cont.) Reliable amplification using circuits
 
Use an operational amplifier (op amp) where Vo = K V+ − V− +
X + K Y

V− −
R2
Vo G=
V+ + R1 + R2

Build this circuit (V− is the feedback): Assume KG  1: (precise value of K does not matter)
R2 R1 K 1 R1 + R2
H= ≈ =
1 + KG G R1
 
R2

y V− = Y
R1 + R2 Resistor values are much more accurate than op amp gain → this
+
 
x
+
− Y = K X − V− new circuit has much more reliable gain
Tradeoff: the gain is much smaller, since we need K  1/G
Called non-inverting amplifier
E. Lam (University of Hong Kong) ENGG1015 November, 2012 63 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 64 / 86
Signals, Systems, and Control (Part #2) Signals, Systems, and Control (Part #2)

Feedback Control Example Feedback Control Example


Example (B): Inverse system design
Example (C): Stabilization of unstable systems (e.g., microphone echo)
y[n] = 12 (x[n] + x[n − 1]) has a smoothing effect; can we undo it?
y[n] = 2y[n − 1] + x[n] is an unstable system; can we stabilize it?
Ans: Let G = 1
2 (1 + z−1 ), so Y = GX. Pass y[n] through:
Ans: Let K = 1
1−2z−1
and G = ρz−1 .
+
Y + K W
− + 1
X + K= 1−2z−1 Y

G(z) = 12 (1 + z−1 )
G = ρz−1
Assume KG(z)  1: (we’ll ignore what that really means for a polynomial in
1
z for now) K −1 1 1
=  1−2z    =  −1  =
W K 1 1 + KG 1 + 1
ρz−1
−1
(1 − 2z ) + ρz 1 − (2 − ρ)z−1
H= = ≈ 1−2z−1
Y 1 + KG G
   ρ is our design parameter. Pick ρ so that |2 − ρ| < 1.
1
Hence, W = HY ≈ G X = X.
G
E. Lam (University of Hong Kong) ENGG1015 November, 2012 65 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 66 / 86

Signals, Systems, and Control (Part #2) Signals, Systems, and Control (Part #2)

Feedback Design Feedback Control Design Example


A more generic setup of feedback loop
Example (A):
+ error input
reference + controller system output
− + ρ 1
x[n] + 1−2z−1
y[n]

measurement
sensor

ρ ρ
controller = C(z), system/plant = P(z), sensor = G(z) Y −1 ρ 1+ρ
= 1−2z ρ = −1
=  
P(z) may be unstable X 1+ (1 + ρ) − 2z 2
1 − 1+ρ z−1
1−2z−1
Design C and G such that the closed-loop system
Bigger ρ means a smaller pole
CP
H= is stable e.g. x[n] = δ[n], then a smaller pole means y[n] → 0 faster
1 + CPG

E. Lam (University of Hong Kong) ENGG1015 November, 2012 67 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 68 / 86
Signals, Systems, and Control (Part #2) Signals, Systems, and Control (Part #2)

Feedback Control Design Example Feedback Control Design Example


Example (B): ρ
Example (B): (cont.) H =
(1 + ρ) − (ρσ)z−1 − 4z−2
+ ρ 1
x[n] + 1−4z−2
y[n]

We can make different choices of ρ and σ.
55
1 ρ= 9 , σ = 0:
1 − σz−1
55 55 55 55
9 64 128 128
Original system is unstable because H= = 9 −2
= +
64
9 − 4z−2 1 − 16 z 1 − 34 z−1 1 + 34 z−1
1 1
1 1
= = + 2 2
Therefore, if x[n] = δ[n], then
1 − 4z−2 (1 + 2z−1 )(1 − 2z−1 ) 1 − 2z−1 1 + 2z−1
   n  ⎧  n
Overall feedback system: 55 3 n 3 ⎪
⎨ 55 3
if n is even.
y[n] = + − =⎪

64 4
ρ 128 4 4 0 if n is odd.
1−4z−2 ρ ρ
ρ = =
1 + 1−4z−2 (1 − σz ) (1 − 4z ) + ρ(1 − σz ) (1 + ρ) − (ρσ)z−1 − 4z−2
−1 −2 −1

E. Lam (University of Hong Kong) ENGG1015 November, 2012 69 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 70 / 86

Signals, Systems, and Control (Part #2) Signals, Systems, and Control (Part #2)

Feedback Control Design Example Feedback Control Design Example


Example (B): (cont.)
ρ
Example (B): (cont.) H =
(1 + ρ) − (ρσ)z−1 − 4z−2
0.9 1

0.8

0.7 0.8

0.6
8
2 ρ = 31, σ = 31 : 0.5
0.6

0.4
31 31 2 31 1 0.4
31 32 32 · 3 32 · 3 0.3
H= = = +
32 − 8z−1 − 4z−2 1 − 14 z−1 − 18 z−2 1 − 12 z−1 1 + 14 z−1
0.2 0.2
0.1

0 0
Therefore, if x[n] = δ[n], then
0 2 4 6 8 10 0 2 4 6 8 10
55 8
ρ= 9, σ=0 ρ = 31, σ =
  n  n  31
31 1 1
y[n] = 2 + − poles at 34 , − 34 poles at 12 , − 14
96 2 4
Decay is determined by the larger of the two poles (magnitude < 1)

E. Lam (University of Hong Kong) ENGG1015 November, 2012 71 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 72 / 86
Signals, Systems, and Control (Part #2) Signals, Systems, and Control (Part #2)

Feedback Design: The Antenna Orientation Problem Feedback Design: The Antenna Orientation Problem
Set the input angle, and expect the output to follow
Input is θD [n]. Output is θ[n]
Sensor senses current angle to feed back to the input
move by K2 K1 (θD − θ)
θs [n] = θ[n]
K1 θ D K1 (θD − θ)
θD potentiometer comparator amplifier Controller produces an angular velocity proportional to the difference
between desired angle and sensed data
θ
K1 θ
v[n] = K(θD [n] − θs [n])
potentiometer
System turns the angle of the antenna from the “previous angle” to the
“current angle” (based on the previous angular velocity!)
Connect the “specific problem” to the “general model”
θ[n] = θ[n − 1] + Tv[n − 1]
+ error input
reference + controller system output
− where T is the time between the discrete samples (fixed beforehand)
measurement
sensor Design question: How to choose K?

E. Lam (University of Hong Kong) ENGG1015 November, 2012 73 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 74 / 86

Signals, Systems, and Control (Part #2) Signals, Systems, and Control (Part #2)

Feedback Design: The Antenna Orientation Problem Feedback Design: The Antenna Orientation Problem
system
Equation: controller
θ[n] = θ[n − 1] + KT(θD [n − 1] − θ[n − 1]) + v[n]
θD [n] + K T + delay (1) θ[n]

Flow graph:

controller system θs [n]


sensor
Within the system block, we have a feedback with positive loop! Hence,
+ v[n]
θD [n] + K T + delay (1) θ[n] transfer function within this block has minus in the denominator:

z−1

1−z−1
θs [n] Substituting this into the system block, we can apply the feedback
sensor equation again to get
 
z−1
Make use of the mathematics of feedback control to find the transfer Θ K T · 1−z−1 (KT)z−1
H= =  =
function of the entire process ΘD 1 + K T · z −1
−1
1 − (1 − KT)z−1
1−z

E. Lam (University of Hong Kong) ENGG1015 November, 2012 75 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 76 / 86
Signals, Systems, and Control (Part #2) Signals, Systems, and Control (Part #2)

Feedback Design: The Antenna Orientation Problem Feedback Design: The Antenna Orientation Problem

θD [n] + v[n]

θD [n] + + K T + delay (1) θ[n]
We can use this transfer function to understand the behavior of −
delay (1)
the output with an inpulse input.
θs [n]
But what we want is a bit different: we want to understand the
behavior of the output with an input staying at a certain angle.
Let p = 1 − KT. Overall transfer function:
Change to the following system!   (1 − p)z−1

= 1 1 1
H = −
θD [n] + v[n] 1 − z−1 1 − pz−1 1 − z−1 1 − pz−1

θD [n] + + K T + delay (1) θ[n]

delay (1) 
Thus, if θD [n] is an impulse input, output is a difference of two
geometrically decaying sequences, i.e.
θs [n]
θ[n] = (1)n − (p)n = 1 − pn

E. Lam (University of Hong Kong) ENGG1015 November, 2012 77 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 78 / 86

Signals, Systems, and Control (Part #2) Signals, Systems, and Control (Part #2)

Feedback Design: The Antenna Orientation Problem Feedback Design: The Antenna Orientation Problem
What if sensor feeds back to the input with a delay, i.e.
θs [n] = θ[n − 1]
θ[n] = 1 − pn
Adding delay tends to destabilize the system
Interpretations: Difficult to have an intuitive way to set K
Let’s say a value of 1 means 30◦ . We give an impulse input, or
controller system
equivalently keep θD [n] = 1, leads to θ[n] = 1 − pn , which
approaches 1 when |p| < 1 and n → ∞.
+ v[n]
Best value of p: p = 0, i.e. KT = 1. θD [n] + K T + delay (1) θ[n]

Note that lim p0 = 1. So, output is 1 only when n ≥ 1.
p→0
Let’s say we get a discrete sample every one second, i.e. T = 1s. If
we want to turn 30◦ (a value of 1 in our discrete model), then we delay (1)
should set K = 30◦ per second (to multiply the input). θs [n]

This makes perfect sense! We will be done in one step. sensor

E. Lam (University of Hong Kong) ENGG1015 November, 2012 79 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 80 / 86
Signals, Systems, and Control (Part #2) Signals, Systems, and Control (Part #2)

Feedback Design: The Antenna Orientation Problem Feedback Design: The Antenna Orientation Problem
1 1 Develop the transfer function


0.8 0.8 z−1
Systems block unchanged: T ·
0.6 0.6
1 − z−1
0.4 0.4
Transfer function includes the delay in sensor
0.2 0.2
 
z−1
0 0
Θ K T · 1−z−1 (KT)z−1
 
0 5 10 15 20 0 5 10 15 20
H= = =
KT = 0.1 KT = 0.25 ΘD 1 + K T · z−1−1 (z−1 ) 1 − z−1 + (KT)z−2
2 2 5 1−z
4

1.5 1.5 3 Full transfer function including the “step” input:


 
2

(KT)z−1
1 1

= Θ = 1
1

H
D 1 − z−1 1 − z−1 + (KT)z−2
0

Θ
0.5 0.5
−1

z z
= −
0 0 −2
0 5 10 15 20 0 5 10 15 20 0 5 10 15 20

1−z −1 1 − z + (KT)z−2
−1
KT = 0.75 KT = 1.0 KT = 1.1

E. Lam (University of Hong Kong) ENGG1015 November, 2012 81 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 82 / 86

Signals, Systems, and Control (Part #2) Signals, Systems, and Control (Part #2)

Feedback Design: The Antenna Orientation Problem Feedback Design: The Antenna Orientation Problem

Poles are the values where the denominator is zero, i.e.


Some conclusions about feedback control:
1 − z−1 + (KT)z−2 = 0
z2 − z + KT = 0 1 Feedback allows us to change the system characteristics, e.g. from
 unstable to stable
(−1)2 − 4(1)(KT) 1 1 

So poles are at = ± 1 − 4(KT). 2 Feedback allows design parameters
2(1) 2 2
 3 The mathematics of z-transform and pole locations are powerful
For 0 < (KT) < 14 : the larger of the pole is 12 + 12 1 − 4(KT). It is
tools to analyze discrete-time systems and feedback
smallest when KT = 14 .
4 We now can analyze and design a system that would be impossible to do
Smaller values of KT also works, but not as good (due to a larger otherwise!
pole).

Sensor delay results in slower response.

E. Lam (University of Hong Kong) ENGG1015 November, 2012 83 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 84 / 86
Signals, Systems, and Control (Part #2) Signals, Systems, and Control (Part #2)

Feedback Design: The Antenna Orientation Problem The Way Forward

First Year Second Year Third Year


A postscript: We had some observations earlier that

1 ELEC 3222:
For 4 < (KT) < 1, the system oscillates but still converges Robotics

For (KT) = 1, the system oscillates (Hint: what is the magnitude of ELEC 3206: Con-
trol Systems
the poles?) ELEC 2205: Con-
trol and Instrumen-
tation
For (KT) ≥ 1, the system is unstable! ENGG 1015
ELEC 2201: Sig-
nals and Linear
Systems
ELEC 2204: Digital
Why? You’ll find out if you continue with EEE! Signal Processing
ELEC 3225: Digital
Image Processing
ELEC 3224: Multi-
media Signals and
Applications

E. Lam (University of Hong Kong) ENGG1015 November, 2012 85 / 86 E. Lam (University of Hong Kong) ENGG1015 November, 2012 86 / 86

You might also like