Você está na página 1de 24

Signals, Systems, and Control (Part #1)

Motivation
Build a laser head on a rotating motor:
Signals, Systems, and Control Target: an arc with LED lights mounting at different angles
Objective: to track which LEDs are on by rotating to the
appropriate angle
Dr. Edmund Lam Components: some light-sensitive resistors, where R when there is
brighter light
Department of Electrical and Electronic Engineering
The University of Hong Kong

ENGG1203: Introduction to Electrical and Electronic Engineering


(Second Semester, 201213)
laser head target
http://www.eee.hku.hk/engg1203

E. Lam (University of Hong Kong) ENGG1203 March, 2013 1 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 2 / 96

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

Initial Analysis Further Requirement


Build the fastest laser head that continuously tracks the light.
Vdd Vdd Can amplify the voltage difference across the motor by a gain k
RL But what is a good value of k?
RL R Too small too slow
Vp
+ Too large overshoot, and therefore oscillation
RR RR motor R
The circuit analysis we have learned so far is insufficient to handle this.
1 Our device is dynamic. As the motor rotates, RL , RR , and therefore
(a) (b) assume connection to motor was buffered Vp change with time. We need a way to represent such a sequence
of voltage values (signals).
Light is to the left: RL Vp motor counter-clockwise. 2 Information about the current position is fed back, via the two
Light is to the right: RR Vp motor clockwise. resistors, to control the motor to a new position.
Light is at center: RL = RR motor stationary.
We will be able to solve this problem entirely after studying signals, systems,
and control!
E. Lam (University of Hong Kong) ENGG1203 March, 2013 3 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 4 / 96
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

Review: Digital Systems Signals and Systems


1 System Diagram
The system diagram applies not only to digital logic (input/output not
system necessarily binary).
input output

2 Digital Logic Primitives system


input signal output signal
AND OR NOT D Flip-flop

D Q
Also called a block diagram
clk
A system maps an input signal to an output signal
A signals and systems abstraction
3 Schematics Boolean expressions
Examples: Combinational logic system, computer system, . . .
y = a b + a b

E. Lam (University of Hong Kong) ENGG1203 March, 2013 5 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 6 / 96

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

Examples A Signals and Systems Viewpoint

Communication system Imaging system


signal: digitized voice (or image or signal: light intensity
video or text) system: consists of lenses, Very diverse applications
system: consists of antenna, base photodetectors
stations, etc output = input? e.g. lens distortion A similar viewpoint: flow of information
output = input? e.g. background
noise filtering
Abstraction: same language (mathematics) to deal with signals
and systems
Financial system Biomedical system Good news: what you learn here is very useful
signal: $$ e.g. Electroencephalography, or EEG (or, why many electrical and electronic engineers are in Wall
system: consists of lots of signal: electrical (voltage) Street, Medicine, Business, Music, Psychology, Linguistics, . . . )
computers system: consists of electrodes and
output = input? A complicated other components
function! output = input?

E. Lam (University of Hong Kong) ENGG1203 March, 2013 7 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 8 / 96
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

Discrete-time Systems Four Different Representations

Objective: Develop different ways to represent and understand a


discrete-time system
system
input signal output signal
Time-domain methods:
Signal flow graph
A system can be very complicated Linear constant-coefficient difference equation (LCCDE)
Goal is to describe the system with simple behaviors or rules
Transform methods:
We restrict ourselves to discrete-time systems, i.e., input and
output signals are a sequence of numbers Operator notation and arithmetics

Conceptually, such discrete systems can be built by representing the z-transform and transfer function
numbers in binary and using lots and lots of combinational and
sequential logic gates They are equivalent representations, but differ in their use.

E. Lam (University of Hong Kong) ENGG1203 March, 2013 9 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 10 / 96

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

#1: Signal flow graph #1: Signal Flow Graph Example


Example (A):
We restrict ourselves to three primitives:
input = {0, 3, 1, 5, 2, 0} output =?
a ka 1
+
1 Multiplication (gain): k 2

(k can be integer, fraction, negative number. . . )


delay (1) 1
a a b b+c 2
+
2 Split/add (adder):
a c Assume: The system has no signal before the input.
1
(A value becomes two identical copies) 0 2 (0) = 0
(Two values added together) 3 1
2 (3) + 1
2 (0) = 3
2
1 1
1 2 (1) + 2 (3) = 1
{a, b, . . .} {0, 0, . . . , 0, a, b, . . .} 5 1
(5) + 1
(1) = 2
3 Delay: delay (d) | {z } 2
1
2
1 7
2 (2) + (5) =
d of them 2 2 2
1 1
(The sequence is delayed by d integer units) 0 2 (0) + 2 (2) = 1
3 7
Hence, output is {0, 2 , 1, 2, 2 , 1}.
E. Lam (University of Hong Kong) ENGG1203 March, 2013 11 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 12 / 96
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 (A): (cont.)
input = {1, 0, 0, 0, . . .} output =?
5 +
4 input
output
3 p delay (1)
2
1 Assume: The system has no signal before the input.
sequence order 11=1
0 1 2 3 4 5
-1 0 0 + p (1) = p
0 0 + p (p) = p2
0 0 + p (p2 ) = p3
Observation: This output is a smoothed version of this input
0 0 + p (p3 ) = p4
Deduction: This discrete-time system achieves smoothing
Hence, output is {1, p, p2 , p3 , . . .}.
E. Lam (University of Hong Kong) ENGG1203 March, 2013 13 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 14 / 96

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

#1: Signal Flow Graph Example #1: Signal Flow Graph Mini-conclusions

Example (B): (cont.) Some conclusions about flow graphs:


1 Given an input, we can follow the flow to deduce the output
3 3 3
2 Hardware implementation by putting in the appropriate
2 2 2
components (assume we have them) according to the flow graph
1 1 1 3 It is not always obvious what the system achieves, but we can guess
0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5
4 Intuitively, some changes to the flow graphs are permitted:
p = 0.8 p = 1.0 p = 1.2 k delay (d) delay (d) k

Observation: This output decays or stays unchanged or grows


k k
without bound for a unit input
Deduction: The behavior of this discrete-time system depends a lot on k
the value of p. This is extremely important for us later on!

E. Lam (University of Hong Kong) ENGG1203 March, 2013 15 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 16 / 96
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#2: Difference Equations #2: Difference Equations: The Mathematics


Look at the input sequence as a discrete-time signal

5
Conventions:
4
3 Signal: x[n] (square bracket)
2 Use x[n] for an input signal, y[n] for an output signal
1
Often n = 0, 1, . . . N 1 for a length-N signal. We may also have an
n
0 1 2 3 4 5 6 7 8 9 10
infinite length signal where n can be any nonnegative integers.
Assume x[n] = 0 outside this range.
Data present at regular time intervals = No input, no output. System is at rest.
Often due to sampling of a continuous signal
Some data are naturally discrete, e.g. daily stock price
For our purpose here, well just assume the input and output signals are
discrete without worrying how they come to be
E. Lam (University of Hong Kong) ENGG1203 March, 2013 17 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 18 / 96

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

#2: Difference Equations: The Mathematics #2: Difference Equations and Flow Graphs

Exercise: Try plotting the following signals The flow graphs now operate on the entire signal (vector vs scalar)
x[n] k x[n]
1 x[n] = Cn , where n = 0, . . . , 99. 1 Multiplication (gain): k
1 = 0.99, C = 10 (k can be integer, fraction, negative number. . . )
2 = 1.00, C = 1
3 = 1.01, C = 0.1 x[n] x[n] x1 [n] x1 [n] + x2 [n]
( 2 Split/add (adder):
+
1 at n = 0 x[n] x2 [n]
2 x[n] =
0 otherwise.
This is the most important signal of all! It is called a delta function or a
(A signal becomes two identical copies)
unit impulse, denoted by [n]. (Two signals added together)
(
1 at n 0
3 x[n] = x[n] x[n d]
0 otherwise. 3 Delay: delay (d)
This is called the unit step function, sometimes denoted by u[n].
(A signal is delayed by d integer units)

E. Lam (University of Hong Kong) ENGG1203 March, 2013 19 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 20 / 96
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

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


Example (A): Example (C): The smoothing system in cascade

1 x[n] w[n] y[n]


x[n] 2 x[n] y[n] = 12 x[n] + 21 x[n 1] 1
+ 1
+
1 2 2
2 +

1 1
1 delay (1) delay (1)
x[n 1] 2 x[n 1] 2 2
delay (1) 1
2
Tedious to go through the flow graph for each point. Make use of
difference equations:
Example (B): 1 1
w[n] = x[n] + x[n 1]
2 2
x[n] y[n] = p y[n 1] + x[n] 1 1
+ y[n] = w[n] + w[n 1]
2 2
1 1 1 1
= x[n] + x[n 1] + x[n 1] + x[n 2]
4 4 4 4
p y[n 1] y[n 1] y[n] 1 
p delay (1) = x[n] + 2x[n 1] + x[n 2] .
4
Effect: further smoothing
E. Lam (University of Hong Kong) ENGG1203 March, 2013 21 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 22 / 96

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

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

Software implementation: e.g. y[n] = p y[n 1] + x[n] Real-time software implementation: e.g. y[n] = p y[n 1] + x[n]

Pseudo-code in the computer Pseudo-code in the computer

outside outside outside outside


p = 0.5; p = 0.5;
y(-1) = 0; y(old) = 0;
A/D D/A A/D D/A
n = 0; REPEAT {
LOAD x; x(new) = INPUT;
REPEAT { y(new) = p * y(old) + x(new);
y(n) = p * y(n-1) + x(n); OUTPUT = y(new);
n = n + 1; y(old) = y(new);
}; };

E. Lam (University of Hong Kong) ENGG1203 March, 2013 23 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 24 / 96
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#2: Difference Equations As Systems #2: Difference Equations Mini-conclusions


Difference equations are sufficient to describe a discrete-time system. Some conclusions about difference equations:

Example: Fibonacci sequence 1 Flow graphs and difference equations are equivalent
Sequence starts with F0 = 1, F1 = 1, and then Fn = Fn1 + Fn2 Can go from flow graphs to difference equations
Sequence goes like this: 1, 1, 2, 3, 5, 8, 13, 21, 34. . . Can go from difference equations to flow graphs
The story is absolutely unrealistic: A certain place starts with one 2 They correspond to different ways of implementation
(pair of) rabbit, and after two months the rabbit starts to give birth Flow graph is more hardware
to one (pair of) rabbit every month. All the offsprings behave Difference equation is more software
similarly, and they never die!
3 A general form of the difference equation:
But the sequence can indeed be observed in nature!

Converting to our notations: y[n] = a1 y[n 1] + a2 y[n 2] + . . . + b0 x[n] + b1 x[n 1] + . . .


Must have a start: x[n] = [n]
y[n] = y[n 1] + y[n 2] + x[n] Hence, the name constant-coefficient

E. Lam (University of Hong Kong) ENGG1203 March, 2013 25 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 26 / 96

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

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


Both flow graphs and difference equations are time-domain methods Motivation: What does y[n] = 12 x[n] + 12 x[n 1] mean?

We compute the results as time passes 5


y[3] = 12 (x[2]) + 12 (x[3])
4
Generally speaking, these methods allow for easy computation of 1 Iterate for different n, e.g., for n = 3:
3
the output 2
1
Not so good with understanding the system behavior
0 1 2 3 4 5
-1
Example: It is easy to compute the Fibonacci sequence one by one, but
can we have a general formula for any number in the sequence? What 2 Scale and add the entire signal together, i.e.,
is the growth rate of the rabbits? If some rabbits were to be shot dead 5 5 5
after giving birth, would the population become stable somehow? 4 4 4
3 12 + 3 12 = 3

As a result, if we want to analyze (understand) and even design a 2 2 2


1 1 1
discrete-time system, we need more advanced tools.
0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5
-1 -1 -1
Next, we turn to transform methods.
E. Lam (University of Hong Kong) ENGG1203 March, 2013 27 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 28 / 96
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) ENGG1203 March, 2013 29 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 30 / 96

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 kX
Example (A):
1 Multiplication (gain): k
1
(k can be integer, fraction, negative number. . . ) X 2X Y = 21 X + 12 DX
1
2 +
X X X1 X1 + X2
+ 1
Split/add (adder): DX 2 DX
2
delay (1) 1
X X2 2

(Two identical copies / signals added together)


1
X Dd X We are allowed to write Y = 2 (1 + D) X. (Multiply out to get the
3 Delay: delay (d)
meaning.)
 
(A signal is delayed by d integer units) There is a direct correspondence with y[n] = 1
x[n] + x[n 1] .
2
(We write Dd X to mean D{. . . D{ X } . . .})
| {z }
d of them
E. Lam (University of Hong Kong) ENGG1203 March, 2013 31 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 32 / 96
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
1
W= 2 (1 + D)X
This gives us a hierarchical way of analyzing a system: look at the
Y= 1
2 (1 + D)W = 12 (1 + D) 21 (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 = 21 (1 + D) and Y = S2 X.

E. Lam (University of Hong Kong) ENGG1203 March, 2013 33 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 34 / 96

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) ENGG1203 March, 2013 35 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 36 / 96
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#3: Operator: Output #3: Operator: Output

Once we understand the system, we can compute the specific output when we Example: Whats the output of the previous system with x[0] = 1,
are given a particular input. x[1] = 1, and x[n] = 0 otherwise?
System unchanged: Y = X + DX D2 X D3 X
Often, we are concerned with an impulse input, x[n] = [n], i.e., it is
X represents [n] + [n 1]
zero everywhere, except x[0] = 1.
Dk X represents [n k] + [n (k + 1)]
Example: Whats the output of the previous system with x[n] = [n]? Output is
Y = X + DX D2 X D3 X ;    
y[n] = [n] + [n 1] + [n 1] + [n 2]
Dk X represents [n k]; therefore,    
Output is y[n] = [n] + [n 1] [n 2] [n 3]. [n 2] + [n 3] [n 3] + [n 4]
You can try tracing the flow graph or the difference equation to see if you can
= [n] + 2[n 1] 2[n 3] [n 4]
arrive at the same result.

E. Lam (University of Hong Kong) ENGG1203 March, 2013 37 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 38 / 96

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

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

Operation notation provides a powerful tool to analyze feedback, If we can work on D algebraically, we can express Y in terms of X:
where output is looped back to the input.
!
Flow graph: 1
Y= X
1 pD
x[n] or X y[n] or Y
+
What does it mean by performing the delay operation in the
denominator?
p delay (1)
Ans: Use the relationship (1 pD)(1 + pD + p2 D2 + . . .) = 1. Therefore,

Difference equation: y[n] = py[n 1] + x[n] Y = (1 + pD + p2 D2 + . . .)X.

Operator equation: Y = pDY + X, or, (1 pD)Y = X Can you also come up with this formula from the flow graph?

E. Lam (University of Hong Kong) ENGG1203 March, 2013 39 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 40 / 96
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#3: Operator Arithmetics for Feedback #3: Operator Arithmetics for Feedback
The corresponding flow graph:
To refresh your memory
X Y
1 1 1 +
Lets say we want to calculate 1 + 2 + 4 + 8 + ...
1 1 1 p delay (1)
1 Let S = 1 + 2 + 4 + 8 + ...
+

2 Then 12 S = 1 1 1 1
2 + 4 + 8 + 16 + ... p2 delay (2) +

3 Then S 21 S = 1 as all subsequent terms cancel .. .. ..


1
4 S= = 2.
1 12 X Y
Alternatively: +
We can then generalize to
p delay (1) +
1
= 1 + a + a2 + a3 + . . . , |a| < 1 p delay (1)
1a +

.. ..
E. Lam (University of Hong Kong) ENGG1203 March, 2013 41 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 42 / 96

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

-2 -2 -2

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

E. Lam (University of Hong Kong) ENGG1203 March, 2013 43 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 44 / 96
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: its
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 (in terms of decay pattern) as X(z) = (3) + (4)z1 + (1)z2 + (1)z3
long as the input is of a finite duration.
X is now a polynomial in terms of z

E. Lam (University of Hong Kong) ENGG1203 March, 2013 45 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 46 / 96

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: Examples:

X(z) = x[0] + x[1]z1 + x[2]z2 + x[3]z3 + . . . x[n] = [n] X(z) = 1


Using the summation symbol, we can write x[n] = [n 1] X(z) = z1
x[n] = [n] + [n 1] X(z) = 1 + z1

X
X(z) = x[n] zn x[n] = 12 [n] + 12 [n 1] X(z) = 12 (1 + z1 )
n=0
1
x[n] = {1, p, p2 , . . .} X(z) = 1 + pz1 + p2 z2 + . . . =
1 pz1
We build X(z) by putting putting x[n] as its coefficients; conversely, (|p| < 1)
we can recover x[n] by reading off the coefficients in X(z).

E. Lam (University of Hong Kong) ENGG1203 March, 2013 47 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 48 / 96
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

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

X, X1 , and X2 are now z-transforms of the time-domain signals. We


The z-transform notation makes it very convenient to represent system omit the (z) when there is no ambiguity.
operations.
X kX
1 Multiplication (gain): k
A delay of one unit is equivalent to multiplication with z1 , since (k can be integer, fraction, negative number. . . )
z1 X(z) = x[0]z1 +x[1]z2 + x[2]z3 + x[3]z4 + . . . X1 X1 + X2
| {z } X X
+
value at time n = 1
2 Split/add (adder):
X X2
A delay of d units is multiplication with zd . (Two identical copies / signals added together)

This is very similar to the operator notation D! You can think of z-transform X zd X
as a practical way of realizing the operations. 3 Delay: delay (d)

(A signal is delayed by d integer units)

E. Lam (University of Hong Kong) ENGG1203 March, 2013 49 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 50 / 96

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

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

Example (A): Example (B):

1
X 2X Y = 12 X + 12 z1 X X Y = pz1 Y + X
1
2 + +

1 1
z1 X 2z X pz1 Y z1 Y Y
delay (1) 1 p delay (1)
2

 
1
We can write Y = 2 1 + z1 X.  
1 pz1 Y = X
There are direct correspondences with:
Y= 1
(1 + D) X 1
2   Y= X
y[n] = 12 x[n] + x[n 1] 1 pz1

E. Lam (University of Hong Kong) ENGG1203 March, 2013 51 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 52 / 96
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

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


Example (C): A second-order feedback system, first with flow graph.
Y(z) Assume g1 = 34 and g2 = 18 :
Define the transfer function H(z) = X(z) . (Well also omit (z) later on)
x[n] y[n]
+
input X output Y = HX
H
+ g1 delay (1)

g2 delay (2)
 
1
Example (A): H = 2 1+ z1 .
11
1 0 0 + 34 (1) = 3
Example (B): H = . 4
1 pz1 0 0 + 34 ( 34 ) + ( 18 )(1) = 7
16
3 7 1 3 15
00+ 4 ( 16 ) + ( 8 )( 4 ) = 64
We call p the pole of the discrete-time system.
3 15 1 7 31
00+ 4 ( 64 ) + ( 8 )( 16 ) = 256

Do you see a pattern?


E. Lam (University of Hong Kong) ENGG1203 March, 2013 53 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 54 / 96

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

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


Using z-transform (g1 = 34 , g2 = 81 ):
We can convert the above second-order feedback system to the
following equivalent form: cascade of two first-order feedback system
X Y = g1 z1 Y + g2 z2 Y + X
+
X W Y
+ +
g1 z1 Y z1 Y Y
+ g1 delay (1)
1 delay (1) 1 delay (1)
2 4
2
g2 z Y z2 Y
g2 delay (2)
 
1 12 z1 W = X
Algebra with polynomials provides a powerful tool for analysis!  
1 14 z1 Y = W
    
1 34 z1 + 18 z2 Y = X = 1 12 z1 1 14 z1 Y = X
  
1 21 z1 1 14 z1 Y = X A corollary: Can also interchange the order of the two systems

E. Lam (University of Hong Kong) ENGG1203 March, 2013 55 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 56 / 96
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:
Further algebra reveals yet another form!
x[n] w[n] y[n]
+ +
1
Y=   X
1 1
1 2z 1 14 z1
1 delay (1) 1 delay (1)

2 4 2 1
= + X
1 12 z1 1 41 z1

1 1 1 1 1
= (2) X +


(1) X

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

Do you see a pattern?


E. Lam (University of Hong Kong) ENGG1203 March, 2013 57 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 58 / 96

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

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


To refresh your memory Another equivalent form: two first-order feedback system in parallel
X Y
+ 2 +
Provided p , q, we can write
C A B 1
= + 2
delay (1)
(1 px)(1 qx) 1 px 1 qx
+ 1
Multiplying out on the right hand side, the numerator means
1
C = A(1 qx) + B(1 px) 4
delay (1)

This is true for any x; so we must have 1 2(1) 1(1) = 1


0 2[0 + 21 (1)] 1[0 + 14 (1)] = 3
4
C=A+B 0 2[0 + 21 ( 12 )] 1[0 + 14 ( 14 )] = 7
16
0 = Aq + Bp 0 2[0 + 1 1
2 ( 4 )] 1[0 +
1 1
4 ( 16 )] = 15
64
1 1 1 1 31
0 2[0 + 2 ( 8 )] 1[0 + 4 ( 64 )] = 256
Solve for A and B with these two equations
Do you see a pattern?
E. Lam (University of Hong Kong) ENGG1203 March, 2013 59 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 60 / 96
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

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


Example (D): A feedback system with a step input

Remember that for a first-order feedback system with gain p, an The input x[n] = {1, 1, 1, . . .}. Following the flow graph, we know
impulse input (x[n] = [n]) gives an output y[n] = {0, 12 , 34 , . . .}. But can we derive a general formula?
1
X 2 (X + Y) Y = 12 (X + Y)z1
n 1 delay (1)
y[n] = p + 2

Hence for our second-order feedback system, we can analytically Y


represent the output as

y[n] = (2)( 21 )n + (1)( 41 )n = ( 12 )n1 ( 41 )n Y = 12 (X + Y)z1


(1 12 z1 )Y = 12 z1 X
This is not obvious at all from the original flow graph analysis!
1 1
Y z
= 2 1
X 1 z1
2

E. Lam (University of Hong Kong) ENGG1203 March, 2013 61 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 62 / 96

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

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


A trick with step input: we can generate it with a delta function!
z-transform allows us to use polynomials to analyze discrete-time
[n] X Y
+ + 1
2
delay (1) systems, particularly feedback systems

The poles are the roots of the polynomial in the denominator


delay (1)
The poles (in particular, the one with the largest magnitude)
determine the stability of the feedback system
1
The red box has transfer function . Partial fraction, as a technique in polynomial manipulation, is
1 z1
The overall system has transfer function very useful to give insight into the system behavior
  1 z1 (Almost all) high-order feedback systems can be turned to a sum
1 2 1 1


= of first-order feedback systems
1 z1 1 12 z1 1 z1 1 12 z1

In time-domain, y[n] = 1 ( 21 )n .
E. Lam (University of Hong Kong) ENGG1203 March, 2013 63 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 64 / 96
Signals, Systems, and Control (Part #1) Signals, Systems, and Control (Part #1)

#3 #4: Transform Conclusions From Signals and Systems to Control


Transform method is less straightforward compared with time-domain
methods, but is more powerful, particularly in design.

Control the rate of decay by designing the poles.


Can break into sub-systems and treat the system hierarchically. Signals and systems provide the mathematical basis
For implementation, can always go back to time-domain. for dealing with dynamic changes. We now move on
to specific problems that involve feedback control,
1 32 z1
Example: H = . Thus, and see how our mathematics can be useful.
1 65 z1 + 16 z2
   
1 56 z1 + 16 z2 Y = 1 32 z1 X
Y 56 z1 Y + 16 z2 Y = X 32 z1 X
y[n] 56 y[n 1] + 16 y[n 2] = x[n] 23 x[n 1]

E. Lam (University of Hong Kong) ENGG1203 March, 2013 65 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 66 / 96

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

Problems that Need Control Problems that Need Control


A design problem: Fix the angle [n] of an antenna. You have
1 A voltage source v[n] (assumed discrete-time) The corresponding discrete-time model:
2 A motor that produces an angular movement proportional to the
voltage input v[n] motor [n]

A possible configuration:
Problems:
Need to know initial angle
Need exact electrical and mechanical characteristics of the motor
Need to give very precise instruction to the voltage source to first
accelerate and then decelerate the motor
+
v This is called an open-loop system, which is generally not desirable.

E. Lam (University of Hong Kong) ENGG1203 March, 2013 67 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 68 / 96
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:

D [n] + gain motor [n]


move by K2 K1 (D )

K1 D K1 (D ) 1
D potentiometer comparator amplifier


gain = K1 K2 . This is our design parameter
K1
potentiometer Can disturb the antenna position the system will correct itself
No need to know initial angle, model the exact electrical and
A desired angle D mechanical characteristics of the motor, or give very precise
Potentiometer maps angle to voltage (K1 ) instruction to the voltage source to first accelerate and then
decelerate the motor
Comparator takes the difference
Amplifier magnifies the input signal (K2 ) This is called a closed-loop system, which is generally desirable!
E. Lam (University of Hong Kong) ENGG1203 March, 2013 69 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 70 / 96

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

Problems that Need Control Mathematics of Feedback Control


Many problems benefit from feedback control. Examples: A general feedback pattern:
 
1 Proper driving: controlling the steering wheel to stay in lane X GY K X GY

desired actual +
driver car X + K(z) Y
position position

GY
What about drunk driving? G(z)

2 Air-conditioning: controlling the room temperature Negative gain is embedded in the + and symbols
desired actual  
thermostat heating/cooling Y = K X GY
temperature temperature

Y K
What if you dont want to turn on and off the air-conditioning too H= =
frequently? X 1 + KG

E. Lam (University of Hong Kong) ENGG1203 March, 2013 71 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 72 / 96
Signals, Systems, and Control (Part #2) Signals, Systems, and Control (Part #2)

Feedback Control Example Feedback Control Example


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

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


Vo
V+ +
Ans: Assume we can build an attenuator G reliably.
+
Build this circuit (V is the feedback):
X + K Y
R2 R1
G
 
R2

y V = Y
If KG  1: independent of the actual value of K, R1 + R2
+
 
Y K 1 x
+ Y = K X V
=
X 1 + KG G

E. Lam (University of Hong Kong) ENGG1203 March, 2013 73 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 74 / 96

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 (B): Stabilization of unstable systems (e.g., microphone echo)
+
X + K Y y[n] = 2y[n 1] + x[n] is an unstable system; can we stabilize it?

1
G=
R2 Ans: Let K = 12z1
and G = z1 .
R1 + R2
+ 1
X + K= 12z1 Y
Assume KG  1: (precise value of K does not matter)

K 1 R1 + R2
H= = G = z1
1 + KG G R2
1
K 1 1
 12z 
1
Resistor values are much more accurate than op amp gain this =
1 + KG 1 + 1 1
 = (1 2z1 ) + z1  = 1 (2 )z1
z
new circuit has much more reliable gain 12z1

Tradeoff: the gain is much smaller, since we need K  1/G is our design parameter. Pick so that |2 | < 1.
This is the non-inverting amplifier we studied!
E. Lam (University of Hong Kong) ENGG1203 March, 2013 75 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 76 / 96
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 x[n]
+
+ 1
y[n]
12z1

measurement
sensor


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

E. Lam (University of Hong Kong) ENGG1203 March, 2013 77 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 78 / 96

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 + ) ()z1 4z2
+ 1
x[n] +
14z2
y[n]

We can make different choices of and .
55
= 9 , = 0:
1
1 z1
55 55 55 55
9 64 128 128
Original system is unstable because H= = 9 2
= +
64
9 4z2 1 16 z 1 34 z1 1 + 34 z1
1 1
1 1 2 2
= = + Therefore, if x[n] = [n], then
1 4z2 (1 + 2z )(1 2z1 ) 1 2z1 1 + 2z1
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.
14z2
= =
1+ 14z2
(1 z1 ) (1 4z2 ) + (1 z ) (1 + ) ()z1 4z2
1

E. Lam (University of Hong Kong) ENGG1203 March, 2013 79 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 80 / 96
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 + ) ()z1 4z2
0.9 1

0.8

0.7 0.8

8 0.6
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 8z1 4z2 1 14 z1 18 z2 1 12 z1 1 + 14 z1
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
"  n  n #
= 9, =0 = 31, = 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) ENGG1203 March, 2013 81 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 82 / 96

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) ENGG1203 March, 2013 83 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 84 / 96
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

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

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

E. Lam (University of Hong Kong) ENGG1203 March, 2013 85 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 86 / 96

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]
f
D [n] + + K T + delay (1) [n]
We can use this transfer function to understand the behavior of
delay (1)
the output with an impulse 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)z1 !
e 1 1 1
H= 1 1
= 1

D [n] + v[n] 1z 1 pz 1z 1 pz1
f
D [n] + + K T + delay (1) [n]

delay (1) f
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) ENGG1203 March, 2013 87 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 88 / 96
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
Lets 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.
p0
Lets 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) ENGG1203 March, 2013 89 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 90 / 96

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 z1
Systems block unchanged: T
0.6 0.6
1 z1
0.4 0.4
Transfer function includes the delay in sensor
0.2 0.2
 
z1
0 0
K T 1z 1 (KT)z1
H=
0 5 10 15 20 0 5 10 15 20
=   =
KT = 0.1 KT = 0.25 D 1 + K T z11 (z1 ) 1 z1 + (KT)z2
2 2 5 1z
4

1.5 1.5 3 Full transfer function including the step input:


2
 
1 (KT)z1
1 1
1
e
H= =
1 z1 1 z1 + (KT)z2
0
0.5 0.5
1
fD

z z

0 0 2
0 5 10 15 20 0 5 10 15 20 0 5 10 15 20
= 1
KT = 0.75 KT = 1.0 KT = 1.1 1z 1 z + (KT)z2
1

E. Lam (University of Hong Kong) ENGG1203 March, 2013 91 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 92 / 96
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 z1 + (KT)z2 = 0
z2 z + KT = 0 1 Feedback allows us to change the system characteristics, e.g. from
p unstable to stable
(1)2 4(1)(KT) 1 1 p
1
So poles are at = 1 4(KT). 2 Feedback allows design parameters
2(1) 2 2
p 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) ENGG1203 March, 2013 93 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 94 / 96

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

Feedback Design: The Antenna Orientation Problem Feedback Design: The Light Tracker

We were motivated to study signals, systems, and control for the light
A postscript: We had some observations earlier that tracker problem:

Vdd Vdd
1
For 4 < (KT) < 1, the system oscillates but still converges RL
RL R
For (KT) = 1, the system oscillates (Hint: what is the magnitude of Vp
the poles?) +

RR RR motor R
For (KT) 1, the system is unstable!

Why? Youll find out if you continue with EEE! (a) (b) assume connection to motor was buffered
To give you a sneak preview, we have included a step-by-step example
in the homework. Very similar to the antenna orientation problem, except the target
angle is sensed from RL and RR rather than set beforehand. You now
know enough to build it in the lab!
E. Lam (University of Hong Kong) ENGG1203 March, 2013 95 / 96 E. Lam (University of Hong Kong) ENGG1203 March, 2013 96 / 96

Você também pode gostar