Вы находитесь на странице: 1из 211

Course Notes and Laboratory Manual

for ENEL 441: Control Systems I


David Westwick and Chris Macnab
Department of Electrical and Computer Engineering
University of Calgary
c 2004
Contents
1 Laplace Transforms 11
1.1 Denition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.1.1 Example: Unit Step Function . . . . . . . . . . . . . . . . . . . . . . 11
1.1.2 Example: Decaying Exponential . . . . . . . . . . . . . . . . . . . . . 11
1.2 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.2.1 Linearity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.2.2 Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.2.3 Dierentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.2.4 Convolution Integral . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.2.5 Final Value Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.2.6 Example: FVT in action . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.2.7 Initial Value Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2 Inverse Laplace Transform 14
2.1 Formal Denition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2 Partial Fraction Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2.1 Example: Distinct Poles . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.2.2 Avoiding the Inverse Transform . . . . . . . . . . . . . . . . . . . . . 16
2.3 Special Cases of the Inverse Laplace Transform . . . . . . . . . . . . . . . . 17
2.3.1 What if n = m? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.3.2 Repeated Poles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.4 Complex Poles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4.1 Completing the Square . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.4.2 Expansion with Complex First-Order Poles . . . . . . . . . . . . . . . 20
2.4.3 Graphical Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3 Transfer Functions and Block Diagrams 22
3.1 More Block Diagram Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2 Example: Simplifying a Block Diagram . . . . . . . . . . . . . . . . . . . . . 24
3.2.1 Option 1: Just use Algebra . . . . . . . . . . . . . . . . . . . . . . . 25
3.2.2 Option 2: Block Diagram Manipulation . . . . . . . . . . . . . . . . . 25
3.2.3 Which approach is better? . . . . . . . . . . . . . . . . . . . . . . . . 26
3.3 Multiple Input Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4 Case Study: Cruise Control System 28
4.1 Dynamic Modelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.2 A Control System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
5 Mathematical Models of Dynamic Systems 33
5.1 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.2 Mathematical Models of Linear Mechanical Motion . . . . . . . . . . . . . . 34
5.2.1 Mass/Spring systems . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.2.2 Mass/Damper systems . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2
5.3 Linear Motion with Gravity . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.3.1 Linearizing the System . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.3.2 Example: A car suspension . . . . . . . . . . . . . . . . . . . . . . . 39
5.3.3 Simulations using quarter-car model . . . . . . . . . . . . . . . . . . 41
5.4 Rotational Mechanical Systems . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.5 Example: System with gears . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6 DC Motors 48
6.1 Field Controlled Motors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
6.1.1 An external load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
6.2 Armature Controlled Motors . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
6.3 Linearization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.4 Example: Nonlinear Spring . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
7 Transient Response Analysis: 56
7.1 First-Order Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
7.1.1 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
7.2 Transient Response of Second-Order Systems . . . . . . . . . . . . . . . . . . 61
7.2.1 Peak Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
7.2.2 Peak Overshoot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
7.2.3 Settling Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
7.2.4 Rise Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
7.2.5 10/90 Rise Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
7.3 Dominant-Poles of Higher-Order Systems. . . . . . . . . . . . . . . . . . . . 69
7.3.1 Graphical Transfer Function Evaluation . . . . . . . . . . . . . . . . 69
7.3.2 Two Complex Poles . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
7.3.3 Case 1: An Extra Zero . . . . . . . . . . . . . . . . . . . . . . . . . . 72
7.3.4 Case 2: An extra pole . . . . . . . . . . . . . . . . . . . . . . . . . . 74
7.3.5 Case 3: Extra Pole/Zero Pairs . . . . . . . . . . . . . . . . . . . . . . 75
7.4 Estimating Pole Locations from Step Responses . . . . . . . . . . . . . . . . 76
8 Stability 78
8.1 Marginal Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
8.2 Instability in the Real World . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
8.3 Testing for Stabiliy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
8.3.1 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
8.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
8.5 Designing for Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
8.5.1 Stability as a Function of Gain . . . . . . . . . . . . . . . . . . . . . 83
8.5.2 Evaluating Stability as a Function of zero position . . . . . . . . . . . 84
8.6 Special Cases: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
8.6.1 Zero in the rst column . . . . . . . . . . . . . . . . . . . . . . . . . 84
8.6.2 A whole row of zeros . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
3
9 Steady State Errors 87
9.1 Systems with no poles or zeros at the origin . . . . . . . . . . . . . . . . . . 87
9.2 Design Example: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
9.3 Systems with one pole at s = 0 . . . . . . . . . . . . . . . . . . . . . . . . . 89
9.3.1 Unit ramp input without integrators.... . . . . . . . . . . . . . . . . . 90
9.4 Systems with 2 poles at s = 0 . . . . . . . . . . . . . . . . . . . . . . . . . . 90
9.4.1 Static Acceleration Error Constant . . . . . . . . . . . . . . . . . . . 91
9.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
9.6 Caveat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
10 PID Controllers 93
10.1 Example: Position Control of a DC motor . . . . . . . . . . . . . . . . . . . 93
10.1.1 PD control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
10.1.2 PI Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
11 Root Locus Plots. 97
11.1 Drawing Root Locus Plots Directly . . . . . . . . . . . . . . . . . . . . . . . 99
11.2 Points on the Real Axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
11.2.1 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
11.2.2 Example II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
11.3 Complex Poles (or zeros) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
11.3.1 Rule 1 for Root Locus Plots . . . . . . . . . . . . . . . . . . . . . . . 103
11.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
11.5 Open Loop Poles and Zeros . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
11.5.1 Rule 2 for Root Locus Plots . . . . . . . . . . . . . . . . . . . . . . . 105
11.6 Zeros at Innity and Asymptotes . . . . . . . . . . . . . . . . . . . . . . . . 105
11.6.1 Rule 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
11.6.2 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
11.7 Departure Angles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
11.8 Example: Breakaway Points . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
11.9 Finding the Breakaway Point . . . . . . . . . . . . . . . . . . . . . . . . . . 112
11.9.1 Treating K as a function of s . . . . . . . . . . . . . . . . . . . . . . 112
11.9.2 Back to the Example: . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
12 Control System Design using Root Locus Plots 117
12.1 Example: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
12.2 PD Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
12.3 Lead Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
12.4 Practical Design of Lead Controllers . . . . . . . . . . . . . . . . . . . . . . 121
12.5 Pole-Zero Cancellation Solution . . . . . . . . . . . . . . . . . . . . . . . . . 122
13 Frequency Response Models and Bode Diagrams 123
13.1 Response of Linear Systems to Sinusoids . . . . . . . . . . . . . . . . . . . . 123
13.2 Bode Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
13.3 Plotting Bode Diagrams of Transfer Functions . . . . . . . . . . . . . . . . . 125
4
13.3.1 Bode Plot of A Gain, K . . . . . . . . . . . . . . . . . . . . . . . . . 125
13.3.2 s in the numerator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
13.3.3 s in the denominator . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
13.3.4 Real Zero . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
13.3.5 Real Pole . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
13.4 Example: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
13.5 Bode Diagrams for Second-Order poles and zeros . . . . . . . . . . . . . . . 132
13.5.1 Low Frequency Behaviour . . . . . . . . . . . . . . . . . . . . . . . . 133
13.5.2 High Frequency Behaviour . . . . . . . . . . . . . . . . . . . . . . . . 133
13.5.3 What happens near =
n
? . . . . . . . . . . . . . . . . . . . . . . . 134
13.5.4 Recipe for dealing with complex poles . . . . . . . . . . . . . . . . . . 136
13.6 Steady State Error Behaviour . . . . . . . . . . . . . . . . . . . . . . . . . . 137
13.6.1 Review of Static Error Constants . . . . . . . . . . . . . . . . . . . . 137
13.6.2 Type 0 systems and K
p
. . . . . . . . . . . . . . . . . . . . . . . . . . 137
13.6.3 Type 1 systems and K
v
. . . . . . . . . . . . . . . . . . . . . . . . . . 138
13.6.4 Type-2 systems, and K
a
. . . . . . . . . . . . . . . . . . . . . . . . . 141
14 Checking Stability using Bode Diagrams 142
14.1 Using G(s) as a mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
14.1.1 The image of a contour . . . . . . . . . . . . . . . . . . . . . . . . . . 143
14.1.2 Mapping a pole . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
14.1.3 Back to Complex Mappings and Transfer Functions . . . . . . . . . . 144
14.2 Innite Contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
14.3 Nyquist Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
14.4 Drawing the Nyquist Plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
14.5 Determining Stability Using the Nyquist Plot . . . . . . . . . . . . . . . . . 149
14.6 Closed Loop Stability of KG(s) . . . . . . . . . . . . . . . . . . . . . . . . . 151
14.6.1 Gain Margin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
14.6.2 Phase Margin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
15 Frequency Response Methods for Controller Design 155
15.1 Proportional Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
15.1.1 Example: Using a Proportional Controller . . . . . . . . . . . . . . . 156
15.2 Lag Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
15.2.1 Example: Using a Lag Controller . . . . . . . . . . . . . . . . . . . . 159
15.3 Lead Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
15.3.1 Example: Lead Compensation . . . . . . . . . . . . . . . . . . . . . . 161
16 State Space Models 165
16.1 RC Ladder Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
16.2 The Concept of State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
16.3 Multiple Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
16.4 RLC Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
16.5 Multiple Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
16.6 State Space Models of Mechanical Systems . . . . . . . . . . . . . . . . . . . 170
5
16.6.1 Example: The car suspension (revisited) . . . . . . . . . . . . . . . . 171
16.7 State Space Models and Transfer Functions . . . . . . . . . . . . . . . . . . . 172
16.7.1 Transfer Function of the RLC example . . . . . . . . . . . . . . . . . 173
16.8 Other Choices of State Vector . . . . . . . . . . . . . . . . . . . . . . . . . . 175
16.9 From Transfer Function to State Space . . . . . . . . . . . . . . . . . . . . . 177
16.9.1 Special Case: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
16.9.2 Check: Compute the Transfer Function . . . . . . . . . . . . . . . . . 177
16.9.3 General Case: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
A Lab Policies 181
A.1 Lab Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
A.2 Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
A.3 Due dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Lab 1 182
Lab 2 193
Lab 3 197
Lab 4 202
6
Administrivia
1. Course Web Page: www.enel.ucalgary.ca/People/Macnab/enel441.
Course Outline
Lecture and Tutorial Schedule
Lab Assignments
Other study aids.
2. The breakdown of the marks will be as follows:
Quizes: 20%
Lab assignments: 10%
Midterm test: 20%
Final examination: 50%
3. Homework. There will be problems sets given out, followed by answers a week later.
These will not be marked. However, they will be good preperation for the quizes and
tests.
4. Labs:
There are 4, 3 hour labs in the course, starting in early October.
The lab manual is at the back of these course notes.
Labs are in ENA 305. There are 16 stations, so lab groups should be either 2 or
3 students. I will make sure that all available stations are in use.
1 Lab report per group (with all names/IDs on it FOIP).
Lab report is semi-formal. Answer the questions, and justify your answers.
Include any graphs that are requested, and make sure that they are labelled, so
the TA knows which plot is which.
Lab groups can change from week to week.
Lab material may turn up on a midterm/nal (it has before).
5. Oce Hours for Dr. Westwick, Wednesday 14:00-16:00, or by appointment.
6. Oce Hours for Dr. Macnab Monday, Wednesday, and Friday mornings.
Introduction to Controls
What is this course all about? Control Systems.
OK so whats a control system? Well, a system is anything that transforms one
signal (its input) into another signal (its output).
7
y(t)
System Input
u(t)
Output
Example: You could think of a car as a system. The inputs are the positions of the
controls: the steering wheel, gear shift, gas, brake and clutch pedals. The output is
the position of the car.
You could also think of the engine as the system, and the inputs could be the richness
and ow rate of the fuel/air mixture, and the outputs could be the engine speed and
torque.
At the other extreme, the system could be the network of roads around Calgary,
the inputs would be the desired arrival times and destinations of all of the drivers,
or perhaps the size and location of construction projects, or perhaps the types and
locations of new interchanges, and the outputs could be the speed of trac, or the
number of accidents, average travel time, waiting times at certain key intersections.
There are a two important points here.
1. The scope of what you consider to be a system depends on the problem that you
are interested in solving (i.e. the car, the engine which may or may not be part
of the car, etc).
2. The input and output signals may be multi-valued.
OK, so thats a system. What about the control part. In essence, we will be trying
to build controllers. A controller is a system whose output is used as the input to
another system, usually called the plant or process, such that its output follows
some desired trajectory.
Back to the car example. You could think of yourself as the controller. You alter the
control signals (the positions of the steering wheel, pedals, etc) so that the car follows
a desired trajectory ideally down the right side of the road (unless you are in Britain,
Japan...) and away from other cars, trees, pedestrians.
Lets think of a simpler example. Think about what happens when you take a shower.
Controller: Thats you.
Control signals: Positions of the hot/cold water taps.
Plant: water heater, pipes, shower head.
Objective: Make sure that the water temperature is just right
8
How are we going to solve this problem? What do you do, rst thing in the morning.
You set the taps in about the correct position, and then wait for the water temperature
to reach some sort of steady state.
This is feed-forward, or open-loop control (or it would be if you just set the taps,
and then jumped into the shower).
The basic idea is that you have a model of how the plant works, and you use that
model to construct inputs that will give you the desired result.
Output
Signal
Control Reference
Controller Plant
So, whats wrong with this picture?
The model may not be perfect hot water tank is full of luke-warm water (or
scalding hot water).
The amount of heat lost between the tank and shower head depends on the tem-
perature (especially if you dont have enough insulation).
Besides, this is like driving your car blindfolded....
How do we address these problems? Measure the output, and adjust the control signals
appropriately.
Output
Signal
Control
Controller Plant
Reference Error
Signal

In this diagram the controller is a function of the error signal. Thus, we can also write
an equation for the control as
control signal = controller(error signal) = controller(reference output)
which is usually calculated by a computer these days (in your car) or more traditionally
comes from something simple like an electric circuit. The plant is a function of the
control signal and as well as time so that an equation for the output is
output = plant(time, control signal) = plant
_
time, controller(reference output)
_
and this equation is a model of a physical system. It is only calculated on a computer
(imperfectly) when we want to simulate the system. Otherwise, it is just the behaviour
in time of something physical.
9
We need one more element in our overall system: something to measure the output of
the system. In the shower example, the skin (or rather the nerve endings just below
the skin) would be the transducer, and the brain would be the summing junction and
the controller.
Now, suppose that you just moved into a new apartment. How will the open and
closed loop control approaches aect your rst shower? Your model of the plumbing
probably doesnt reect your new digs so your initial setting of the taps probably
wont give you a pleasant water temperature. However, once you close the loop, you
should have no trouble nding an acceptable temperature.
What happens if, while you are taking your shower, someone ushes the toilet? There is
a temporary reduction in the cold water pressure, which causes the shower temperature
to increase suddenly. You get almost get scalded, jump out of the water stream, and
then adjust the taps in controls terms, the sudden change in water pressure is a
disturbance, and the controller (you) is doing disturbance rejection.
Lets look at some other everyday control systems. Are they open or closed loop?
Identify the plant, controller, transducer, disturbances.
Temperature in a building
Driving a car
Reheating leftovers in a microwave
Overview of Topics
1. Mathematical Modelling of Systems in the Laplace domain.
2. Manipulating block diagrams especially feedback loops.
3. Relating the Laplace domain model to the time-domain response.
4. Adding a controller, to modify the Laplace domain model, and hence time-domain
response.
5. Frequency responses of systems.
6. Design of controllers based on the frequency response.
7. Introduction to state space models and modern control.
10
1 Laplace Transforms
1.1 Denition
Let f(t) be a function such that f(t) = 0, for t < 0. Then, the Laplace transform of f(t) is
F(s) = L(f(t))
=
_

0
e
st
f(t)dt
1.1.1 Example: Unit Step Function
Let 1(t) be the unit step function
u(t) = 1 t > 0
= 0 t < 0
Then, the Laplace transform of u(t) is:
L(1(t)) =
_

0
e
st
dt
=
1
s
e
st

0
=
1
s
1.1.2 Example: Decaying Exponential
Let f(t) = e
t
1(t), for 0, then
F(s) = L(f(t))
=
_

0
e
st
e
t
dt
=
_

0
e
(s+)t
dt
=
1
s +
1.2 Properties
In practise, the denition is almost never used to compute the forward transform. We
almost always rely on tables of common transforms, and use the properties of the transform
to massage f(t) into one or more components that are in the tables.
11
f(t) F(s)
(t) unit impulse 1
u(t) unit step
1
s
cu(t)
c
s
t ramp
1
s
2
t
n n!
s
n+1
e
at 1
s+a
te
at 1
(s+a)
2
t
n
e
at 1
(s+a)
n+1
sin bt
b
s
2
+b
2
cos bt
s
s
2
+b
2
e
at
sin bt
b
(s+a)
2
+b
2
e
at
cos bt
s+a
(s+a)
2
+b
2
Table 1: Some Laplace Transforms
1.2.1 Linearity
Suppose L(f
1
(t)) = F
1
(s) and L(f
2
(t)) = F
2
(s). Then, for any constants, A and B,
L(Af
1
(t) +Bf
2
(t)) = AF
1
(s) +BF
2
(s)
Proof integration is a linear operation.
1.2.2 Integration
L
__
t
0
f()d
_
=
1
s
F(s)
Proof write out the denition, integrate by parts.
1.2.3 Dierentiation
L
_
d
dt
f(t)
_
= sF(s) f(0)
Proof write out the denition, integrate by parts. Also
L
_
d
2
dt
2
f(t)
_
= s
2
F(s) sf(0)
d
dt
f(0)
L
_
d
k
dt
k
f(t)
_
= s
k
F(s) s
k1
f(0) s
k2
d
dt
f(0) . . .
d
k1
dt
k1
f(0)
These properties are incredibly useful for solving ODEs. In the transform domain, inte-
gro/dierential equations are replaced with algebraic equations.
12
1.2.4 Convolution Integral
The convolution integral is dened as
f
1
(t) f
2
(t) =
_

0
f
1
(t )f
2
()d
The Laplace transform of a convolution integral is,
L(f
1
(t) f
2
(t)) = F
1
(s)F
2
(s)
This is incredibly useful, in a systems context. For example, suppose that h(t) is the impulse
response of a LTI system. Then, if its input is u(t), the corresponding output is
y(t) = h(t) u(t) =
_

0
h()u(t )d
which is a rather ugly expression. However, in the frequency domain, this is just a multipli-
cation
Y (s) = H(s)U(s)
Furthermore, we will be able to to block diagram algebra
1.2.5 Final Value Theorem
The only problem with working in the frequency domain, is that we will eventually have
to transform back to the time domain (more on that later). The central approach in this
course, will be to stay in the frequency domain as long as possible. In many cases, we will
be able to answer all of the relevant questions in the FD, and wont have to do the inverse
transform. One of the tools that makes this possible, is the nal value theorem.
lim
t
f(t) = lim
s0
sF(s)
Provided that F(s) does not have any poles with non-negative real parts, and has at most
one pole at the origin.
1.2.6 Example: FVT in action
Suppose a control system has the transfer function
H(s) =
100
s
2
+ 10s + 129
and it has to track a step input (i.e. has to go to 1). Let what is the steady state value of
e(t)?
Solution: Let r(t) be a unit step input. Then, R(s) = 1/s, and the output is given by
Y (s) = H(s)
1
s
=
100
s(s
2
+ 10s + 129)
13
Thus, the nal value of y(t) is
lim
t
y(t) = lim
s0
100
s
2
+ 10s + 129
=
100
129
The nal tracking error is
lim
t
e(t) = lim
t
(r(t) y(t))
= 1
100
129
=
29
129
22%
Is this a good control system? Probably not. However, the important point here, is that we
were able to deduce that without transforming back into the time domain.
1.2.7 Initial Value Theorem
f(0
+
) = lim
s
sF(s)
Useful for sanity checks (especially in the rare instances when we actually have to do an
inverse transform).
2 Inverse Laplace Transform
One of the secrets of this course, is that we will be doing everything that we can
to avoid returning to the time domain. Its still useful to remember how the inverse
transform works, but you probably wont have to invert any transforms.
2.1 Formal Denition
L
1
_
F(s)
_
= f(t) =
1
2j
_
c+j
cj
F(s)e
st
ds
This isnt too useful, unless you are a fan of residue calculus.
2.2 Partial Fraction Expansion
Since we will be using the Laplace transform to solve ODEs, we will be dealing almost
exclusively with rational polynomials in s.
F(s) =
B(s)
A(s)
=
K(s z
1
)(s z
2
) . . . (s z
m
)
(s p
1
)(s p
2
) . . . (s p
n
)
with m < n.
Note: m > n produces a non-causal system one which reacts before it is stimulated.
We will deal with the case m = n later.
Vocabulary:
14
z
1
. . . z
m
, the solutions to B(s) = 0, are called the zeros of F(s).
p
1
. . . p
n
, the solutions to A(s) = 0, are called the poles of F(s).
Note: Some books write the transfer function as follows:
F(s) =
B(s)
A(s)
=
K(s +z
1
)(s +z
2
) . . . (s +z
m
)
(s +p
1
)(s +p
2
) . . . (s +p
n
)
in which case the poles and zeros are at s = p
k
and s = z
k
, respectively.
If all of the poles are distinct, p
i
,= p
j
, for all i ,= j, then it F(s) can be written as
F(s) =
r
1
s p
1
+
r
2
s p
2
+. . . +
r
n
s p
n
which is easily inverted, once we know the constants r
k
.
f(t) = r
1
e
p
1
t
u(t) +. . . +r
n
e
pnt
u(t)
So, how do we nd the constants (residues), r
k
?
Multiply both sides by s p
k
. Using the expansion, we have
(s p
k
)F(s) = (s p
k
)
r
1
s p
1
+. . . (s p
k
)
r
k
s p
k
+. . . (s p
k
)
r
n
s p
n
This must be true for all possible values of s. In particular, it must also be true when s = p
k
.
In this case,
(s p
k
)F(s)

s=p
k
= 0 +. . . +r
k
+. . . 0.
Therefore, to evaluate r
k
, compute (s p
k
)F(s), and set s = p
k
.
2.2.1 Example: Distinct Poles
Suppose Y (s) =
3s
s(s
2
+4s+3)
. Find y(t).
Use partial fraction expansion,
1. Poles of Y (s), s = 0, and s
2
+ 4s + 3 = 0.
s
2
+ 4s + 3 = (s + 1)(s + 3) = (s (1))(s (3))
2. expansion
Y (s) =
r
1
s
+
r
2
s + 1
+
r
3
s + 3
15
3. nd the coecients.
r
1
=
3 s
(s + 1)(s + 3)

s=0
= 1
r
2
=
3 s
s(s + 3)

s=1
=
4
(1)2
= 2
r
3
=
3 s
s(s + 1)

s=3
=
6
(3)(2)
= 1
4. Invert the bits
Y (s) =
1
s
+
2
s + 1
+
1
s + 3
Thus,
y(t) = 1(t) 2e
t
1(t) +e
3t
1(t) = (1 2e
t
+e
3t
)u(t)
2.2.2 Avoiding the Inverse Transform
Notice that we can tell a lot about the response without actually doing the inverse
transform.
In the previous example, we can see immediately that the response is going to contain
a step and 2 exponentials,
Y (s) =
r
1
s
+
r
2
s + 1
+
r
3
s + 3
The 1/s term will give us a unit step, the 1/(s + 1) will give us an e
t
term, and the
1/(s + 3) will give us an e
3t
term.
Clearly, the two exponentials will decay to zero as t , leaving the unit step.
We can use the nal value theorem to nd the steady state response.
lim
t
y(t) = lim
s0
sY (s) = 1
Secondly, we can see that the longest lasting term in the transient response will be
proportional to e
t
.
To get any more information, we will probably have to break down and do the inverse
transform. However, this is usually enough information for design purposes.
16
2.3 Special Cases of the Inverse Laplace Transform
2.3.1 What if n = m?
If n = m, then we can use long division, to rewrite F(s) as the sum of a constant and a
rational whose numerator order is at least one less than its denominator order.
Example:
F(s) =
2s
2
+ 11s + 13
s
2
+ 5s + 6
Do the long division
2
s
2
+ 5s + 6
_
2s
2
+ 11s + 13
2s
2
+ 10s + 12
s + 1
Thus,
F(s) = 2 +
s + 1
s
2
+ 5s + 6
= 2 +
2
s + 3

1
s + 2
The inverse Laplace transform of 2 is 2(t), we know how to handle the rest.
f(t) = 2(t) +
_
2e
3t
e
2t
_
u(t)
2.3.2 Repeated Poles
Suppose
F(s) =
2
(s + 1)(s + 2)
2
=
K
1
(s + 1)
+
K
2
(s + 2)
2
+
K
3
(s + 2)
The coecient K
1
can be found in the usual way,
K
1
=
2
(s + 2)
2

s=1
= 2
To nd K
2
, multiply both sides by (s + 2)
2
, thus
(s + 2)
2
F(s) =
2
s + 1
= (s + 2)
2
K
1
(s + 1)
+ (s + 2)
2
K
2
(s + 2)
2
+ (s + 2)
2
K
3
(s + 2)
= (s + 2)
2
K
1
(s + 1)
+K
2
+ (s + 2)K
3
which must be true for all s, so set s = 2, resulting in
(s + 2)
2
F(s)

s=2
=
2
1
= 2 = K
2
17
If you dierentiate (s + 2)
2
F(s), with respect to s,
d
ds
(s + 2)
2
F(s) =
d
ds
2
s + 1
=
2
(s + 1)
2
but dierentiating the partial fraction expansion yields
d
ds
_
(s + 2)
2
K
1
(s + 1)
+K
2
+ (s + 2)K
3
_
= K
1
2(s + 2)(s + 1) (s + 2)
2
(s + 1)
2
+0 +K
3
Note that the rst term can be rewritten as
K
1
(s + 2)
2(s + 1) (s + 2)
(s + 1)
2
which makes the factor of s + 2 obvious.
Since the equality must hold for all values of s, we might as well choose a value that
will make it easy to solve say s = 2.
Thus,
K
3
=
d
ds
(s + 2)
2
F(s)

s=2
=
2
(s + 1)
2

s=2
= 2
So, the partial fraction expansion is
F(s) =
2
(s + 1)

2
(s + 2)
2

2
(s + 2)
The inverse transform is
f(t) = 2
_
e
t
te
2t
e
2t
_
u(t)
2.4 Complex Poles
If you get complex poles, they will always occur in complex conjugate pairs.
Furthermore, a pair of complex conjugate poles with negative real parts, will generate
an exponentially decaying sinusoid in the time domain.
If the transform has a pair of complex conjugate poles, the partial fraction expansion
will include a term like,
K
1
s +K
2
s
2
+bs +c
Note: There is no easy way to nd K
1
and K
2
youll probably have to clear fractions,
and solve (after you have solved for the other residues).
18
2.4.1 Completing the Square
To inverse transform this term, use the two transform pairs,
e
at
sin(t)u(t)

(s +a)
2
+
2
e
at
cos(t)u(t)
s +a
(s +a)
2
+
2
First equate the denominators, to determine a and .
s
2
+bs +c =
_
s +
b
2
_
2
+c
b
2
4
= (s +a)
2
+
2
For example, given
F(s) =
s + 2
s
2
+ 2s + 5
=
s + 2
(s + 1)
2
+ 4
so
a = 1 = 2
Now that we have a and , write the numerator as
K
1
s +K
2
= (s +a) +
For example
s + 1 = 1 (s + 1) +
1
2
2
Now that we have this, we can write down the inverse Laplace transform,
f(t) = 1 e
t
cos(2t)u(t) +
1
2
e
t
sin(2t)u(t)
Pull out the common factors, e
t
and u(t), and then (since the cos and sin have the
same frequency) we can write the sinusoidal components as a phasor
PSfrag replacements

1
2
1
90
o
0
o
f(t) = e
t
u(t)[cos(2t) +
1
2
sin(2t)]
f(t) = e
t
u(t)[

0
o
+
1
2

90
o
]
f(t) =

5
2
e
t
cos(2t )u(t)
where = tan
1
_
1/2
1
_
26.6
o
19
2.4.2 Expansion with Complex First-Order Poles
Alternately, if you dont mind working with complex numbers (you are EEs after all),
simply treat the complex poles as any other poles in the partial fraction expansion,
but with complex coecients.
Returning to the example,
F(s) =
s + 2
s
2
+ 2s + 5
Factor the denominator,
s
2
+ 2s + 5 = (s + (1 + 2j))(s + (1 2j))
= (s (1 2j))(s (1 + 2j))
so that the partial fraction expansion is
s + 2
s
2
+ 2s + 5
=
r
1
s (1 2j)
+
r
1
s (1 + 2j)
where the over-bar indicates a complex conjugate.
Solve for r
1
in the usual way
r
1
=
s + 2
s (1 + 2j)

s=12j
=
1 2j
4j
=
2 +j
4
Thus,
F(s) =
1
4
_
2 +j
s (1 2j)
+
2 j
s (1 + 2j)
_
which inverse transforms to
f(t) =
1
4
e
t
((2 +j)(cos(2t) j sin(2t)) + (2 j)(cos(2t) +j sin(2t))) u(t)
=
e
t
4
(4 cos(2t) + 2 sin(2t)) u(t)
and the rest proceeds as before.
20
2.4.3 Graphical Approach
Suppose that you want to evaluate
the function s(2) = s+2 at some
point s = s
0
.
Plot the function s + 2 as a zero in
the complex plane (at s = 2 +j0).
Plot the point s = s
0
in the complex
plane.
Notice that a vector drawn from s =
2+j0 to s = s
0
represents the com-
plex number
s
0
(2+j0) = s
0
+2 = (s+2)

s=s
0
In polar coordinates, this is r

.
Using a ruler and protractor you can
measure these quantities o the plot
You can also use trigonometry to nd
these quantities
O real
imag
s = 2
s = s
0
r

Example) If s
0
= 1 +j then s
0
+2 = r

where r =

1
2
+ 1
2
=

2 and = tan
1 1
1
= 45
0
Back to the Example
In the example, we had to do the partial fraction expansion,
s + 2
s
2
+ 2s + 5
=
r
1
s (1 2j)
+
r
1
s (1 + 2j)
where
r
1
=
s + 2
s (1 + 2j)

s=12j
Thus, we must compute the values of
A zero at s = 2, evaluated at the point s = 1 2j
A pole at s = 1 + 2j evaluated at the point s = 1 2j
and then divide the two.
Plot the pole and zero in the complex plane, and draw lines from them to s
0
= 12j
(the location of the other pole).
21
X
O

63.4
o
Re(s)
Im(s)
s = 2
s = 1 + 2j
s = 1 2j
4

90
o
(s +2)

s=12j
is a vector starting at
s = 2, and terminating at s = 1
2j. After a little trigonometry, this
is

63.4
o
.
(s+(12j))

s=12j
is a vector start-
ing at s = 1 + 2j going to s =
1 2j. By inspection, this is 4j,
or 4

90
o
.
To divide two complex numbers, di-
vide their magnitudes, and subtract
their arguments (angles).
Thus,
r
1
=

63.4
o
4

90
o
=

5
4

26.6
o
Notice that
F(s) =
re
j
s (1 2j)
+
re
j
s (1 + 2j)
f(t) = re
j
e
(12j)t
+re
j
e
(1+2j)t
= re
t
_
e
j(2t+)
+e
j(2t+)
_
= 2re
t
cos(2t )
So, in the example, r =

5/4, and 26.6


o
, we have
f(t) =

5
2
cos(2t )
3 Transfer Functions and Block Diagrams
In practise, we almost always assume zero initial conditions. In that case, we only have
to deal with the zero state response, which leads to the transfer function,
Y (s) = G(s)V (s)
Suppose we used y(t) (isolated by a buer amplier) as the input to another system,
whose transfer function is H(s). Then, the output of the combined system will be
Z(s) = H(s)Y (s) = H(s)(G(s)V (s))
provided that the system H(s) doesnt load the circuit (i.e. it doesnt change y(t) by
drawing current). This is usually accomplished using some sort of buer amplier (or
voltage controller voltage source, if you prefer).
22
The implication of this is that when transfer functions appear in series, we can simply
multiply them together. Thus, these two block diagrams are equivalent.
G(s) H(s)
G(s)H(s)
V (s)
V (s)
Y (s) = G(s)H(s)V (s)
Y (s) = G(s)H(s)V (s)
3.1 More Block Diagram Tricks
Before getting into the general strategy for simplifying block diagrams, here are some tools.
The general idea is to make sure that none of the outputs is changed by any block diagram
manipulation. For example,
Simplifying parallel branches
+
+
H(s)
G(s)
Y(s) R(s)
is equivalent to
Y(s)
G(s)+H(s)
R(s)
R(s)G(s) +R(s)H(s) = Y (s) R(s)[G(s) +H(s)] = Y (s)
Moving a branch point before a block
R(s)
H(s)
Y(s)
Y(s)
is equivalent to
R(s)
H(s)
H(s)
Y(s)
Y(s)
R(s)H(s) = Y (s) R(s)H(s) = Y (s)
Moving a branch point after a block
Y(s)
R(s)
R(s)
H(s)
is equivalent to
R(s)
Y(s)
R(s)
H(s)
1/H(s)
R(s) = R(s) R(s)H(s)/H(s) = R(s)
23
Moving a summing junction
+
+
R(s)
Y(s)
W(s)
H(s)
is equivalent to
+
+
R(s)
Y(s)
W(s)
H(s)
H(s)
[R(s) +W(s)]H(s) = Y (s) R(s)H(s) +W(s)H(s) = Y (s)
The basic strategy behind these manipulations, is to make sure that none of the outputs
change as a result of the simplication.
Simplifying a feedback loop

+
Y(s)
R(s)
E(s)
G(s)
H(s)
Y (s) = G(s)E(s)
Y (s) = G(s)[R(s) H(s)Y (s)]
Y (s) = G(s)R(s) G(s)H(s)Y (s)
Y (s)
R(s)
=
G(s)
1 +H(s)G(s)
R(s) G(s)
1 +H(s)G(s)
Y(s)
3.2 Example: Simplifying a Block Diagram

+
+
+
R(s)
E(s)
Y(s) C(s)
H(s)
G(s)
F(s)
24
3.2.1 Option 1: Just use Algebra
C(s) = F(s)E(s) +G(s)E(s)
= (F(s) +G(s))E(s)
E(s) = R(s) G(s)H(s)E(s)
=
R(s)
1 +G(s)H(s)
C(s) =
F(s) +G(s)
1 +G(s)H(s)
R(s)
3.2.2 Option 2: Block Diagram Manipulation
Look for feedback loops.
Is the top half a feedback loop?
Move the branch-point outside of the feedback loop.

+
+
+
G(s)
H(s)
R(s)
E(s) Y(s)
C(s)
F(s)
G(s)
Note that we had to compensate for G(s).
Simplify the feedback loop and the parallel branches.
R(s)
C(s)
1 +
F(s)
G(s)
G(s)
1 +H(s)G(s)
Thus, the transfer function is
C(s) =
G(s) +F(s)
1 +G(s)H(s)
R(s)
25
General Strategy:
Identify potential feedback loops, and move branches around to untangle these loops.
Starting with the innermost loops, simplify them, and then compute their transfer
functions.
Continue in this manner until you reach the outermost loop.
3.2.3 Which approach is better?
The algebraic approach is probably more familiar at this stage.
The graphical approach is easier to debug
In the context of this class, it means that the TAs and I will be able to mark/correct
your assignments and tests more easily.
Out in the real world, it means that your supervisor/co-workers will be able to
gure out your analysis more easily (and you will be able to gure out what you
were thinking when you re-examine a design 6 months later).
For large systems, it is easy to get lost in the algebra however, the graphical
approach is constructed to be local. It should be easier to concentrate on a
section of the system, simplify it, and then move on.
3.3 Multiple Input Systems
Multiple-Inputs may represent either control actions or disturbances.
For a linear system, we can use superposition, and break the system into several transfer
functions, one for each input.
+

+
+
C(s)
R(s)
D(s)
H(s) G(s)
Ignore D(s). The transfer function from R(s) to C(s) is
+

C(s)
R(s)
G(s) H(s)
G(s)H(s)
1 +H(s)G(s)
26
Ignore R(s). Redraw the block diagram, with H(s) in the forward path, and G(s) in
the feedback path. Watch the - sign!!

+
+
+

C(s)
D(s) C(s)
H(s)
G(s)
G(s) H(s)
D(s)
H(s)
1 +G(s)H(s)
We can now draw the system as a two-input, single output block diagram:
R(s)
D(s)
+
+
C(s)
G(s)H(s)
1 +H(s)G(s)
H(s)
1 +H(s)G(s)
Note that both systems have the same denominator. (1 + the loop gain).
27
4 Case Study: Cruise Control System
4.1 Dynamic Modelling
This section serves as a motivation for learning about Laplace and Inverse Laplace trans-
forms. The basic steps of dynamic modelling are outlined below illustrated with the simple
example of modelling the velocity of a car, which we will use to design a cruise control
system.
1. Draw a diagram
PSfrag replacements
engine
gravity
friction
x

2. Write the dierential equation (DE)


Use Newtons Law F = ma
sum of forces = mass acceleration
gravity + friction + control (engine) force = mass acceleration
constants
b friction coecient
g acceleration of gravity
m mass of the car
variables
x(t) position of the car
y(t) velocity of the car
(t) angle of the road
u(t) force supplied by the engine
mg sin() b x +u = m x
3. Linearize the DE if necessary.
We will discuss this formally later, but for now lets use the property that sin 0
when [[ << 1. Our model will be valid only for a near-horizontal surface.
b x +u = m x
by +u = m y
4. Take the Laplace transform to get an algebraic expression
bY (s) +U(s) = m(sY (s) y(0))
5. Solve for the output variable Y (s)
Y (s) =
U(s)
sm+b
+
my(0)
sm+b
28
6. Identify the transfer function(s).
This is the ratio of an output over an input, dened with with zero initial conditions.
T(s) =
Y (s)
U(s)
=
1
sm+b
If the initial conditions need to be considered, we can also write a ratio of output over
the initial condition, so that the initial condition looks like an input. Technically,
this is not a transfer function.
Y (s)
y(0)
=
m
sm+b
7. Draw a block diagram
The initial conditions are not normally considered in a block diagram, but there is no
problem with doing so.
PSfrag replacements
U(s)
Y(s)
y(0)
1
sm+b
1
sm+b
m
sm+b
+
+
Normally in this course, this is as far as we will go. At this point we have all the
information we need to start desiging a control system. However, right now we are
interested in how the system behaves in time. Thus we are looking for a solution to
y(t).
8. Use partial fraction expansion.
If the control is constant u(t) = f then using our table of Laplace transforms we get
U(s) = f/s so that
Y (s) =
f/s
(sm+b)
+
my(0)
sm+b
=
f/m
s(s +b/m)
+
y(0)
s +b/m
and partial fraction expansion of the rst term gives
Y (s) =
K
1
s
+
K
2
s +b/m
+
y(0)
s +b/m
where
K
1
=
f/m
s +b/m

s=0
=
f
b
K
2
=
f/m
s

s=b/m
=
f
b
29
so that
Y (s) =
f/b
s

f/b
s +b/m
+
y(0)
s +b/m
Note that at this point we can tell what the nal velocity will be using the nal value
theorem
lim
t
y(t) = lim
s0
s
_
f/b
s

f/b
s +b/m
+
y(0)
s +b/m
_
=
f
b
9. Take the inverse Laplace transform
Using the table of Laplace transforms to do the inverse on each term we get
y(t) =
f
b

f
b
exp
_

b
m
t
_
+y(0) exp
_

b
m
t
_
10. Graph the output
Lets use the following numbers in SI units (1 N = 1 kg m/s
2
)
constant value
b 100 kg/s friction coecient
m 1000 kg mass of the car
We will graph three dierent cases
case 1 u(t) = f = 100 N and y(0) = 0 m/s
We can use MATLAB to do the dirty work for us. First set the constants
b=100
m=1000
Now enter the transfer function using the matlab command tf() (type help tf
in MATLAB for an explanation).
num=[1]
den=[m b]
sys=tf(num,den)
We use the command lsim() to simulate the dynamics (it numerically integrates
the dierential equation for us)
f=100;
t=[0:1:100];
u=f*ones(1,101);
y1=lsim(sys,u,t);
plot(t,y1);
title(constant f=100, zero initial condition);
xlabel(time (s));
ylabel(velocity (m/s));
axis([0 100 0 1.5])
30
0 10 20 30 40 50 60 70 80 90 100
0
0.5
1
1.5
constant f=100, zero initial condition
time (s)
v
e
l
o
c
i
t
y

(
m
/
s
)
PSfrag replacements
U(s)
and we can see the nal velocity is indeed f/b = 1 as we knew from the Final
Value Theorem.
case 2 u(t) = f = 0 N and y(0) = 10 m/s
In this case, there is no actual transfer function so we cant use tf(). We must
use the mathematical expression we derived from the inverse Laplace transform.
y0=10;
t=[0:1:100];
y2=y0*exp(-b/m*t);
plot(t,y2);
title(zero engine force, initial condition y0=10 m/s);
xlabel(time (s));
ylabel(velocity (m/s));
0 10 20 30 40 50 60 70 80 90 100
0
5
10
zero engine force, initial condition y0=10 m/s
time (s)
v
e
l
o
c
i
t
y

(
m
/
s
)
PSfrag replacements
U(s)
case 3 u(t) = f = 100 N and y(0) = 10 m/s
This is a linear system, so we can just add the results of the rst two cases above
to get the answer.
plot(t,y1+y2);
title(engine force f=100 N, initial condition y0=10 m/s);
xlabel(time (s));
ylabel(velocity (m/s));
0 10 20 30 40 50 60 70 80 90 100
0
5
10
engine force f=100 N, initial condition y0=10 m/s
time (s)
v
e
l
o
c
i
t
y

(
m
/
s
)
PSfrag replacements
U(s)
31
4.2 A Control System
How can we design a cruise control system? We want the driver to input a desired
velocity for the car, a constant y
des
, and the computer should do the work. The
computer could do the following calculation to decide on the right engine force to
apply
u(t) = K (y
des
y(t))
where K is a positive constant that we can choose in the design process. To see
if this works, rst take the Laplace transform
U(s) = K
_
y
des
s
Y (s)
_
Substitute this into our equation
Y (s) =
1
sm +b
U(s) +
my(0)
sm+b
Y (s) =
1
sm +b
K
_
y
des
s
Y (s)
_
+
my(0)
sm+b
Y (s)
_
1 +
K
sm +b
_
=
1
s
Ky
des
sm+b
+
my(0)
sm+b
Y (s) =
1
s
Ky
des
sm+b +K
+
my(0)
sm +b +K
The Final Value Theorem tells us
lim
t
y(t) = lim
s0
Y (s) =
Ky
des
b +K
So, for example, if we want to go 30m/s and we picked K = 1000 then no matter
what velocity we start at (y(0) = anything) we get to
lim
t
y(t) =
100 30
100 + 100
= 27m/s
Note that the larger we choose K, the closer we get to the desired velocity. But
we would need K = to get there exactly. Later in the course we will see how
to design a control system to get zero steady-state error, if thats whats required.
At this piont, we dont know how long it takes to get to the steady state value.
For that information, we need to take the inverse Laplace transform and graph
the behaviour.
32
5 Mathematical Models of Dynamic Systems
The rst step in designing a control system, such as the cruise control described in the
previous lecture, is to construct a mathematical model of the system.
Denition: A mathematical model is an equation (or system of equations) that pre-
dicts the behaviour of a physical system.
To be useful, a model must be accurate enough to provide reasonable predictions of the
systems response to plausible inputs, yet simple enough that the resulting calculations
are tractable.
5.1 Examples
In physics/mechanics
f = ma (Newton II)
f = kx (Hookes Law)
In EE, we have a bunch
v(t) = Ri(t)
v(t) = Ldi(t)/dt
v(t) = Cq(t)
KVL and KCL
Op-Amp: No voltage across terminals, no current into either input terminal.
+

Diode characteristic
v
in
(t)
v
out
(t)
33
You have used all of these models extensively over the last couple of years. Useful as
they are, they all sweep a lot of detail under the rug. For example, Ohms law ignores:
Thermal eects on resistor
any inductance/capacitance in the resistor
Quantum mechanical eects,
etc.
however, we still use Ohms law whenever we need to describe a resistor (mathematically).
5.2 Mathematical Models of Linear Mechanical Motion
We will be dealing with lumped models. In circuits, you lumped all of the resistance
into resistors, despite the fact that the wires also resisted the ow of current, and
lumped all of the capacitance into capacitors, ignoring the capacitance between nearby
wires, etc. The same approach is used in mechanical systems. All of the systems mass
is contained in one or more point masses, that obey Newton II.
f(t) = ma(t) = m
d
2
dt
2
x(t) = m x(t)
The mechanical equivalent to a node in KCL (or a loop in KVL) is the free body
diagram, which shows a point mass and all of the forces acting on it.
x(t)
m
f(t)
In this case, we are considering horizontal motion (so that we can ignore gravity). We
are also ignoring friction between the mass and the horizontal surface suppose that
it is sitting on an air-hockey table.
Note that the free-body diagram also species the sign convention. In this case, motion
and forces that point to the right are considered to be in the positive direction. The
mass obeys Newton II
34
5.2.1 Mass/Spring systems
Consider a system consisting of a mass attached to a spring.
k
x(t)
m
The force produced by the spring obeys Hookes law:
f(t) = kx(t)
where k is the spring constant, and has units of N/m.
The displacement, x(t), is the displacement away from the resting length of the spring.
An equivalent free body diagram is:
x(t)
m
kx(t)
Note the -ve sign. Thus, a displacement to the right causes a force, and hence acceler-
ation, to the left.
5.2.2 Mass/Damper systems
Consider a system consisting of a mass attached to a viscous damper (eg a shock
absorber in an automobile suspension).
x(t)
m
b
The force produced by the damper is proportional to the velocity,
f(t) = b x(t)
where b is the damping factor, and has units of Ns/m.
35
An equivalent free body diagram is:
x(t)
m
b x(t)
Note the -ve sign. Thus, motion to the right causes a force, and hence acceleration, to
the left.
Example: Equation of motion
Consider the following system comprising a mass attached to a spring and damper,
that is driven by the external force f(t).
m
k
b
x(t)
f(t)
The rst step is to draw a free body digram of the mass. Replace the spring and
damper with the forces that they generate (just copy them in from the appropriate
free body diagrams.
x(t)
m
b x(t)
kx(t)
f(t)
Now write down Newton II
m x(t) =

external forces
= f(t) b x(t) kx(t)
36
Transform into the Laplace domain
m
_
s
2
X(s) sx(0) x(0)
_
= F(s) b (sX(s) x(0)) kX(s)
group all of the X(s) terms on the left hand side,
(ms
2
+bs +k)X(s) = F(s) +m x(0) + (ms +b)x(0)
and solve for X(s)
X(s) =
1
ms
2
+bs +k
F(s) +
m
ms
2
+bs +k
x(0) +
ms +b
ms
2
+bs +k
x(0)
The rst term is the transfer function applied to the input, whereas the last two terms
are the eects of the initial conditions.
Assuming zero initial conditions, we have the transfer function
X(s) =
1
ms
2
+bs +k
F(s)
37
5.3 Linear Motion with Gravity
So far, we have considered horizontal motion along a frictionless surface.
The position x = 0 was taken to be the position where the spring produced no force.
How do we deal with vertical motion? Consider this system,
m
y(t)
f
e
(t) f
g
= mg
k b
As before, draw a free body diagram. Note the constant force, f
g
= mg, due to
gravity.
m
y(t)
f
e
(t) mg
ky(t) b y(t)
The equation of motion becomes:
m y(t) = f
e
(t) mg b y(t) ky(t)
Assuming zero initial conditions, this becomes:
Y (s) =
1
ms
2
+bs +k
_
F
e
(s) mg
_
Is this a linear system?
What happens if we double the amplitude of the input?
Suppose that Y
1
(s) is the position that results when the input F
e,1
(s) is applied. What
happens if we double the input, F
e,2
(s) = F
e,1
(s)?
38
If the system is linear, the output will be Y
2
(s) = 2Y
1
(s). Does this happen?
Y
2
(s) =
1
ms
2
+bs +k
_
2F
e,1
(s) mg
_
= 2
1
ms
2
+bs +k
_
F
e
(s) mg
_
+
mg
ms
2
+bs +k
= 2Y
1
(s) +ms
2
+bs +k
So, superposition does not apply, and the system is nonlinear.
5.3.1 Linearizing the System
All is not lost, at least in this case, as we can make this system linear via a simple
change of variables.
In the horizontal motion case, we took x(t) = 0 to be the position where the spring
produced no force.
What happens if we dene a new position variable, say y
0
(t), such that y
0
(t) = 0
corresponds to the position where the spring exactly cancels the force due to gravity.
y
0
(t) = y(t) +mg/k
Substitute y(t) = y
0
(t) mg/k into the equation of motion
m y
0
(t) = f
e
(t) mg b y
0
(t) k(y
0
(t) mg/k)
= f
e
(t) b y
0
(t) ky
0
(t)
In the frequency domain, we have
Y
0
(s) =
1
ms
2
+bs +k
F
e
(s)
which is a linear system.
In general, we will choose the zero position such that the eects of gravity are
cancelled leaving us to deal with a linear system.
5.3.2 Example: A car suspension
We will develop a mathematical model of a car suspension where the input is the
(vertical) position of the road, and the output is the position of the car chassis.
To simplify things, we will only consider one corner of the car so this is really a
quarter-car suspension.
39
Suspension
Chassis
Axle
Tire
m
1
k
2
y
2
(t)
y
1
(t)
b
2
m
2
u(t)
k
1
As in the previous example, we will dene the positions y
1
= y
2
= 0, to be the rest
position for both masses.
Draw a free-body diagram for the car chassis.
k
2
y
2
(t)
b
2
m
2
y
1
(t)
m
2
k
2
(y
1
(t) y
2
(t)) b
2
( y
1
(t) y
2
(t))
Notice that the forces produced by the spring and damper are computed by taking the
axle position as if it were xed. Thus, the spring force is proportional to y
1
(t) y
2
(t).
In the previous examples, which all concerned a single body, the other end of the spring
was taken to be at zero, in which case we got k(0 y
2
(t)) = ky
2
(t) as the spring
force.
Write down the equation of motion for the chassis:
m
2
y
2
(t) = b
2
( y
1
(t) y
2
(t)) +k
2
(y
1
(t) y
2
(t))
and transform into the Laplace domain
(m
2
s
2
+b
2
s +k
2
)Y
2
(s) (b
2
s +k
2
)Y
1
(s) = 0
Do the same for the car axle
m
1
k
2
y
1
(t)
b
2
u(t)
k
1
y
2
(t)
m
1
k
1
(u(t) y
1
(t))
k
2
(y
2
(t) y
1
(t)) b
2
( y
2
(t) y
1
(t))
40
m
1
y
1
(t) = b
2
( y
2
(t) y
1
(t)) +k
2
(y
2
(t) y
1
(t)) +k
1
(u(t) y
1
(t))
or in the Laplace domain
(m
1
s
2
+b
2
s +k
1
+k
2
)Y
1
(s) (b
2
s +k
2
)Y
2
(s) = k
1
U(s)
Just as you did in node/loop analysis, set up a system of 2 equations in 2 unknowns,
_
(b
2
s +k
2
) (m
2
s
2
+b
2
s +k
2
)
(m
1
s
2
+b
2
s +k
1
+k
2
) (b
2
s +k
2
)
_ _
Y
1
(s)
Y
2
(s)
_
=
_
0
k
1
U(s)
_
and invert the matrix
_
Y
1
(s)
Y
2
(s)
_
=
1

_
(b
2
s +k
2
) (m
2
s
2
+b
2
s +k
2
)
(m
1
s
2
+b
2
s +k
1
+k
2
) (b
2
s +k
2
)
_ _
0
k
1
U(s)
_
where is the determinant
= (b
2
s +k
2
)(b
2
s +k
2
) (m
1
s
2
+b
2
s +k
1
+k
2
)(m
2
s
2
+b
2
s +k
2
)
= m
1
m
2
s
4
b
2
(m
1
+m
2
)s
3
(m
1
k
2
+m
2
(k
1
+k
2
))s
2
b
2
k
1
s k
1
k
2
Thus, the transfer function from the road position to the chassis position is
Y
2
(s) =
k
1
b
2
s +k
1
k
2
m
1
m
2
s
4
+b
2
(m
1
+m
2
)s
3
+ (m
1
k
2
+m
2
(k
1
+k
2
))s
2
+b
2
k
1
s +k
1
k
2
U(s)
Aside from the physical meanings of the symbols, working with free body diagrams is
identical to the node/mesh analysis that we all know and love from circuit analysis.
5.3.3 Simulations using quarter-car model
Now, use Matlab to simulate the response of the car suspension to a speed bump.
First, we need some Matlab code the generates the transfer function model
The model below can compute either the position or the acceleration of the chassis.
To get the acceleration, the tranfer function is multiplied by s
2
(i.e. two trailing zeros
are added to the numerator vector.
41
function sys = qcar_tf(output);
% generates transfer function model of an automobile suspension tower.
%
% sys = qcar_tf(output)
%
% output = 0 (default) gives chassis position
% output = 1 gives chassis acceleration
if nargin < 1
output = 0;
end
% physical constants
% Tire and axle
m1 = 36 ; % kg -- wheel/axle mass
k1 = 320000 ; % N/m -- spring constant of tire
% suspension and chassis
m2 = 375 ; % kg -- chassis mass (1500/4)
k2 = 30000 ; % N/m -- suspension spring
b2 = 1960 ; % N-sec/m -- damping due to shock absorber
% enter the equations
switch output
case 0
% output is chassis position
num = k1*[b2 k2];
case 1
% output is chassis acceleration
num = k1*[b2 k2 0 0];
otherwise
error(unrecognized output);
end
den = [m2*m1 b2*(m2+m1) m1*k2+m2*(k1+k2) b2*k1 k1*k2];
% denominator is the same for all outputs.
sys = tf(num,den);
Suppose that the speed bump has a semi-circular prole, with a radius of 10 cm. Here
is some Matlab code that generates the speed bump (followed by an equal length of
at road).
42
function [x,y] = speed_bump(radius);
% generates x and y positions for speed bump.
%
% [x,y] = speed_bump(radius);
% where radius is the radius of the bump (in m).
xx = radius*[-1:0.05:1];
yy = sqrt(radius^2 - xx.^2);
x = [xx+radius; radius*(2+[0.05:0.05:2])];
y = zeros(size(x));
y(1:length(yy)) = yy;
If we cross the speed bump in 1 second, then t = 1 sec. will correspond to x = 0.2
metres (i.e. twice the radius of the speed bump. Thus
[x,u] = speed_bump(0.1);
t = x/0.2;
sys = qcar_tf;
y = lsim(sys,u,t);
generates the chassis position in response to the speed bump. Similar calcuations are
used to get the chassis acceleration.
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
0
0.05
0.1
distance travelled (m)
i
n
p
u
t

p
o
s
i
t
i
o
n

(
m
)
Speed Bump Response
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
0.2
0
0.2
c
h
a
s
s
i
s

p
o
s
i
t
i
o
n

(
m
)
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
10
0
10
a
c
c
e
l
e
r
a
t
i
o
n

(
m
/
s
2
)
time (s)
If we take 2 seconds to cross the bump, then all that changes is
t = x/0.1;
43
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
0
0.05
0.1
distance travelled (m)
i
n
p
u
t

p
o
s
i
t
i
o
n

(
m
)
Speed Bump Response
0 0.5 1 1.5 2 2.5 3 3.5 4
0.2
0
0.2
c
h
a
s
s
i
s

p
o
s
i
t
i
o
n

(
m
)
0 0.5 1 1.5 2 2.5 3 3.5 4
5
0
5
a
c
c
e
l
e
r
a
t
i
o
n

(
m
/
s
2
)
time (s)
44
5.4 Rotational Mechanical Systems
For a linear mechanical system, we use Newtons law:
mass acceleration =

forces
mass acceleration = spring + friction/damping + external
m x(t) = kx(t) b x(t) +f(t)
where m is the mass, k is the spring constant, and b is the damping coecient, and
f(t) is an externally applied force.
For rotational systems, we make the following substitutions
Linear Motion Rotary Motion
Position x(t) Angle (t)
Velocity v(t) = x(t) Angular Velocity (t) =

(t)
Mass m Inertia J
Spring Constant k Spring Constant k
Damping Factor b Damping Factor D
Force f(t) Torque T(t)
As with linear mechanical systems, the spring and damping forces will oppose motion.
inertia angular acceleration =

torques
inertia angular acceleration = rotational spring + friction/damping + external torque
m

(t) = k(t) D

(t) +T(t)
Free body diagrams are translated as follows
f = m x
f = b x f = kx
x
x
k b
J
J

k
(t)
Linear
Rotational
PSfrag replacements
T(t) (t) D
k
J
45
PSfrag replacements
T
1
(t)
1
(t)
T
2
(t)
2
(t)
N
1
N
2
r
1
r
2
Gears act like transformers in electrical systems. If you have a set of gears
Then the amount of rotation is decreased and the torque is increased

2
=
N
1
N
2

1
T
2
=
N
2
N
1
T
1
The idea, is to reect torques, intertias, etc, through the gear train. Suppose that the
equation of motion for gear 2, in isolation, is
(Js
2
+Ds +K)
2
(s) = T
2
(s)
Putting this in terms of the torque on gear 1
T
2
(s) =
N
2
N
1
T
1
(s)
Expressing the angle in terms of
1
(s),
(Js
2
+Ds +K)
N
1
N
2

1
(s) =
N
2
N
1
T
1
(s)
so that the equation of motion for gear 1 is
_
N
1
N
2
_
2
(Js
2
+Ds +K)
1
(s) = T
1
(s)
Thus, the equivalent inertia, damping and spring constants are given by:
J
e
=
_
N
1
N
2
_
2
J D
e
=
_
N
1
N
2
_
2
D K
e
=
_
N
1
N
2
_
2
K
The transfer function from input T
1
to output
2
can be expressed in the original
parameters

2
T
1
=
N
2
N
1
1
(Js
2
+Ds +K)
46
PSfrag replacements
T
1
(s)
2
(s)
N
2
N
1
1
Js
2
+Ds+K
or in the equivelent parameters

2
T
1
=
N
1
N
2
1
(J
e
s
2
+D
e
s +K
e
)
PSfrag replacements
T
1
(s)
2
(s)
N
1
N
2
1
Jes
2
+Des+Ke
5.5 Example: System with gears
What is the transfer function relating input torque T
1
to output position
2
for the
system below?
PSfrag replacements
T
1
(t)
1
(t)
T
2
(t)

2
(t)
N
1
N
2
D
1
D
2
K
2
J
1
J
2
Although there appear to be two bodies, their motion is coupled through the gear train
(so there will only be one dierential equation).
Reect the motions and torques of J
1
onto the body J
2
, so that we have an equivalent
equation of motion
(J
e
s
2
+D
e
s +K
e
)
2
(s) = T
2
(s) =
N
2
N
1
T
1
(s)
where the equivalent properties are given by,
J
e
= J
2
+J
1
_
N
1
N
2
_
2
D
e
= D
2
+D
1
_
N
1
N
2
_
2
K
e
= K
Substitute these into transfer function

2
(s)
T
1
(s)
=
N
2
/N
1
J
e
s
2
+D
e
s +K
e
47
6 DC Motors
Here is a scematic diagram of a DC motor
+

R
a
L
a
R
f
L
f
v
f
(t)
i
f
(t)
(t)
v
a
(t)
i
a
(t)
(t)
T
m
(t)
The torque produced by the motor is proportional to the product of the magnetic ux
and the armature current.
T
m
(t) = K
1
(t)i
a
(t)
where, provided that there is no magnetic saturation, and that there is no hysteresis,
the ux is given by
(t) = K
f
i
f
(t)
As a result, the torque is proportional to the product of the two currents
T
m
(t) = K
1
K
f
i
f
(t)i
a
(t)
Even with all of the assumptions, this is still a nonlinear system. However, if we x
one of the two currents, then the torque is proportional to the other current.
6.1 Field Controlled Motors
For a eld controlled motor, the armature current is kept constant. As a result, the
torque is proportional to the eld current.
T
m
(t) = K
1
K
f
i
a
i
f
(t) = K
m
i
f
(t)
Since this is a linear relationship, we can take Laplace transforms,
T
m
(s) = K
m
I
f
(s)
The eld circuit is series RL circuit, so that
V
f
(s) = (R
f
+sL
f
)I
f
(s)
48
PSfrag replacements
V
f
(s) I
f
(s) T
m
(s)
K
m
1
R
f
+sL
f
Combining these, we get
T
m
(s) =
K
m
R
f
+sL
f
V
f
(s)
The velocity of the motor is found using Newtons Law
J

(t) = D

(t) + T
m
(t)
J (t) = D(t) +T
m
(t)
Js(s) = D(s) +T
m
(s)
(s) =
1
Js +D
T
m
(s)
PSfrag replacements
V
f
(s) T
m
(s) (s) Km
R
f
+sL
f
1
Js+D
Note that velocity and position are related as follows

(t) = (t)
s(s) = (s)
(s) =
1
s
(s)
The position of the motor is given by
(s) =
_
1
s
_
1
Js +D
T
m
(s) =
1
Js
2
+Ds
T
m
(s)
PSfrag replacements
V
f
(s) T
m
(s) (s) (s)
1
s
Km
R
f
+sL
f
1
Js+D
where J is the inertia of the motor shaft, and D is the damping due to the shaft
bearing. Thus,
(s)
V
f
(s)
=
K
m
s(Js +D)(R
f
+sL
f
)
=
K
m
/DR
f
s(1 +sJ/D)(1 +sL
f
/R
f
)
49
Thus, the transfer function of the eld controlled DC motor contains 2 time constants:

f
= L
f
/R
f
, the eld time constant, and t
L
= J/D, the load time constant
(s)
V
f
(s)
=
K
m
/DR
f
s(1 +s
L
)(1 +s
f
)
In practice, motors are often designed so that
L

f
, so that its eects can be
neglected. In that case
(s)
V
f
(s)
=
K
m
/DR
f
s(1 +s
L
)
6.1.1 An external load
But there could be an external torque T
d
(s) working against the motor (i.e. its pushing
something)
(Js +D)(s) = T
m
(s) T
d
(s)
(s) =
1
Js +D
T
m
(s)
1
Js +D
T
d
(s)
PSfrag replacements
V
f
(s) T
m
(s)
T
d
(s)
(s)
(s)
1
s
+

Km
R
f
+sL
f
1
Js+D
1
Js+D
Note that we can rearrange the algebra to get an equivalent expression
(s) =
1
Js +D
(T
m
(s) T
d
(s))
so that in the same way the following block diagram is exactly equivelant to the one
above
PSfrag replacements
V
f
(s) T
m
(s)
T
d
(s)
(s)
(s)
1
s
+

Km
R
f
+sL
f
1
Js+D
50
6.2 Armature Controlled Motors
The other option, is to leave the eld current xed (or generate the eld with a per-
manent magnet), and vary the armature current.
In this case,
T
m
(s) = K
1
K
f
I
f
I
a
(s) = K
m
I
a
(s)
Note that in this case, the motor constant, K
m
, includes the constant eld current
(rather than the constant armature current as in the eld controlled case).
The armature circuit includes the series RL circuit, and a voltage source, termed
the back EMF, generated by the motion of the armature windings through the ux
generated by the eld coils.
V
a
(s) = (R
a
+L
a
s)I
a
(s) +K
b
(s)
Thus, the armature current is
I
a
(s) =
V
a
(s)
R
a
+sL
a

K
b
(s)
R
a
+sL
a
PSfrag replacements
V
a
(s) I
a
(s)
(s)
+

1
Ra+sLa
K
b
Ra+sLa
Using Newtons Law gives us
T
m
= Js(s) +D(s) = K
m
I
a
(s)
which can be solved for (s)
(s) =
K
m
Js +D
I
a
(s) =
K
m
Js +D
_
V
a
(s)
R
a
+sL
a

K
b
(s)
R
a
+sL
a
_
PSfrag replacements
V
a
(s) I
a
(s) (s)
+

1
Ra+sLa
K
b
Ra+sLa
Km
Js+D
51
Note that we can rewrite the expression for I
a
(s) as
I
a
(s) =
1
R
a
+sL
a
(V
a
(s) K
b
(s))
so an equivalent block diagram is
PSfrag replacements
V
a
(s) I
a
(s) (s)
+

1
Ra+sLa
K
b
Km
Js+D
But we have not isolated (s) algebraicly yet. Equating torques, we have
T
m
= Js(s) +D(s) = K
m
I
a
(s) = K
m
V
a
(s) K
b
(s)
R
a
+sL
s
Divide both sides by Js +D,
(s) =
K
m
V
a
(s)
(Js +D)(R
a
+sL
a
)

K
m
K
b
(Js +D)(R
a
+sL
a
)
(s)
Move all the terms onto the left
_
1 +
K
m
K
b
(Js +D)(R
a
+sL
a
)
_
(s) =
K
m
V
a
(s)
(Js +D)(R
a
+sL
a
)
Bring the right had side over a common denominator
_
(Js +D)(R
a
+sL
a
) +K
m
K
b
(Js +D)(R
a
+sL
a
)
_
(s) =
K
m
V
a
(s)
(Js +D)(R
a
+sL
a
)
Solve for :
(s) =
K
m
(R
a
+sL
a
)(Js +D) +K
m
K
b
V
a
(s)
Again, it is common to design DC motors so that the armature time constant
a
=
L
a
/R
a
, is much faster than the load dynamics, so that
a
can be ignored. In that case,
we have
(s) =
K
m
R
a
(Js +D) +K
m
K
b
V
a
(s)
which leads to a mechanical time constant,

l
=
R
a
J
R
a
D +K
m
K
b
so that
(s) =
(s)
s
=
K
m
/(R
a
D +K
b
K
m
)
s(1 +
l
s)
52
6.3 Linearization
This course deals primarily with linear systems.
Linear systems are relatively easy to work with because they satisfy the properties of
superposition and homogeneity (scaling).
1. Homogeneity (Scaling)
2. Superposition
Unfortunately, every system in the real world is nonlinear (if you push it hard enough).
Although designers and engineers take great care to make sure that many systems
behave linearly, you may still have to deal with the occaisional nonlinear system.
The simplest approach, is to linearize the system about one or more operating points,
and then to analyse the linearized models.
1. Find an equilibrium point where the system comes to rest given a constant
(often zero) input. Call this point x
0
.
2. Compute a Taylor expansion about that point
f(x
0
+
x
) = f(x
0
) +
x
df
dx

x=xo
+ Higher Order Terms
3. Redne x
0
as 0, and analyse the linearized system
f(
x
) = K
x
where K =
df
dx

x=xo
This is essentially how we dealt with gravity, when considering linear motion systems.
We found x
0
, to be the point where the spring force cancelled gravity, and dened all
displacements relative to x
o
. (Of course, the rest of the problem was linear).
6.4 Example: Nonlinear Spring
Suppose that a nonlinear spring has the following characteristic,
f
s
(x) = k
1
x +k
3
x
3
where k
1
and k
3
are positive. This spring gets stier as it is stretched away from
equilibrium.
For k
1
= 1000N/m, and k
3
= 10, 000N/m
3
, the characteristic looks like:
53
0.4 0.3 0.2 0.1 0 0.1 0.2 0.3 0.4
800
600
400
200
0
200
400
600
800
Nonlinear Spring Characteristic
F
o
r
c
e

(
N
)
Displacement (m)
Suppose that we have a mass/spring/damper system that includes this nonlinear
spring,
x(t)
f(t)
m
b f
s
(x)
m = 50Kg
b = 100Ns/m
g 10m/s
2
How can we analyze the motion of this system?
First, nd the equilibrium point. In this case, we must nd x such that
f(x
o
) = mg
To solve this, we have
1, 000x
o
+ 10, 000x
3
o
= 500 = 20x
3
o
+ 20x
o
1 = 0
using Matlabs roots function
>> roots([20 0 2 -1])
ans =
-0.1401 + 0.3986i
-0.1401 - 0.3986i
0.2801
54
using the single real solution, we have x
o
= 0.28m.
Now, consider the variable y = x x
o
, and do the Taylor expansion,
f(y) = f(x
o
) +y
df(x)
dx

x=xo
+...
Notice that the rst term exactly cancels the eect of gravity.
The second term is
y (k
1
+ 3k
3
x
2
o
) = yk
e
3350y
Now, we can analyze the system as if the spring had spring constant of k
e
(provided
that y remains small).
0.4 0.3 0.2 0.1 0 0.1 0.2 0.3 0.4
800
600
400
200
0
200
400
600
800
Nonlinear Spring Characteristic
F
o
r
c
e

(
N
)
Displacement (m)
Nonlinear Spring Force
Linearized Spring Force
Suppose that we have a mass/spring/damper system that includes this nonlinear
spring,
x(t)
f(t)
m
b f
s
(x)
m = 50Kg
b = 100Ns/m
g 10m/s
2
55
7 Transient Response Analysis:
There are three fundamental questions concerning the performance of a control system:
1. Is the system stable? (i.e. can you apply the nal value theorem)?
2. If it is stable, what happens when t ? Ideally, this steady state response
should track the input, r(t).
3. How does the system get there? This is the transient response. Since we can learn
quite a bit about the transient response from the closed loop pole positions, well
tackle this question rst.
For the most part, we will be concerning ourselves with regulators: systems designed
to follow a constant (or at least very slowly changing) input. For that purpose, we
might as well look at the unit step response.
The shape of the unit step response can be quantied in several ways. Later on,
these characteristics of the step response will become design specications for control
systems.
0 0.5 1 1.5 2 2.5
0
0.2
0.4
0.6
0.8
1
1.2
Transient Response Analyis
Time (sec)
A
m
p
l
i
t
u
d
e

(
V
)
T
r1
T
s
P.O.
T
p
M.P.
The most common specications are:
56
1. The rise time. This measures the speed of the systems response. It is usually
quoted as the time required for the system to get from 10% of the nal value to
90% of the nal value. However, it is prudent to specify exactly which rise time
you mean, when you use this specication.
Last years text (Dorf and Bishop) used T
r
for the 0/100 rise time, and T
r1
for
the 10/90 rise time. These symbols are not universal.
2. The peak time. The time between the step input, and the point at which the
peak overshoot occurs. This is also used as a measure of the response speed. The
usual symbol is T
p
. Thus, if the step occurs at t = 0, then
MP = y(T
p
)
is the maximum value of the step response.
3. The Peak Overshoot. This is usually expressed as a percentage,
P.O. = 100
MP y()
y()
where y() is the nal value of the step response.
Note: in some cases, a system will not overshoot its nal value. However, these
systems tend to be rather sluggish.
4. The Settling Time. This is the time after which the output stays within a xed
percentage of its nal value. Generally, either 5% or 2% is used. Thus, the 5%
settling time, is the time that elapses between the step input, and the point after
which the output remains between 0.95 and 1.05 times the nal value. As with
the rise time, you should spell out exactly what you mean by the phrase setting
time. Dorf and Bishop use the 2% criterion, and the symbol T
s
, for the settling
time.
7.1 First-Order Systems
Suppose that we have a rst-order system, with transfer function
C(s)
R(s)
=
a
s +a
which has a pole at s = a
The unit step response of this system is
Y (s) =
a
s(s +a)
=
1
s

1
s +a
In the time domain, this is
y(t) =
_
1 e
at
_
u(t)
We can dene the time constant, = 1/a,
y(t) =
_
1 e
t/
_
u(t)
57
0 1 2 3 4 5 6
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Unit Step Response, H(s) = 1/s+1
Time (sec)
A
m
p
l
i
t
u
d
e

(
V
)
T
r1
T
s
In this case, the nal value is y() = 1.
The output never exceeds y = 1, so there is no overshoot, and no peak time.
Again, since the nal value is only reached as t , the 0/100 rise time is innite.
Solve for the 10/90 rise time.
Find t
10
, the point where the response crosses through y = 0.1,
0.1 = 1 e
t
10
/
t
10
= log(0.9)
= 0.1054
Note: this is a natural logarithm. For base-10 logs, I will use the symbol log
10
.
Matlab uses the function log to compute natural logs, and log10 to compute
base-10 (aka common) logarithms.
Find t
90
the same way.
t
90
= 2.3026
58
Thus, for a rst-order system, the 10/90 rise time is about,
T
r1
2.2
How about the settling time. For the 5% and 2% criteria, we have
t
5%
= log(0.05) = 2.9957 3
t
2%
= log(0.02) = 3.9120 4
For a rst-order system we have
T
r1
2.2
T
s
4
Thus, these specications depend on the time constant/ pole location. To achieve
a given rise time or settling time, all we have to do, is choose the appropriate time
constant.
Things will get a little more interesting when we look at higher-order systems.
7.1.1 Example
Given this closed-loop system with an adjustable gain, K,

+
R(s) C(s)
K
1
s + 1
Find the range of gains, K, that will result in a 10/90 rise time of less than 1 second.
Step 1: Find the closed-loop transfer function.
C(s)
R(s)
=
K
s+1
1 +
K
s+1
=
K
s + 1 +K
Thus, we have a closed-loop pole at
s = (1 +K)
or a time constant of
=
1
1 +K
59
To obtain the desired rise time, we must have
1 < 2.2 =
2.2
1 +K
Thus, multiplying out the fraction, we have
1 +K > 2.2 K > 1.2
Notice, however, that the nal value of the step response is,
c

= lim
s0
sC(s)
= lim
s0
sR(s)H(s)
= lim
s0
s
1
s
K
s + 1 +K
=
K
1 +K
Thus, this system cant track a step input exactly. Even if you wait forever, the output
will only reach K/1 +K.
The larger the gain, K, the better the tracking (and the faster the response).
Of course, in the real world, we cant just crank the gain to . Over the next couple
of weeks, we will nd more elegant ways of
1. Speeding up the response.
2. Increasing the accuracy
60
7.2 Transient Response of Second-Order Systems
Now, consider a (normalized) second-order system,
C(s) =

2
n
s
2
+ 2
n
s +
2
n
R(s)
where

n
is the undamped natural frequency
is the damping factor
What are the poles of this system? They are the solutions to
s
2
+ 2
n
s +
2
n
= 0
s =
2
n

_
4
2

2
n
4
2
n
2
=
n

n
_

2
1

n
is the undamped natural frequency, and is taken to be positive.
Thus, if < 0, the poles are in the right half plane, and the system is therefore unstable.
For > 1, we have two real poles, since
2
1 > 0.
For 0 < < 1, the poles are complex, and are located at
s =
n
j
n
_
1
2
Plotting them in the complex plane, we see that they lie on a circle of radius
n
,
X
X

n
j
n
_
1
2

j
61
Consider the response to a unit step input, R(s) = 1/s.
C(s) =

2
n
s(s
2
+ 2
n
s +
2
n
)
Expanding as partial fractions gives,
C(s) =
1
s
+
as +b
s
2
+ 2
n
s +
2
n
where
a = 1
b = 2
n
So,
C(s) =
1
s

s + 2
n
s
2
+ 2
n
s +
2
n
=
1
s

s +
(s +)
2
+
2
d

d
(s +)
2
+
2
d
where =
n
and
d
=
n
_
1
2
, and is called the damped natural frequency.
Doing the inverse Laplace transforms, we have
c(t) = 1 e
t
_
cos(
d
t) +

_
1
2
sin(
d
t)
_
= 1
1
_
1
2
e
t
sin(
d
t +)
where
= tan
1
_
_
1
2

_
= cos
1
()
The relationships between the various quantities are dened in this gure.
X
j
d

n
_
1
2

62
Notice that a radial line emanating from the origin, (i.e. constant ) will have a
constant damping factor, .
7.2.1 Peak Time
To nd the peak time, dierentiate c(t), and set the result to zero. It will be easiest
to use the rst (cos and sin form).
dc(t)
dt
= e
t
_
cos(
d
t) +

_
1
2
sin(
d
t)
_
+
d
e
t
_
sin(
d
t)

_
1
2
cos(
d
t)
_
Notice that the two cosine terms cancel, because

_
1
2
=

n
_
1
2

_
1
2
=
n
=
Thus, we have
dc(t)
dt
= e
t
sin(
d
t)
_


_
1
2
_
= 0
Thus, the extrema will occur when sin(
d
t) = 0, since the other two terms will never
be zero. The extrema occur at
d
t = k for k = 0, 1, 2....
Clearly, k = 0 is a minimum, so k = 1 is the rst maximum. Thus,
T
p
=

d
63
7.2.2 Peak Overshoot
The amplitude of the rst peak is obtained from c(T
p
). Thus,
M
p
= c(T
p
)
= 1 e
/
d
_
cos() +

_
1
2
sin()
_
but, cos() = 1, and sin() = 0. Furthermore,

d
=

n

n
_
1
2
=

_
1
2
So that
M
p
= 1 +e
/

1
2
As a result, the percent overshoot is,
P.O. = 100 e
/

1
2
Notice that the peak overshoot depends only on the damping factor, . Two handy
values to remember are
= 0.5( = 60
o
) P.O. 16%
= 0.7( = 45
o
) P.O. 5%
7.2.3 Settling Time
If we wanted to calculate this exactly, we would nd the smallest T
s
that satises,
[1 c(T
s
)[ 0.02
for the 2% criterion. Thus,

1
_
1
2
e
Ts
sin(
d
T
s
+)

< 0.02
Solving this requires a numerical approach. Furthermore, the result that one gets
cannot be readily incorporated into a design rule, so solving this numerically isnt
really all that useful.
Instead, lets concentrate on the exponential envelope. Clearly, when the envelope is
within the 2% bounds, the step response must be inside the bounds as well.
64
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
Step Response, Envelope, and 5% Settling Bounds
time (s)
A
m
p
l
i
t
u
d
e
T
5%
1
exp(nt)

1
2
1 +
exp(nt)

1
2
3
n
Note: This gure shows 5% bounds, and an approximate 5% settling time of 3/
n
(see below), just to make things easier to see. A plot based on the 2% criterion would
show essentially the same thing (but be more compressed).
For the envelope to be inside the 2% bounds, we must have,
1
_
1
2
e
nt
< 0.02
To simplify things further, ignore the factor of 1/
_
1
2
, in which case, we must solve
e
nTs
= 0.02
which yields
T
s
=
3.9120

n
65
Similarly, for the 5% criterion, we have
T
5%
=
2.9957

n
Note: There were two approximations used in this derivation.
1. First of all, we used the exponential envelope, rather than the actual step response.
Since the step response will always be inside this envelope, this will tend to
overestimate the settling time, unless the 2% threshold is crossed exactly at a
local maximum or minimum in the response.
2. Secondly, we ignored the factor of 1/
_
1
2
in the size of the envelope. This
will tend to make the envelope slightly smaller (for relatively small ), and hence
shorten the apparent settling time.
The gure at the top of the next page shows the exact settling time, as a function
of , and normalized with respect to the time constant, 1/
n
. The envelope-based
approximation shown in the gure is 3.91 time-constants (i.e. log(0.02)) rather than
4, which is the gure usually used to characterize the settling time. From the gure,
you can see that using 4 time constants gives a reasonable bound on the settling time
for less than about 0.65 or so.
The large discontinuities in the actual settling time occur when a local max or min
falls completely inside the 2% bound. At that point, the settling time jumps back to
a point close to the previous max or min (which will still be outside of the bound).
0.3 0.4 0.5 0.6 0.7 0.8 0.9
2.5
3
3.5
4
4.5
Actual 2 % settling time and envelopebased approximation

N
o
r
m
a
l
i
z
e
d

S
e
t
t
l
i
n
g

T
i
m
e

(
T
s

n
)
Actual Settling Time
Envelope Approximation
66
7.2.4 Rise Time
Although it is less important, practically, consider the 0/100 rise time (T
r
in Dorf and
Bishop) rst.
All we need to do, is to nd the rst time that c(t) = 1. Thus,
c(T
r
) = 1
1
_
1
2
e
nTr
sin(
d
T
r
+) = 1
Thus,
sin(
d
T
r
+) = 0 =
d
T
r
+ = 0, , 2, . . .
The 0/100 rise time is the rst positve solution to this equation. Thus,
T
r
=

d
Despite its apparent simplicity, this expression is still dicult to use. Given directly
in terms of and
n
, it becomes
T
r
=
cos
1
()

n
_
1
2
Proceeding numerically, it is possible to plot lines of constant rise time in the s-plane.
The next gure shows these, for the pole with the positive imaginary part remember
that the poles occur in complex cojugate pairs. Points below, or to the left of these
lines will have longer rise times, points above and to the right will have faster rise
times.
67
5 4.5 4 3.5 3 2.5 2 1.5 1 0.5 0
0
0.5
1
1.5
2
2.5
3
Re(s) =
n
I
m
(
s
)

=

n

(
1

2
)
1
/
2
Loci of Poles with Constant 0/100 Rise Times
Tr = 1 sec.
Tr = 2 sec.
Tr = 3 sec.
Tr = 4 sec.
7.2.5 10/90 Rise Time
Now, consider the 10/90 rise time. To solve for this, we would have to proceed numer-
ically, solving
c(t1) = 0.1
c(t2) = 0.9
T
r1
= t2 t1
However, these are more complicated than the time to 100%, since we cannot ignore
the contribution of the exponential. However, if one computes T
r1
numerically, it can
be shown that the approximation
T
r1

2.16 0.60

n
is reasonably accurate, for 0.3 < < 0.8.
The observations from the 0/100 rise time also apply. Moving the poles closer to the
real axis tends to slow the rise time.
68
7.3 Dominant-Poles of Higher-Order Systems.
We have put a fair bit of eort into understanding/predicting how a second-order,
all-pole system will behave.
Most systems, probably, will either be of higher-order, contain zeros, or both. In this
section, we will see that under certain conditions, it is possible to approximate a system
by a complex conjugate pair of poles.
In reality, this would be the rst step of a cycle
Design using a second-order approximation.
Simulate high-order system on a computer, and tweak the design as necessary.
Build the real system, (and tweak to x the details that the simulation missed).
7.3.1 Graphical Transfer Function Evaluation
To make it easier to see why certain terms are more signicant than others, it will be
useful to do partial fractions expansions graphically.
Lets start with someting simle. Consider the unit step response of a rst-order system,
G(s) =
a
s +a
C(s) =
a
s(s +a)
=
1
s

1
s +a
c(t) =
_
1 e
at
_
u(t)
In the partial fraction expansion, the coecient of the 1/s term was evaluated by
computing the rest of the transform at the point s = 0.
a
s +a

s=0
= 1
Similarly, the coecient of the 1/(s + a) term was obtained by evaluating the rest of
the transform at the point s = a.
a
s

s=a
= 1
In the language of complex analysis, this is called computing the residues at the poles.
Now, lets see how we could have done this graphically....
69
Consider two points, and in the complex plane. The number can be repre-
sented as a vector from to .


How does this help us? Well, to evaluate the coecient of the 1/s term, we have to
compute
a
s +a

s=0
= a
1
0 (a)
The denominator can be thought of as a vector from s = a to s = 0 in the complex
plane. This vector has length a, at an angle of 0
o
. Since it is in the denominator, we
get
1
a

0
o
which we multiply by the numerator, a, to get the coecient, 1.
X X
s = 0 s = a
Re(s)
Im(s)
The general principal, is that we draw a vector from the pole or zero that is being
evaluated, to the point where its value is being computed. In the previous example,
we were evaluating the contribution of the pole at s = a at the point s = 0.
70
In more general cases, we will have to evaluate the contributions from several poles
and zeros. To do that, it is easiest to think in polar form, so that
= r
1
e
j
1
= r
2
e
j
2
= r
1
r
2
e
j(
1
+
2

=
r
1
r
2
e
j(
1

2
So, to compute the partial fraction expansion coecients for the step response of a
high-order system, we will compute the contributions from all of the zeros and poles
and then multiply and/or divide them as appropriate.
Since we are dealing with step responses, there will always be a pole at s = 0, due to
the unit step input (uless the transfer function as a zero at s = 0 that cancels it).
7.3.2 Two Complex Poles
Lets use the graphical tools to evaluate the step respones of a system with two complex
conjugate poles
Suppose we have a system whose transfer function is
G(s) =

2
n
s
2
+ 2
n
s +
2
n
The transform of the unit step response will be
Y (s) =

2
n
s(s
2
+ 2
n
s +
2
n
)
Evaluating the partial fraction coecients graphically, we see that the coecient of
the 1/s term is 1 since, it is the product of
2
n
from the numerator, divided by
n
e
j
(i.e. a length of
n
at an angle of ) from the pole in the upper half plane, and
n
e
j
from the pole in the lower half plane.
X
X
X
s = 0
Im(s)
Re(s)

s =
n
+j
d
s =
n
j
d
r
0
=

2
n

n
e
j

n
e
j
=

2
n

2
n
e
j0
= 1
71
The coecient for the pole at s =
n
+j
d
is evaluated in much the same way.
X
X
X
s = 0
Im(s)
Re(s)
s =
n
+j
d
s =
n
j
d

r
1
=

2
n

n
e
j()
2
n
_
1
2
e
j/2
=
e
j
2j
_
1
2
Clearly, the coecient for the other complex pole is the complex conjugate of r
1
. Thus,
the output is,
y(t) =
_
1
1
2j
_
1
2
e
nt+j(
d
t+
+
1
2j
_
1
2
e
ntj(
d
t+
_
u(t)
=
_
1
1
2
_
1
2
sin(
d
t +)
_
u(t)
The bottom line, is that once you evaluate the partial expansion coecient for a
complex pole, you know immediately what the gain and phase of the damped sinusoid
are going to be.
7.3.3 Case 1: An Extra Zero
In this case, we want to compare the step responses for the two systems,
G
0
(s) =

2
n
(s
2
+ 2
n
s +
2
n
)
G
1
(s) =

2
n
(s +a)
a(s
2
+ 2
n
s +
2
n
)
Evaluate the residue at one of the complex conjugate poles.
O X
X
X
Im(s)
s = a
Re(s)

2
d

r

n
72
Without the extra zero, we get the same result as before,

2
n
2
d

n
e
j(3/2)
In which case, the two complex poles would contribute
e
nt
_
1
2
sin(
d
t +)
to the step response.
With the additional zero, we have to multiply the residue by,
r
a
e
j
So, the additional zero will scale the transient response by r/a, and add a phase shift
of to the damped sinusiod. We would expect the step response to be
c(t) = 1
re
nt
a
_
1
2
sin(
d
t + +)
For the zero to have only a negligible eect on the transient response, we must have
r a
0
These can be accomplished if a
n
, in which case, r a
n
a, and 0.
If the zero gets closer, things get more interseting. Although the exponential envelope
is smaller (i.e. multiplied by r/a), the phase lead means that the rst positive peak
happens earlier. The peak time will be
T
p
=

d
As a result, the exponential hasnt had as long to decay, so the peak is higher there
is more overshoot.
P.O. =
r
a
e
()/

1
2
73
7.3.4 Case 2: An extra pole
In this case, we want to compare the step responses for the two systems,
G
0
(s) =

2
n
(s
2
+ 2
n
s +
2
n
)
R(s)G
2
(s) =

2
n
a
(s +a)(s
2
+ 2
n
s +
2
n
)
Evaluate the residue at one of the complex conjugate poles.
X
X
X
X
s = a

2
d

r

n
'(s)
(s)
To nd the residues at the two complex conjugate poles, all of the computations are
the same as before, except that we must divide where we multiplied (since the extra
object is a pole instaed of a zero). Thus, the e
(n+j
d
)t
term gets multiplied by
a
r
e
j
so that the decaying sinusoid term becomes

ae
nt
r
_
1
2
sin(
d
t + )
We must also consider the term due to the pole at s = a, which leads to a time-domain
contribution e
at
, where is the residue at the pole s = a.
X
X
X
X
s = a

r
'(s)
(s)

+
74
The residue will be:
=
a
2
n
(a) re
j(+)
re
j
=

2
n
r
2
Putting it all together, the step response will be
y(t) =
_
1
ae
nt
r
_
1
2
sin(
d
t + )

2
n
r
2
e
at
_
u(t)
Looking at the pole-zero plot, a = 2
n
gives r =
n
, and the extra term will be
e
2nt
, which is certainly signicant. As a increases, this term will quickly dissapear,
since its magnitude scales with 1/r
2
.
7.3.5 Case 3: Extra Pole/Zero Pairs
Suppose we have a pair of complex conjugate poles, and we add both a pole and a
nearby zero to the system. What happens to the step response?
To answer that question, lets forget about the complex conjugate poles, and the step
input for the moment, and evaluate the contribution due to the pole and zero, at any
point in the complex plane.
G(s) =
(s +b)
(s +a)
X
O
Im(s)
s = b s = a

1
r
1
r
2

2
Re(s)
s =
Consider a point, s = , somewhere in the complex plane. Evaluating the transfer
75
function at s = gives,
G() =
(s +b)
(s + a)

s=
=
(b)
(a)
=
r
2
e
j
2
r
1
e
j
1
=
r
1
r
2
e
j (
2

1
)
If r
1
r
2
(b a), then
2

1
0, and the pole and zero will largely cancel. Thus,
when one is far away from the pole/zero pair, their eects cancel each other. A good
rule of thumb would be if r
1
or r
2
10(b a), then the pole and zero can be ignored.
7.4 Estimating Pole Locations from Step Responses
Suppose that we have a system that is dominated by two poles, so that its transfer
function can be accurately approximated by
T(s) =

2
n
s
2
+ 2
n
s +
2
n
Is it possible to approximate
n
and simply by measuring the step response?
The step response will be
y(t) =
_
1
1
_
1
2
e
nt
sin(
d
t +)
_
u(t)
The damped natural frequency,
d
, can be obtained from the period of the damped
oscillations. Measure the time from one maximum to the next (assming there are at
least 2) or look at the peak time.
To get the damping factor, you could measure the % overshoot, and use the formula
PO = 100 e
/

1
2
or,...
Count the number of oscillations visible in the response.
Assume that when the exponential envelope decays to 2% of the step size, (i.e.
after 4 time constants) that the oscillations will no longer be visible.
76
In each time constant, there will be

d
2
=
_
1
2

n
2

1

n
=
_
1
2
2
oscillations.
Thus, the number of cycles in 4 time constants is
N =
4
_
1
2
2
For = 0.5, we have
_
1
2
0.866. If we use this value
_
1
2
, we get
N =
4 0.866
2
=
0.55

Thus, for 0.5, 0.55/N, where N is the number of visible oscillations in


the step response.
If is larger than about 0.6, it will be very dicult to estimate using either method, as
there will be very little overshoot and there will be less than one period of the damped
oscillation visible.
77
8 Stability
A system was said to be (BIBO) stable if any bounded input produced a bounded
output.
Suppose we have a system
R(s)
H(s)
C(s)
Clearly, the output is
C(s) = H(s)R(s)
Let the input be a unit step, R(s) = 1/s, which is clearly a bounded signal, and let
the transfer function be
H(s) =
K(s z
1
)(s z
2
) . . . (s z
m
)
(s p
1
)(s p
2
) . . . (s p
n
)
i.e. the system has n poles at s = p
1
, p
2
, . . . , p
n
,
and m zeros at s = z
1
, z
2
, . . . , z
m
.
For simplicity, let all of the poles be distinct, in which case, we can use a partial fraction
expansion,
C(s) =
r
0
s
+
r
1
s p
1
+
r
2
s p
2
+. . . +
r
n
s p
n
which we can inverse Laplace transform into
c(t) =
_
r
0
+r
1
e
p
1
t
+r
2
e
p
2
t
+. . . +r
n
e
pnt
_
1(t)
Now, consider the kth pole, s = p
k
. If '(p
k
) < 0, the pole, s = p
k
, will be in the
left half plane (its real part will be negative). Furthermore, the time-domain the
exponential will decay to zero,
lim
t
r
k
e
p
k
t
= 0
If we have repeated poles, the response will contain terms like,
r
k
te
p
k
t
but these will also decay to zero as t (Just use lH opitales rule).
Notice, that if any of the poles is in the right half plane, the response will contain an
increasing exponential, and blow up to innity.
Thus, in order for a system to be stable, ALL if its poles must be in the left half
plane (LHP).
78
8.1 Marginal Stability
Mathematicians like to talk about marginal stability.
If a system has non-repeated poles on the imaginary axis, its step response (and its
response to an impulse, sinusoid, etc), will contain a sinusoid of constant amplitude.
However, if the input is a sinusoid at the same frequency, the output will blow up to
innity.
Since the output only blows up to innity for a specic (bounded) input, it is sometimes
called Marginally Stable.
However, since the term does not decay to zero, even for a step or impulse input, the
system wont be of much practical use (since we cant really control it).
Furthermore, any innitessimal drift in the systems parameters will make it either
stable or unstable.
Bottom Line: Marginal stability is really just a mathematical curiosity, with little
practical signicance.
8.2 Instability in the Real World
In the world of mathematical models, we talk about resonses that blow up to innity.
This doesnt really happen in the physical world. Things tend to reach physical limits
long before they get to innity....
8.3 Testing for Stabiliy
All that is required, to test for stability, is to look see whether the systems poles are
in the left half plane (good), or in the right half plane (baaad).
Unfortunately, we are often faced with high degree polynomials,
G(s) =
B(s)
A(s)
=
B(s)
s
n
+a
n1
s
n1
+a
n2
s
n2
+. . . +a
1
s +a
0
So, how can you tell where the poles are (if the battery in your laptop just died)....
Suppose that the polynomial could be factored
A(s) = (s p
1
)(s p
2
) . . . (s p
n
)
so that p
1
, p
2
, . . . p
n
are the systems poles.
79
Consider what would happen if we multiplied this out....
A(s) = s
n
(p
1
+p
2
+. . . +p
n
)s
n1
+ (p
1
p
2
+p
1
p
3
+. . . p
n1
p
n
)s
n2
+
(1)
n
p
1
p
2
p
3
. . . p
n
Now, suppose that all of the poles, p
k
, are in the left half plane. Thus, all of the real
parts are negative. Furthermore, since complex poles always appear in conjugate pairs,
all of the imaginary parts will cancel.
First o, all of the coecients, a
1
, a
2
, . . . a
n
will be positive.
For example, a
n1
= (p
1
+p
2
+. . . +p
n
), which is minus a negative real number (since
the real parts of all of the p
k
are assumed to be negative.
Furthermore, none of the coecients can be zero, as this would require some positve
real parts to cancel the negative real parts....
This leads to the necessary, but not sucient, condition:
For A(s) to have all left half plane poles, all of the coecients, a
n1
. . . a
0
must be
striclty greater than zero,.
If a system fails this test, then it is unstable.
If a system passes this test, then we must continue checking, and compute the Routh
array.
s
n
: a
n
a
n2
a
n4
. . .
s
n1
: a
n1
a
n3
a
n5
. . .
s
n2
: b
n1
b
n3
b
n5
. . .
s
n3
: c
n1
c
n3
c
n5
. . .
.
.
.
.
.
.
.
.
.
s : f
n1
1 : g
n1
The rst two rows are constructed from the polynomial coecients of the denominator
polynomial.
Despite what the notation might suggest, the third row (i.e. b
1
etc) is NOT contructed
from the numerator coecients.
The numerator coecients are computed using (negative) determinants,
b
n1
=
a
n1
a
n2
a
n
a
n3
a
n1
b
2
=
a
n1
a
n4
a
n
a
n5
a
n1
80
Thus, you form (negative) determinants, using the left-most column, and each of
the remaining columns, in the two rows above your current position. (and insert a 0
at the end of a short row, if necessary).
Continue computing in this fashion, until you construct 2 rows with 1 element each.
The number of sign changes in the rst column will be equal to the number of right
half plane roots.
8.3.1 Example
Let A(s) = s
4
+ 2s
3
+ 3s
2
+ 4s + 5
All coecients are strictly positive.
Construct the routh array
s
4
: 1 3 5
s
3
: 2 4
Now compute the next row
b
3
=
2 3 4 1
2
= 1
b
2
=
2 5 0 1
2
= 5
Note that we had to add a trailing zero to the second row,so that we could compute
b
2
.
Add this row to the array.
s
4
: 1 3 5
s
3
: 2 4
s
2
: 1 5
Compute the next row
c
3
=
1 4 5 2
1
= 6
We can read o the last row, so the Routh array is
s
4
: 1 3 5
s
3
: 2 4
s
2
: 1 5
s
1
: 6
s
0
: 5
81
Since there are 2 sign changes in the nal row, we know that the system has 2 right
half plane poles, and is therefore unstable.
Use Matlab to check our answer
>> roots([1 2 3 4 5])
ans =
0.2878 + 1.4161i
0.2878 - 1.4161i
-1.2878 + 0.8579i
-1.2878 - 0.8579i
Notice that two of the roots have positive real parts, just as the Routh Hurwitz test
indicated.
8.4 Summary
A system is stable if all of its poles are in the open left half plane (i.e. not including
the imaginary axis).
The Routh-Hurwitz test can be used to count the number of right-half plane roots of
a polynomial. x
1. All coecients must be present, and strictly positive.
A(s) = s
n
+a
n1
s
n1
+. . . +a
1
s +a
0
2. Form the Routh Array
s
n
: a
n
a
n2
a
n4
. . .
s
n1
: a
n1
a
n3
a
n5
. . .
s
n2
: b
n1
b
n3
b
n5
. . .
s
n3
: c
n1
c
n3
c
n5
. . .
.
.
.
.
.
.
.
.
.
s : f
n1
1 : g
n1
where the elements in the third rows and below are formed using negative deter-
minants with the next two higher rows.
3. The number of sign changes in the rst column is equal to the number of right
half plane roots.
82
8.5 Designing for Stability
Ensuring that a control system is stable is the most important job of a control designer. In
some cases, the Routh-Hurwitz test can be used to determine acceptable ranges, in that they
dont produce unstable systems, for one or more parameters. Once the system is guaranteed
to be stable, then we can worry about meeting other performance specications.
8.5.1 Stability as a Function of Gain
Consider the following feedback control system, and determine what values of K result in a
stable system.

+
K
s
1
s
2
+s + 1
R(s) E(s) C(s)
Solution:
1. Obtain the closed-loop transfer function.
C(s)
R(s)
=
K/(s
3
+s
2
+s)
1 +K/(s
3
+s
2
+s)
=
K
s
3
+s
2
+s +K
2. Use the Routh-Hurwitz test, to see what values of K will produce right half plane
poles.
(a) A(s) = s
3
+s
s
+s +K.
(b) All coecients must be positive, so K > 0.
(c) Construct the Routh array,
s
3
: 1 1
s
2
: 1 K
s : 1 K
1 : K
Thus, if 0 < K < 1, then all the entries in the rst column will be positive,
indicating that the system is stable.
83
8.5.2 Evaluating Stability as a Function of zero position
Consider the following feedback control system, and determine what values of a, i.e. the
position of the zero in the controller, are necessary for a stable system.

+
10(s +a)
s
1
s
2
+ 2s + 4
R(s) C(s)
Solution:
1. Obtain the closed-loop transfer function.
C(s)
R(s)
=
10(s +a)/(s
3
+ 2s
2
+ 4s)
1 + 10(s +a)/(s
3
+ 2s
2
+ 4s)
=
10(s +a)
s
3
+ 2s
2
+ 14s + 10a
2. Use the Routh-Hurwitz test, to see what values of a will produce right half plane poles.
(a) A(s) = s
3
+ 2s
s
+ 14s + 10a.
(b) All coecients must be positive, so a > 0.
(c) Construct the Routh array,
s
3
: 1 14
s
2
: 2 10a
s : 14 5a
1 : 10a
Thus, if 0 < a < 14/5, then all the entries in the rst column will be positive,
indicating that the system is stable.
8.6 Special Cases:
8.6.1 Zero in the rst column
A zero in the rst column indicates that there is a pair of purely imaginary roots (why
not s = 0 as a root?).
Thus, the system is at best marginally stable (and hence not BIBO stable).
However, this zero in the rst column might mask the presence of other right half plane
roots (in which case the system would be unstable, both to a mathematician and to a
control engineer).
84
Example: Does the following polynomial have any right half plane roots?
A(s) = s
3
+ 2s
2
+s + 2
All the coecients are positive so far so good.
Construct the Routh array,
s
3
: 1 1
s
2
: 2 2
s : b
2
1 : c
2
b
2
=
2(1) 2(1)
2
= 0
c
2
=
2(b
2
)
b
2
=
0
0
DOH!!!!
This raises 2 questions:
1. Is 0 positive or negative (i.e. is there a sign change between rows 3 and 4)?
2. What can we do about the divide by zero?
Suppose that we replace zero by a small positive number, . Then, the Routh array
becomes
s
3
: 1 1
s
2
: 2 2
s :
1 : 2
As a result there are no sign changes in the rst column.
This indicates that the polynomial A(s) has a pair of complex conjugate roots on the
imaginary axis, but no roots in the right half plane.
8.6.2 A whole row of zeros
Example: Does following polynomial have any right half plane roots?
A(s) = s
5
+ 7s
4
6s
3
+ 42s
2
+ 8s + 56
All the coecients are positive so far so good.
Construct the Routh array,
s
5
: 1 6 8
s
4
: 7 42 56
s
3
: 0 0
What do we do now?
85
The row of zeros indicates that the polynomial on the previous (i.e. s
4
) row divides
evenly into A(s).
P(s) = 7s
4
+ 42s
2
+ 56 = 7
_
s
4
+ 6s
2
+ 8
_
If we do the long division, we see that
A(s) = s
5
+ 7s
4
6s
3
+ 42s
2
+ 8s + 56 = (s + 7)(s
4
+ 6s
2
+ 8)
Clearly, the rst pole is in the LHP.
What about the polynomial
P(s) = s
4
+ 6s
2
+ 8
We could think of this as a polynomial in s
2
. Let w = s
2
, and solve
Q(w) = w
2
+ 6w + 8 = 0
w =
6

36 62
2
= 3 1 = 4 or 2
Now, solving for s, we have
s = 2j, or

2j
Notice that if roots of Q(w) are anywhere other than on the negative real axis, there
will be a root of P(s) in the right half plane.
So, we would like to make sure that all of the roots of Q(w) are negative and real. To
do this, compute the derivative of P(s),
P

(s) = 4s
3
+ 12s
and construct a Routh array whose rst row contains the coecients of P(s), and
whose second row contains the coecients of P

(s).
s
4
: 1 6 8
s
3
: 4 12
s
2
: 3 8
s
1
: 4/3
s
0
: 8
There are no sign changes. This indicates that all of the roots of P(s) are on the
imaginary axis.
Thus, the system is marginally stable, but not BIBO stable.
86
9 Steady State Errors
So far, we have gured out when a system is stable, and we have examined the shape of its
transient response. One remaining question is, how well does it track the input, once the
transients have died away? Consider the following unity negative feedback system.

+
R(s) E(s) C(s)
G(s)
Since we are interested in the tracking ability of the system, the relevant output is
the error signal E(s) = R(s) C(s). To compute the transfer function from the input to
the error, rearrange the block diagram so that E(s) is the output, by placing G(s) in the
feedback path.

+
R(s)
G(s)
E(s)
C(s)
Then, it should be obvious that the relevant transfer function is
E(s)
R(s)
=
1
1 +G(s)
9.1 Systems with no poles or zeros at the origin
Suppose that the open loop transfer function is
G(s) =
K(s z
1
)(s z
2
) . . . (s z
m
)
(s p
1
)(s p
2
) . . . (s p
n
)
and that none of the poles or zeros is at the origin. Thus,
z
1
, z
2
, . . . , z
m
,= 0 and p
1
, p
2
, . . . , p
n
,= 0
If you prefer the to normalize the poles and zeros, you might to write this transfer function
as
G(s) =
Kz
1
z
2
. . . z
m
p
1
p
2
. . . p
n

(1 s/z
1
)(1 s/z
2
) . . . (1 s/z
m
)
(1 s/p
1
)(1 s/p
2
) . . . (1 s/p
n
)
Now, suppose that the input is a unit step, R(s) = 1/s. What is the nal value of the
tracking error?
lim
t
e(t) = lim
s0
sE(s)
= lim
s0
s
1
s
1
1 +G(s)
87
Recall that we had assumed that G(s) had no poles nor zeros at s = 0. Thus, we can just
plug in s = 0 to evaluate the limit, and
lim
t
e(t) =
1
1 +G(0)
Furthermore, G(0) is just
G(0) =
K(z
1
)(z
2
) . . . (z
m
)
(p
1
)(p
2
) . . . (p
n
)
Denition: K
p
= G(0) is called the static position error constant. The steady state error
to a unit step input is given by
lim
t
e(t) =
1
1 +K
p
Note: This is the same symbol that is used for the proportional gain in PI ( and PD and
PID) controllers. Hopefully the context will make it obvious which meaning is intended.....
9.2 Design Example:
Consider the following unity negative feedback control system.

+
R(s) E(s) C(s)
G(s)
where the open-loop transfer function is,
G(s) = K
s + 10
s + 1
Choose the forward gain, K, so that the system can track a step input with less than 1%
steady state error.
Solution: Since the system is linear, superposition applies. Thus, meeting the design spec
for a unit step will automatically mean that the design specication will be met for all step
inputs. Thus, let the input be a unit step,
R(s) = 1/s
and choose K such that
lim
t
e(t) < 0.01
Since the input is a unit step, evaluate the static position error constant,
K
p
= G(0) = 10K
88
The steady state error is given by
lim
t
e(t) =
1
1 +K
p
=
1
1 + 10K
To meet the design spec, we must have
1
10K + 1
< 0.01
100 < 10K + 1
K > 9.9
Notice, that we did not have to compute the closed loop transfer function at all. We simply
designed the open-loop transfer function (which we can do directly).
Secondly, note that we are able to deduce things in the time domain (the steady state
error), from calculations in the frequency domain. (no inverse transform).
9.3 Systems with one pole at s = 0
Consider, once again, a unity negative feedback control system,

+
R(s) E(s) C(s)
G(s)
however, this time, let the open loop transfer function, G(s), have exactly one pole at s = 0.
Thus,
G(s) =
K
s
(s z
1
)(s z
2
) . . . (s z
m
)
(s p
1
)(s p
2
) . . . (s p
n
)
where, z
1
, . . . , z
m
and p
1
, . . . , p
n
,= 0.
As before, let the input be a unit step. In the frequency domain,
R(s) = 1/s
and the error is
E(s) =
1
s
1
1 +G(s)
=
1
s +sG(s)
Assuming that the closed loop system is stable, so that we can use the nal value theorem,
lim
t
= lim
s0
s
s +sG(s)
= lim
s0
1
1 +G(s)
=
1
1 +
= 0
89
since G(s) now has a pole at s = 0.
Thus, if the OPEN LOOP system has a single pole at the origin, then the CLOSED
LOOP system can track a step input exactly (i.e. with 0 steady state error). Furthermore,
this steady state tracking ability is independent of the gain, K.
Another way of looking at this is,
K
p
= G(0) =
Next, see what happens when we apply a unit ramp input. In this case
R(s) =
1
s
2
Thus, the steady state error will be
lim
t
e(t) = lim
s0
1
s +sG(s)
=
1
0 +K
(sz
1
)(sz
2
)...(szm)
(sp
1
)(sp
2
)...(spn)
Predictably, we dene the static velocity error constant, as
K
v
= sG(s)

s=0
so that the steady-state ramp tracking error is
lim
t
e(t) =
1
K
v
9.3.1 Unit ramp input without integrators....
What would happen if we applied a unit ramp input to a system that has no poles at s = 0?
Well, for such a system,
K
v
= sG(s)

s=0
= 0
so the steady state error to a unit ramp input would be .
9.4 Systems with 2 poles at s = 0
Now, let the input be a unit parabola (i.e. constant acceleration). Thus
r(t) =
t
2
2
R(s) =
1
s
3
90
For a unity feedback system with one integrator in its open loop response, the steady state
tracking error is,
lim
t
e(t) = lim
s0
sE(s)
= lim
s0
s
1
s
3
1
1 +G(s)
= lim
s0
1
s
2
+s
2
G(s)
=
since the single integrator in G(s) can only cancel one of the factors of s in the denominator.
Thus, if G(s) has exactly one pole at s = 0, then the closed loop system can
1. Track a unit step input with zero steady state error.
2. Track a unit ramp error with a nite steady state error.
3. Cannot track a unit parabola input.
9.4.1 Static Acceleration Error Constant
So, following the pattern, lets try adding another integrator to the open-loop transfer func-
tion. Thus,
G(s) =
K
s
2
(s z
1
)(s z
2
) . . . (s z
m
)
(s p
1
)(s p
2
) . . . (s p
n
)
where, z
1
, . . . , z
m
and p
1
, . . . , p
n
,= 0.
We can evaluate the static position and velocity error constants,
K
p
= K
v
=
so the closed loop system will be able to track both steps and ramps with zero steady state
error.
Still following the pattern, dene the static acceleration error constant,
K
a
= s
2
G(s)

s=0
Then, it is easy to show that the steady state error in response to a unit parabola input is
given by,
lim
t
e(t) =
1
K
a
91
Table 2: Steady State Tracking Errors
System unit step unit ramp unit parabola
Type input input input
0
1
1+Kp

1 0
1
Kv

2 0 0
1
Ka
9.5 Summary
Denition: A Type n system is any system that has exactly n poles at s = 0.
A Type 0 system has no poles at the origin. It can track a unit step input, with a nite
but non-zero steady state error. It cannot track ramps and parabolas.
A Type 1 system has exactly 1 pole at the origin. When embedded in a unity negative
feedback loop, it can track a step input with zero steady state error, and track a ramp input
with a nite, but non-zero steady state error. It cannot track a parabolic input.
A Type 2 system has exactly 2 poles at the origin. The closed loop system can track
both steps and ramps with zero steady state error, and can track a parabolic input with a
nite steady state error.
Technically, a Type -1 system would have a zero at the origin. This would be a very silly
control system, since it couldnt even track a step input......
the static error constants are dened as:
K
p
= G(s)

s=0
K
v
= sG(s)

s=0
K
a
= s
2
G(s)

s=0
Note that for any given system, only one of these will be nite and non-zero. For example,
for a Type 1 system, K
p
= and K
a
= 0.
9.6 Caveat
All of theses derivations depend on the Final Value Theorem. Note, however, that the Final
Value Theorem,
lim
t
e(t) = lim
s0
sE(s)
only holds if all of the poles of E(s) are strictly in the left half plane, with the exception of
one pole which may be located at s = 0. In other words, these static error constants are
only valid when the closed loop system is stable.
Of course, this means that we have to gure out the closed loop transfer function, so that
we can determine the stability of the system (using the Routh Hurwitz test discussed earlier
this week).
92
10 PID Controllers
In industrial applications, the Proportional plus Integral plus Derivative (or PID) con-
troller is one of the most popular control designs.
The transfer function of the PID controller is
G
c
(s) =
U(s)
E(s)
= K
1
+K
2
1
s
+K
3
s
where E(s) is the Laplace transform of the error signal, and U(s) is the Laplace trans-
form of the control signal, u(t) (a symbol which unfortunately is also used as a unit
step).

G
c
(s) G
p
(s)
+ R(s) E(s) U(s) Y (s)
While we are on the subject of notational glitches, I should mention that the gains in
the PID controller are often called K
P
, K
I
and K
D
dont confuse K
p
, the static
position error constant, with K
P
, the proportional gain in a PID controller. I suppose
that Dorf and Bishop use K
1
, K
2
and K
3
to avoid this confusion (at least until you
start reading stu that is written by anybody else).
Some useful special cases of the PID controller are
1. The proportional controller G
c
(s) = K
1
2. The PI controller G
c
(s) = K
1
+K
2
/s
3. The PD controller G
c
(s) = K
1
+K
3
s
10.1 Example: Position Control of a DC motor
Consider a DC motor, whose open-loop transfer function is
G
p
(s) =
1
s(s + 1)
If we use a proportional controller, the closed-loop transfer function will be
T(s) =
K
s
2
+s +K
resulting in poles at
p
1,2
=
1

1 4K
2
93
For 0 < K < 0.25, there are 2 real poles, and for K > 0.25, the poles are complex
conjugates.
This is a Type -I system, since the open loop transfer function has 1 pole at the origin.
Since the system is stable for all K > 0 (i.e. the poles are always in the left half
plane), it will be able to track a step input with zero steady state error. Furthermore,
the static velocity error constant is
K
v
= sG(s)

s=0
= K
so that the steady state error in response to a unit ramp input will be 1/K.
When the poles are complex,
n
= 0.5. Thus, the (approximate) settling time will
always be 4/
n
= 8 seconds. Can we reduce this?
10.1.1 PD control
Lets try a PD controller.

+ R(s) E(s) U(s) Y (s)


K
1
+K
3
s
1
s(s + 1)
The open-loop transfer function is now
G
c
(s)G
p
(s) =
Y (s)
E(s)
=
K
1
+K
3
s
s(s + 1)
so the system is still of Type - I, and the static velocity error constant is
K
v
= sG(s)

s=0
= K
1
The closed-loop transfer function is
T(s) =
Y (s)
R(s)
=
K
1
+K
3
s
s(s + 1)
1 +
K
1
+K
3
s
s(s + 1)
=
K
1
+K
3
s
s
2
+ (1 +K
3
)s +K
1
The closed-loop poles are
p
1,2
=
(1 +K
3
)
_
(1 +K
3
)
2
4K
1
2
94
Notice that the (negative) real part of the poles is

n
=
1 +K
3
2
so that the settling time is,
T
s
=
4

n
=
8
1 +K
3
If we require a settling time of 2 seconds, just set K
3
= 3.
To change the rise time, overshoot, and/or peak time, we need to adjust the imaginary
part of the pole position. This can be done by adjusting K
1
.
To have complex poles we must choose
(1 +K
3
)
2
4K
1
< 0
Since we need K
3
= 3 to meet the settling time specication, this becomes,
K
1
> 4
For K
1
> 4, the damped natural frequency is given by

d
=
_
4K
1
16
If we want the fastest response that has less than 5% of overshoot, we would have to
choose
d
=
n
= 2. Thus
K
1
=

2
d
+ 16
4
= 5
However, the presence of the zero at s = K
1
/K
3
might aect the peak time and
overshoot, so we should go back and evaluate the actual step response....
In summary, the PD controller does not aect the steady state error, and allows us to
speed up the transient response.
10.1.2 PI Control
Suppose that instead of speeding up the transient response, we want to improve the
steady state tracking.
We could try using an integral controller to increase the system type from I to II, so
that there would be zero steady state error to both steps and ramps.
G
c
(s)G
s
(s) =
K
2
s
2
(s + 1)
95
Before we get too excited, lets check on the stability.
The closed loop transfer function is
T(s) =
K
2
s
3
+s
2
+K
2
Clearly, this is going to be unstable for all choices of K
2
(since there is no s
1
term. We
dont need to bother computing the Routh array.
What happens if we use a PI controller instead. The open loop transfer function will
be
G
c
(s)G
s
(s) =
_
K
1
+
K
2
s
_
1
s
2
(s + 1)
=
K
1
s +K
2
s
2
(s + 1)
which is still a type II system.
The closed-loop transfer function is
T(s) =
K
1
s +K
2
s
2
(s + 1)
1 +
K
1
s +K
2
s
2
(s + 1)
=
K
1
s +K
2
s
3
+s
2
+K
1
s +K
2
Thus, for stability, we immediately see that K
1
> 0 and K
2
> 0 are required. Now
form the Routh array
s
3
: 1 K
1
s
2
: 1 K
2
s
1
: K
1
K
2
s
0
: K
2
so that we must have K
1
> K
2
> 0 for stability.
To see what eect this controller has on the transient response, we need to gure out
where the closed-loop poles are. In this case, it involves solving a cubic equation.
To be able to get an intuitive feel for what is going on, we will need to have a tool that
allows us to estimate the locations of the closed-loop poles for third (and higher) order
systems. Luckily, that tool is just around the bend.
96
11 Root Locus Plots.
Consider the following unity feedback system,

+
R(s) C(s)
K
s+1
whose open loop transfer function is
K
s + 1
.
How does the pole of the closed loop system change as the gain, K, is increased from
0 to ?
The closed loop transfer function is
C(s)
R(s)
=
K
s + 1 +K
which has a single, real, pole at s = (K + 1).
Therefore, the pole starts at s = 0 when K = 0, and moves to the left, toward s = ,
as K increases. We can plot this in the complex plane as follows,
3 2.5 2 1.5 1 0.5 0 0.5 1
2
1.5
1
0.5
0
0.5
1
1.5
2
Real Axis
I
m
a
g
i
n
a
r
y

A
x
i
s
Root Locus for G(s) = 1/(s+1)
Open Loop Pole
Closed Loop Pole
for K = 0
Pole Moves towards
as K increases to
Note that the x denotes the pole of the open loop transfer function, which is also the
closed loop pole when K = 0.
Lets try a slightly more complicated example.
97

+
R(s) C(s)
K
(s+1)(s+3)
where the open loop transfer function is
KG(s) =
K
(s + 1)(s + 3)
In this case, the closed loop transfer function is,
C(s)
R(s)
=
K
s
2
+ 4s + 3 +K
The closed loop poles are:
s =
4
_
16 4(3 +K)
2
= 2

1 K
Thus, for K = 0, the closed loop poles are located at 2 1 = 1, 3, which are also
the open loop poles. For 0 < K 1, we have two real poles, and for K > 1, we have
a pair of complex conjugate poles at:
s = 2 j

K 1
Thus, as K increases from 0 to 1, the two real poles move toward each other, along the
real axis. As K is increased further, the two poles become complex, moving straight
up and down. As K , the poles move toward 2 j. Here is what it looks like
in the complex plane.
5 4 3 2 1 0 1
3
2
1
0
1
2
3
Real Axis
I
m
a
g
i
n
a
r
y

A
x
i
s
Root Locus for G(s) = 1/(s+1)(s+3)
Open Loop Pole
Closed Loop Pole
for K = 0
Open Loop Pole
Closed Loop Pole
for K = 0
Pole Moves towards +j
as K increases to
Pole Moves towards j
as K increases to
When K = 1, there
are two real poles
at s=2
98
These plots, which show how the closed-loop poles move as K is increased from 0 to
are called Root Locus Plots, or sometimes Root Loci.
11.1 Drawing Root Locus Plots Directly
Root Locus Plots wouldnt be too helpful if we had to nd the closed loop poles
analytically before we could draw them. Luckily, they can be constructed directly
from the open loop poles and zeros of the system. Consider a unity feedback system

+
R(s) C(s)
KG(s)
whose closed loop response is
C(s)
R(s)
=
KG(s)
1 +KG(s)
The closed loop poles are the solutions to,
1 +KG(s) = 0
=KG(s) = 1
K is a real, positive, number, 0 < K < , but G(s) is complex, in general. Therefore,
KG(s) is also complex, in general. Thus, for a point, s
0
, to be a closed-loop pole, it
must satisfy two conditions
[KG(s)[ = 1
arg(KG(s)) = 180
o
+k360
o
k = 0, 1, 2, . . .
The Magnitude Condition implies that, if s
0
is a closed-loop pole, then,
K =
1
[G(s
0
)[
The Angle Condition is more useful. Since K is a real positive number, arg(K) = 0.
Thus, for the point s
0
to be a closed-loop pole, we must have
arg(G(s
0
)) = 180
o
+k360
o
For every point, s
0
, which satises the angle condition, arg(G(s
0
)) = 180
o
, there is a
corresponding gain, K = 1/[G(s
0
)[, which satises the magnitude condition.
99
The root locus, which is a plot of the closed loop poles for all values of K between 0
and , is also the plot of all points which satisfy the angle condition.
To draw the root locus, we need only nd all of the points which satisfy the angle
condition.
Back to the rst example. The open loop transfer function was
KG(s) =
K
s + 1
Plot the open loop pole, s = 1 in the complex plane. Consider a test point, s = s
0
,
which is somewhere else in the plane. Then, s
0
+1 = s
0
(1), is a vector drawn from
the pole at s = 1 to the test point at s = s
0
.
X

s = s
0
s = 1
To compute G(s
0
), note that
1. Magnitude: [G(s
0
)[ = 1/(s
0
(1)), so the magnitude of G(s
0
) is equal to one
divided by the length of the vector from s = 1 to s = s
0
.
2. Angle: arg(G(s
0
)) = arg(s
0
(1)). Thus, the argument of G(s
0
) is equal to
negative one times the angle between the positive half of the real axis and the
vector from s = 1 to s = s
0
.
Thus, the only points on the root locus, are the points where = 180
o
i.e. the points
on the real axis, to the left of the open loop pole at s = 1.
11.2 Points on the Real Axis
11.2.1 Example
Consider rst the open-loop system G(s) =
1
s +a
100
X
= 180
o
s
L
s
R
= 0
o
Consider a test-point, s
R
, on the real axis, to the right of the pole at s = a. Then,
s
R
+a = s
R
(a), is a vector drawn from s = a to s = s
R
, which is parallel to the
positive real axis. Thus, arg(s
R
+a) = 0, and hence,
arg(G(s
R
)) = arg(s
R
+a) = 0
Thus, s
R
is not on the root locus, and the point s = s
R
will not be a closed-loop pole
of the system, regardless of the controller gain, K.
Now consider a test point, s
L
, on the real axis, but to the left of the pole at s = a.
As before, s
L
+a is a vector drawn from s = a to s = s
L
. However, in this case, the
vector is pointing in the negative real direction. Thus, arg(s
L
+a) = 180
o
, and hence
arg(G(s
L
)) = arg(s
L
+a) = 180
o
Thus, the test point, s = s
L
satises the angle condition, and is therefore on the root
locus. As a result, if we set the gain K to
K =
1
[G(s
L
)[
then the point s = s
L
will be the pole of the closed loop system.
11.2.2 Example II
Let the open loop transfer function be
G(s) =
s +b
s +a
with [b[ < [a[ (although at this point, it doesnt really matter which is which).
101
X O
arg(G(s
R
)) = 0
o
arg(G(s
L
)) = 0
o
arg(G(s
B
)) = 180
o
If we consider a test point, s = s
R
to the right of both the pole and zero, they both
contribute 0 to the argument. Thus
arg(G(s
R
)) = 0 + 0 = 0
and the section of the real axis to the right of the pole is not part of the root locus.
Next, consider a point, s = s
L
, to the left of the zero (also to the left of the pole). In
this case, the pole contributes 180
o
, but the zero contributes a phase of +180
o
. Thus,
for points to the left of both the pole and zero,
arg(G(s
R
)) = 180 + 180 = 0
o
Therefore, the real axis to the left of both the pole and zero is also not part of the root
locus.
Finally, consider a test point, s = s
B
, which is on the real axis between the pole and
the zero. In this case, the pole contributes 180
o
to the phase and the zero contributes
0
o
. Thus,
arg(G(s
R
)) = 180 + 0 = 180
o
Therefore, the segment of the real axis which lies between the pole and zero is part of
the root locus.
11.3 Complex Poles (or zeros)
In this case, the open-loop system has one real zero, and 2 complex poles.
O
X
X
180
o

102
Notice that the phase contributions from the two complex poles cancel each other out.
Thus, all of the points on the real axis, which are to the left of the zero, are on the
root locus.
11.3.1 Rule 1 for Root Locus Plots
Points on the real axis, which lie to the left of an odd number of poles and/or zeros, are
part of the root locus.
103
11.4 Summary
We considered this generic unity feedback system,

+
R(s) C(s)
KG(s)
whose open loop transfer function is KG(s), and asked ourselves how the locations of
the closed-loop poles changed as K varied from 0 to .
We observed that the closed-loop poles are the solutions to
1 +KG(s) = 0
KG(s) = 1
arg(G(s)) = 180
o
+n360
o
with K =
1
[G(s)[
and convinced ourselves of Rule # 1.
Points on the real axis, which lie to the left of an odd number of poles
and/or zeros, are part of the root locus.
11.5 Open Loop Poles and Zeros
Let the open loop transfer function be:
KG(s) =
KB(s)
A(s)
= K
s
m
+b
m1
s
m1
+. . . +b
0
s
n
+a
n1
s
n1
+. . . +a
0
The closed-loop transfer function is,
C(s)
R(s)
=
KB(s)
A(s) +KB(s)
Since n m, the closed loop transfer function will have the same number of poles as
the open-loop transfer function (n).
Consider the case when K 0. The closed-loop poles are the solutions to
A(s) +KB(s) = 0
Thus as K 0, the closed loop poles approach the solutions to
A(s) = 0
In other words, when K = 0, the closed loop poles are equal to the open loop poles.
104
What happens when K ? Then, the closed-loop poles approach the solutions to
B(s) = 0
Thus, as K , the open loop zeros become closed loop poles.
However, the number of open-loop zeros may be less than the number of closed loop
poles (which is equal to the number of open loop poles). Where do the rest of the
closed loop poles go?
As we saw in the examples, the closed loop poles can go to . Indeed, we call these
innite points zeros at innity.
If the open loop system has n poles and m zeros, then m of the closed-loop poles will
tend toward the open loop zeros, as k . The remaining n m closed loop poles
will move toward the n m zeros at innity.
Putting these observations together, we have...
11.5.1 Rule 2 for Root Locus Plots
The root locus plot has one branch for each closed loop pole. Each branch starts,
for K = 0, at the location of an open loop pole. When K , m of the
branches terminate at an open loop zero, and the remaining n m branches
terminate at a zero at innity.
11.6 Zeros at Innity and Asymptotes
Suppose that the open loop system has the transfer function
KG(s) =
K(s
m
+b
m1
s
m1
+. . . +b
1
s +b
0
)
s
n
+a
n1
s
n1
+. . . +a
1
s +a
0
then, there will be n m zeros at innity (but where).
Divide the top and bottom by B(s). This leaves K as the numerator.
To compute the denominator, use long division to divide s
n
+a
n1
s
n1
+. . . +a
1
s +a
0
by s
m
+b
m1
s
m1
+. . . +b
1
s +b
0
.
s
nm
+ (a
n1
b
m1
)s
nm1
+. . .
s
m
+b
m1
s
m1
+. . .
_
s
n
+ a
n1
s
n1
+. . .
s
n
+ b
m1
s
n1
+. . .
(a
n1
b
m1
) s
n1
+. . .
(a
n1
b
m1
) s
n1
+. . .
105
Thus, the open loop transfer function can be written as
KG(s) =
K
s
nm
+ (a
n1
b
m1
)s
nm1
+. . .
Now, if we let s , then the rst two terms in the denominator will dominate all
of the others (which have lower powers of s). Indeed, for very large values of s,
KG(s)
K
_
s +
a
n1
b
m1
nm
_
nm
In other words, for large s, the open loop transfer function looks like it is comprised of
n m poles located at the point
=
a
n1
b
m1
n m
The point , can be computed from the open-loop poles and zeros as follows. Consider
what would happen if we factored the numerator polynomial
s
m
+b
m1
s
m1
+. . . +b
0
= (s z
1
)(s z
2
) . . . (s z
m
)
Multiplying out the zeros, we see that
b
m1
= (z
1
+z
2
+. . . +z
m
)
Similarly
a
n1
= (p
1
+p
2
+. . . +p
n
)
Thus, the n m poles appear to be at the point
=

n
i=1
p
i

m
j=1
z
j
n m
=

poles

zeros
n m
Now, use the angle condition, to gure out the angles of the asymptotes that end at
end at the zeros at innity. Consider an open loop transfer function consisting of nm
poles at the point s = .
X
poles
s
o

n m
s =
106
Now place a test point, s
0
somewhere in the complex plane. The argument of G(s
0
) is
negative one times n m, times the angle subtended by a vector from the point s =
to the test point, s = s
0
. The argument is negative, because G(s) contains only poles,
and is multiplied by n m, one for each pole in G(s). Clearly, the angle condition is
satised i,
(n m) = 180 +k360 k = 0, 1, 2, . . . n m1
In other words, there are n m asymptotes, spaced equally around the circle.
11.6.1 Rule 3
If the open-loop transfer function has n poles and m zeros, the root locus plot will have nm
asymptotes (which terminate at the n m zeros at innity). The asymptotes originate at
the point
=

poles

zeros
n m
and depart at angles of
180
o
+k360
o
n m
k = 0, 1, . . . , n m1
11.6.2 Example
Let the open loop transfer function be
G(s) =
1
s(s
2
+ 2s + 2)
Find the poles of the unity feedback closed loop system, for 0 < K < .
Step1: Find the open loop poles and zeros.
There are no open loop zeros.
The open loop poles are located at s = 0 and s = 1 j.
Step 2: Find the root locus on the real axis. The negative real axis is to the left of an
odd number of poles, and so is part of the root locus.
Step 3: Zeros at innity. The open loop system has 3 poles and no zeros. Therefore,
there are 3 zeros at innity, and 3 asymptotes. The asymptotes cross at the point
=
0 + (1 +j) + (1 j)
3
= 2/3
The angles of the asymptotes are
=
180 +k360
3
107
which gives
k
0 180/3 = 60
o
1 540/3 = 180
o
2 900/3 = 300
o
Step 4: Each branch starts at an open loop pole, and terminates either at an open
loop zero (there are none in this case), or at a zero at innity.
Clearly, one branch starts at the pole at s = 0, and ows along the negative real axis,
winding up at .
All that is required, is to gure out how the remaining two poles get from the two
complex conjugate open loop poles, to the zeros at innity.....
3 2.5 2 1.5 1 0.5 0 0.5 1
2
1.5
1
0.5
0
0.5
1
1.5
2
Real Axis
I
m
a
g
i
n
a
r
y

A
x
i
s
Partial Root Locus for G(s) = 1/s(s
2
+2s+2)
One Closed Loop Pole
moves towards
as K goest to
Open Loop Pole
Closed Loop Pole
for K = 0
One Closed Loop Pole
follows this asymptote
to a zero at infinity
60
o
60
o
11.7 Departure Angles
Continuing with the example, lets gure out what direction the branches start o
in. Consider a test-point s
0
, which is a very small distance, away from the pole at
s = 1 + j4. Suppose that a vector from the pole to s
0
makes an angle of with
respect to the positive real axis. In that case, the argument of G(s
0
) is,
arg(G(s
0
)) = 135
o
90
o
where 135
o
is the contributed by the pole at s = 0, and 90
o
is contributed by the
pole at s = 1 j. Note that these angles will be constant, regardless of , only if the
distance, , between s
0
and the pole at s = 1 +j is very, very small.
108
X
X
X

135
o
90
o
To satisfy the angle condition, we must have
arg(G(s
0
)) = 225
o
= 180
o
Thus, to satisfy the angle condition,
= 45
o
The root locus leaves the pole at s = 1 +j at an angle of 45
o
.
Since complex poles occur in conjugate pairs, the branch which originates at 1 j,
leaves the open loop pole at an angle of +45
o
.
This still leaves a question about how the closed loop poles get from the open loop
poles (after their departure at 45
o
) to the asymptotes.
Consider the line at 45
o
(i.e. along the departure angle) from the pole at s = 1 +j.
Clearly, if we move along this line, the contributions to the argument made by the
poles at s = 0 and s = 1 + j will not change. However, the contribution from the
pole at s = 1 j will decrease. Thus, the phase will be less negative than 180
o
on
this line.
Now consider a test point at + j, for 1 < < 0. At this point, the phase will
be 270
o
(i.e. 90
o
from each of the 3 poles). Since the argument is a continuous
function, it must pass through 180
o
somewhere between the 45
o
line, and +.
Thus, the branch of the root locus must stay above the departure line.
Therefore, the branch which starts at 1 + j does not cross the real axis, but follows
the +60
o
asymptote. Similarly, the branch which starts at 1j terminates along the
300
o
asymptote.
109
2 1.5 1 0.5 0 0.5 1
2
1.5
1
0.5
0
0.5
1
1.5
2
Real Axis
I
m
a
g

A
x
i
s
Root Locus for G(s) = 1/s(s
2
+2s+2)
110
11.8 Example: Breakaway Points
Draw the root locus for the system
G(s) =
1
s(s + 1)(s + 2)
Following the usual plan,
1. Plot the open loop poles and zeros in the complex plane. There are no open loop
zeros, and 3 open loop poles located at s = 0, s = 1 and s = 2.
2. Points on the real axis which are to the left of an odd number of poles and/or
zeros are part of the locus. Thus, the real axis between the poles at s = 0 and
s = 1, and to all points to the left of the pole at s = 2 are on the locus.
3. Zeros at innity. There are 3 zeros at innity (3 open loop poles, no open loop
zeros). The angles of the asymptotes are
=
180 +k360
3
which gives
k
0 180/3 = 60
o
1 540/3 = 180
o
2 900/3 = 300
o
The asymptotes origninate from the point
=

poles

zeros
n m
=
0 + (1) + (2)
3 0
= 1
4. Every branch starts, for K = 0, at an open loop pole, and terminates either at an
open loop zero, or at a zero at innity. The branch starting at the pole at s = 2
is easy. That pole just moves left down the negative half of the real axis. The
poles at s = 0 and s = 1 move towards each other, eventually join, and then
become complex. The two poles eventually wind up following the 60
o
degree
asymptotes.
The question remains: Where do the two traces leave the real axis?
111
3 2.5 2 1.5 1 0.5 0 0.5 1
2
1.5
1
0.5
0
0.5
1
1.5
2
Real Axis
I
m
a
g

A
x
i
s
Root Locus for G(s) = 1/s(s+1)(s+2)
11.9 Finding the Breakaway Point
So far, we have thought of K as a parameter which generates the root locus. We start
with K = 0, and gradually increase K , and plot the resulting closed loop poles.
Turn this idea on its head, and consider how K changes as we move along the root
locus.
Starting from s = 0, and moving to the left (there is no locus to the right of s = 0),
we see that K increases.
Starting from s = 1, and moving to the right, we also see that K increases.
If we stay on the real axis, rather than following the closed loop poles, once we pass
the break away point, K starts decreasing towards 0.
Thus, the breakaway point is a local maximum in K.
So, to nd the breakaway point, we need to think of K as a function of s, dierentiate
it, and set the derivative to 0.
11.9.1 Treating K as a function of s
The problem facing us, is that K is really only dened on the root locus. For points
on the locus, the magnitude condition tells us,
K =
1
[G(s)[
112
Since points on the root locus satisfy the angle condition, G(s) is a negative real number
on the locus. Therefore, on the locus, we can also write
K =
1
G(s)
To be able to dierentiate K, with respect to s, we need to have a function which
is well dened everywhere (or at least almost everywhere) in the complex plane. We
dont care what the function is except when it is on the root locus. One candidate, is
to let
K(s) =
1
G(s)
since this function is equal to the controller gain whenever s is on the root locus, and
the denition is simple, and it exists everywhere except possibly at a nite number of
points (the zeros of G(s)).
So, to nd the breakaway points, we dene the extension of K to the complex plane:
K(s) =
1
G(s)
and then compute K(s)s, and set it to zero. Any zeros in the derivative which lie
on the root locus correspond to breakaway (or perhaps break in) points.
11.9.2 Back to the Example:
Dene the extension of K to the complex plane
K(s) =
1
G(s)
= (s
3
+ 3s
2
+ 2s)
Take the derivative,
K(s)
s
= (3s
2
+ 6s +s)
Set the derivative to zero
(3s
2
+ 6s + 2) = 0
s =
6

36 24
6
= 1

3/3
1.6 or 0.4
113
Notice that the optimization has two solutions, s = 0.4 and s = 1.6. However, only
one of them, s = 0.4 is on the root locus. In fact, if we go back and compute K(s)
for these two solutions, we get
s K
-1.6 -0.38
-0.4 0.38
The root which lies on the locus (s = 0.4) corresponds to a positive value of K, and
is therefore the breakaway point. The other root corresponds to a local extreme in the
extension of K to the complex plane. Since the point isnt on the locus, it is a feature
of the way we chose to extend K onto the complex plane, and can be ignored.
3 2.5 2 1.5 1 0.5 0 0.5 1
2
1.5
1
0.5
0
0.5
1
1.5
2
Real Axis
I
m
a
g

A
x
i
s
Root Locus for G(s) = 1/s(s+1)(s+2)
s = 0.4 is on the root
locus and is therefore
a breakaway point
s = 1.6 is not on the root
locus. Although it is a
local max/min of K(s), it
is not a relevant solution
since K(s) is not positive
While we have this plot handy, what does it tell us about the system?
1. Suppose I apply a step input, and then wait for the transients to die out. What
is the steady-state error?
Ans: The open loop system has one pole at s = 0, therefore the static position
error is 0.
2. Suppose that K = 0.35. Is the system under-damped, critically damped, or
over-dampled.
Ans: To gure this out, we have to see whether or not the dominant poles are real
or complex. For low values of K, all 3 poles are real, whereas for larger values of
K, the dominant poles become complex.
Figure out what value of K corresponds to the breakaway point. Recall that
the breakaway point was at,
s = 1 +

3/3
114
The corresponding value of K is found from
K =
1
G(s)
= (s)(s + 1)(s + 2)
=
_
1 +

3
3
__

3
3
__
1 +

3
3
_
=
2

3
9
0.385
Thus, the breakaway point happens when K = 0.385. Since 0.35 is less than
0.385, all 3 poles will be real, and the system will be overdampled.
3. What value of K will cause the root locus to cross into the right half plane?
Ans: Theoretically, we could gure this out graphically, if we had drawn the plot
with extreme precision. However, it is probably simpler to use the Routh-Hurwitz
test.
The open-loop transfer function is,
G(s) =
K
s(s + 1)(s + 2)
=
K
s
3
+ 3s
2
+ 2s
Thus, the closed-loop transfer function is,
C(s)
R(s)
=
G(s)
1 +G(s)
=
K
s
3
+ 3s
2
+ 2s +K
Test s
3
+ 3s
2
+ 2s +K for left/right half plane roots.
(a) All polynomial coecients must be positive, therefore, K > 0 is necessary
for stability.
(b) Construct the Routh array
s
3
: 1 2
s
2
: 3 K
s :
1
3
(6 K)
1 : K
All entries in the rst column must be positive. Therefore, we must have
0 < K < 6
for stability.
Thus, the root-locus crosses into the right half plane when K = 6.
4. If K = 6, the step response will contain a sinusoidal oscillation. What is its
frequency?
Ans: Solve for the closed loop poles when K = 6. Thus, we need
s
3
+ 3s
2
+ 2s + 6 = 0
115
Which is a cubic. However, we know that the solution is imaginary. Solve for
in,
j
3
3
2
+ 2j + 6 = 0
Since both the real and imaginary parts must be zero, we have
3
2
+ 6 = 0 =

2
Thus, the sinusoidal oscillation ocurrs at =

2 radians per second. Also, we


know that the root locus crosses into the right half plane at =

2.
Table 3: Summary for Sketching a Root Locus
0. a) Write the characteristic equation in the form 1 +KG(s) = 0
b) Factor G(s) into n poles and m zeros 1 +K
Q
m
i=1
(sz
i
)
Q
n
i=1
(sp
i
)
= 0
1. a) Locate the root loci on the real axis Points on the real axis, which lie to the
left of an odd number of poles and/or zeros,
are part of the root locus.
b) Keep in mind the root loci o the real axis will be a mirror image across the real axis
2. a) Find the number of seperate loci The root locus plot has one branch for each
closed loop pole.
b) Find where they start Each branch starts, for K = 0, at the
location of an open loop pole.
c) Find where they end When K , m of the branches terminate at an
open loop zero, and the remaining n m branches
terminate at innity.
3. Plot the n m loci that go to innity (they approach innity along asymptotes)
a) asymptotes centred at =
P
n
i=1
p
i

P
m
i=1
z
i
nm
b) asymptote angles (from real axis) are
180
o
+k360
o
nm
k = 0, 1, . . . , n m1
4. a) Find angle of departure from complex poles

G(s) = 180
o
q360
o
at s = p
i
b) Find angle of arrival at complex zeros

G(s) = 180
o
q360
o
at s = z
i
5. Find the breakaway point(s) on the real axis a) nd K(s) = 1/G(s)
b) nd the maximum(s) by setting
dK(s)
ds
= 0
6. Find where the loci cross the imaginary axis use Routh-Hurwitz criterion
116
12 Control System Design using Root Locus Plots
12.1 Example:
Suppose that we have the following system
G
p
(s) KG
c
(s)
In which the transfer function of the plant is:
G
p
(s) =
1
(s + 1)(s + 2)
The goal is to design the controller, KG
c
(s), so that the closed loop system has a 2% settling
time of 2 seconds, and a peak overshoot of less than 16%.
Step 1: Use the design specications to gure out where the closed-loop poles are going to
go.
t
2%
= 2 sec.
4/
n
= 2

n
= 2
and
M
p
= e
/

1
2
= 0.16
= 0.5
Thus, we have
n
= 4, and the desired closed loop poles are
s
D
= 2 j2

3
Step 2: Draw the root-locus for G
p
(s). If the root locus crosses over the desired poles, then
all we need to do, is to calculate the value of K which produces the desired poles.
117
Root Locus
Real Axis
I
m
a
g

A
x
i
s
3 2.5 2 1.5 1 0.5 0 0.5 1
4
3
2
1
0
1
2
3
4
As we can see, the root locus does not pass over the desired poles. Therefore, there is no
value of K which will produce a system with the desired response. In fact, we cant put the
poles anywhere in the desired region.
Can we add some open loop poles and/or zeros to the system, so that the root locus
passes through the desired poles?
Angle condition to the rescue.....
Compute arg(G(s)) at the desired closed loop pole.
X X
106
o
s
D

1
= 90
o

2
= tan
1
(2

3/(1)) = 106
o
arg(G(s
D
)) = 90
o
106
o
= 196
o
Thus, G(s) contains 16 degrees of extra negative phase (phase lag) at the desired poles.
118
If we can some poles/zeros to the G
c
(s), which provide 16
o
of phase lead at s = s
D
,
then the desired closed loop poles will be on the root locus.
12.2 PD Controller
The simplest approach, is to use a proportional plus derivative controller.
G
c
(s) = K
p
+K
D
s
= K(1 +s
D
)
which provides a single open-loop zero at s = 1/
D
Of course, this is an idealization (since it has more zeros than poles) more on that
later.
We place the controller zero, so that it adds 16
o
of phase at s = s
D
. Thus,
X X O
106
o
s
D
16
o
2

3
x
If we draw the root locus for the compensated system, we would get a circle, centered
on the zero, passing through the desired pole...
To compute the zero location, solve
tan(16
o
) =
2

3
x
x =
2

3
tan(16
o
)
12
Thus, the controller is
G
c
(s) = K(s + 14)
Now, we have to nd K. Use the magnitude condition
K =
1

(s
D
+ 14)
(s
D
+ 1)(s
D
+ 2)

= 1
119
Thus, our controller is G
c
(s) = (s + 14)
What is the static-error performance going to be like? Well, this is a type 0 system,
so it can only track a step input, and the relevant error constant is
K
p
= G(0) = 1
s + 14
(s + 1)(s + 2)
= 7
so the static position error is
1
1 + 7
=
1
8
= 12.5%.
Are the two poles in the system dominant? Well,
a

n
=
14
2
= 7, so the closed loop
poles are almost certainly dominant. From Figure 5.13 in D+P, we can see that = 0.5
and a/
n
= 7 gives an overshoot of about 16%.
12.3 Lead Controller
One problem with the PD controller, is that it doesnt (at least ideally) have a pole. It
is impossible to build a PD controller, at least exactly. It will have at least one pole,
albeit at very high frequencies.
This is a more practical controller design, which includes both a pole and a zero.
KG
c
(s) = K
s + 1/T
s + 1/T
If 0 < < 1, the the pole frequency (1/T) is higher than the zero frequency (1/T).
Thus, the pole-zero plot is,
O X

1
s
D
arg(G
c
(s
D
)) =
1

2
> 0 since

1
>
2
In the example, we need only ensure that
1

2
= 16
o
to achieve the desired design
specs.
Note that we have 2 degrees of freedom, in that we can specify the positions of both
the pole and zero. However, there is only one constraint, namely that
1

2
= 16
o
.
120
12.4 Practical Design of Lead Controllers
In general, it is best to keep (the ratio of the pole and zero frequencies) as close to
1 as possible.
Adding a lead controller reduces the static-error constant of the system.
In our example, we have a type 0 system, so the relevant measure is K
p
,
K
p
= G(0) = K
s + 1/T
s + 1/T
1
(s + 1)(s + 2)
=
K
2
Thus, the smaller is, the worse the steady state tracking error will be.
This is only an approximation, since K will depend (slightly) on both T and .
Try putting the zero at s = 3, so that the zero angle is

1
= tan
1
_
2

3
1
_
= 74
o
Then, the pole angle must be,
2
= 74
o
16
o
= 58
o
. The pole position is then
X X O X
106
o
s
D
58
o
74
o
x
tan(58
o
) =
2

3
x
x = 2.16
Thus, the controller pole is at s = 4.16.
To complete the design, compute K using the magnitude condition.
G
c
(s
D
)G
p
(s
D
) =
s
D
+ 3
s
D
+ 4.16

1
(s
D
+ 1)(s
D
+ 2)
0.0707
Thus, K = 14.14. Notice that = 3/4.16 = 0.72. The nal controller design is
G
c
(s) = 14.14
s + 3
s + 4.16
121
12.5 Pole-Zero Cancellation Solution
The simplest lead controller is obtained by cancelling the open-loop pole at s = 2
with the controller zero. In that case, the controller is
G
c
(s) = K
s + 2
s + 3
To compute the controller gain,
G
c
(s
D
)G
p
(s
D
) =
1
s
D
+ 1
s
D
+ 3 = 0.0769
Thus K = 13, and the controller is
KG
c
(s) = 13
s + 2
s + 3
122
13 Frequency Response Models and Bode Diagrams
So far, the control design methods have been based on Laplace domain transfer funciton
models of the plant and of the controller.
For simple electrical and perhaps mechanical systems, we can derive these models based
on analysis of rst principles.
Parameter values (R, C, L, m, k, b) were assumed to be given, and exactly known.
What happens if we have a widget on the lab bench?
Can we nd the system model experimentally?
This process is called System Identication
Except in very special cases, like the DC motor in the lab. estimating transfer function
and/or state-space models from experimental data is somewhat tricky, and well beyond
the scope of this course (see ENEL 631).
We can estimate the transfer function on the imaginary axis (rather than in the whole
s plane).
13.1 Response of Linear Systems to Sinusoids
Y (s)
G(s)
Asin(t)u(t)
Let the transfer function be:
G(s) =
K(s z
1
) . . . (s z
m
)
(s p
1
) . . . (s p
n
)
The output is,
Y (s) =
A
s
2
+
2
K(s z
1
) . . . (s z
m
)
(s p
1
) . . . (s p
n
)
Do a partial fraction expansion.
Y (s) =
r
0
s +j
+
r

0
s j
+
r
1
s p
1
+. . . +
r
n
s p
n
Consider all but the rst two terms,
r
k
s p
k
r
k
e
p
k
t
1(t)
Provided all of the system poles are in the left half plane (not even on the j axis),
then all of these terms will decay to zero as t .
123
Consider the rst two terms:
r
o
=
AG(s)
s j

s=j
=
AG(j)
2j
The inverse transform of the rst two terms is,
y
ss
(t) =
A
2j
_
G(j)e
jt
G(j)e
jt
_
Write G(j) as magnitude and phase:
G(j) = [G(j)[e
j(G(j))
Then,
y
ss
(t) =
A[G(j)[
2j
_
e
j(t+(G(j)))
e
j(t+(G(j)))
_
= A[G(j)[ sin(t + (G(j)))
Thus, if you wait long enough, you will get a sine-wave,with amplitude A[G(j)[, and
phase (G(j).
To measure the transfer function on the imaginary axis (i.e. the frequency response,
1. Apply a sine-wave input with frequency .
2. Wait for the transients to decay.
3. Compute the gain and phase shift between the input and output signals.
4. Repeat 1-3 at dierent frequencies.
13.2 Bode Diagrams
There is a standard way of displaying frequency response data: The Bode Diagram.
This is denitely a core competency for electrical engineers.
Gain and Phase are plotted against log
10
().
Gain is measured in decibels (dB).
dB measures a ratio, and is dened as
10 log
10
_
Output Power
Input Power
_
Note that we are usually measuring a voltage. Since P = V
2
/R, the decibel becomes
20 log
10
_
Output Voltage
Input Voltage
_
Phase is usually measured in degrees.
Although this may seem a bit arbitrary, all of theses choices have been made to simplify
the plotting and interpretation of Bode diagrams.
124
13.3 Plotting Bode Diagrams of Transfer Functions
Consider the transfer function (in factored form)
G(s) =
K(s z
1
) . . . (s z
m
)
(s p
1
) . . . (s p
n
)
Calculate its magnitude, along the imaginary axis
[G(j)[ =
[K[[j z
1
[ . . . [j z
m
[
[j p
1
[ . . . [j p
n
[
Now, take logs
log
10
([G(j)[) = log
10
([K[) + log
10
([j z
1
[) +. . .
+ log
10
([j z
m
[) log
10
([j p
1
[) . . . log
10
([j p
n
[)
Since the gain is plotted in dB (i.e. we are plotting log gain), we can treat each pole
and zero individually, and then add up the results.
Now calculate the argument of G(j),
(G(j)) = (K) + (j z
1
) +. . .
+ (j z
m
) (j p
1
) . . . (j p
n
)
Similarly, the phase due to each pole and zero can be computed individually, and then
the results added together.
There are a few basic elements which we must be able to deal with.
1. A Gain K in the numerator.
2. A factor of s in the numerator.
3. A factor of s in the denominator.
4. A single, real zero (other than at s = 0).
5. A single, real pole (other than at s = 0).
6. A pair of complex conjugate zeros (not on real axis).
7. A pair of complex conjugate poles (not on real axis).
Once we can deal with each of these factors, we can handle anything!
13.3.1 Bode Plot of A Gain, K
The gain is 20 log
10
([K[).
The phase is 0, for K > 0, and 180
o
(or 180
o
) for K < 0.
125
13.3.2 s in the numerator
Leads to a factor of j in numerator.
Gain: 20 log
10
([j[) = 20 log
10
().
Tabulate a few values.
20 log
10
()
1 0 dB
10 20 dB
100 40 dB
0.1 -20 dB
0.01 - 40 dB
10
2
10
1
10
0
10
1
10
2
40
20
0
20
40
G
a
i
n

i
n

d
B
Bode Diagram for s in numerator
10
2
10
1
10
0
10
1
10
2
0
45
90
135
180
P
h
a
s
e

i
n

D
e
g
r
e
e
s
Frequency in rad/sec
Thus, we have a straight line, with slope 20 dB/decade, passing through the point (1
rad/s, 0 dB).
Phase: (j) = 90
o
.
What happens if we have s
2
in the numerator? Add them up...
13.3.3 s in the denominator
Gain and Phase are negative of what we got for a numerator s factor.
Thus, the gain is a line, passing through (1,0), with slope -20 dB/decade.
The phase is 90
o
.
13.3.4 Real Zero
Consider a normalized zero:
_
s +a
a
_

s=j
=
_
j (a)
a
_
126
The constant a in the denominator can always be corrected for in the nal gain.
The zero location (at a) has been explicitly shown.
Think of j (a) as a vector from
the point a to the point j.
The length of the vector is [j + a[,
and the angle , is the argument of
j +a.
Think about what happens as we
move the test point from = 0 to
= .
|
s

+

j
w
|
j
a


For very small values of ,
Assumption: a.
Phase:
_
j +a
a
_
0.
Gain:

j +a
a

0dB.
The low frequency gain asymptote,
is a horizontal line at 0dB. The low
frequency phase asymptote is a con-
stant at 0 degrees.
For very large values of .
Assumption: a, thus,
(j +a) j
Gain:

j +a
a


a
In dB, we have
20 log
10
_

a
_
= 20 log
10
() 20 log
10
(a)
The second term is a constant, the rst term looks like a numerator s factor.
Thus, high frequency gain asymptote increases at 20 dB per decade (like a nu-
merator factor of s). It through 0dB at = a.
Phase:

_
j +a
a
_

_
j
a
_
= 90
o
127
The high-frequency phase asymptote is 90 degrees.
What happens in the middle, for a? Whip out the ol HP, and crunch a few
numbers.
/a dB
0.01 0.0004 0.6
0.1 0.04 5.7
1 3.01 45
10 20.04 84.3
100 40.0004 89.4
Bode Diagram
Frequency (rad/sec)
P
h
a
s
e

(
d
e
g
)
M
a
g
n
i
t
u
d
e

(
d
B
)
0
10
20
30
40
50
Exact
Asymptotes
10
2
10
1
10
0
10
1
10
2
0
45
90
Exact
Asymptotes
128
13.3.5 Real Pole
Consider a normalized pole:
_
a
s +a
_

s=j
=
_
a
j (a)
_
Clearly, this is the same as a zero, but with the gain and phase multiplied by -1.
Gain:
Low Frequency asymptote, 0dB.
High frequency asymptote, slope -20 dB/decade, passing through the point (a,
0dB).
Gain is -3dB at = a.
Phase:
Low frequency asymptote: 0
o
.
High frequency asymptote: 90
o
Phase is 45
o
at = a.
Bode Diagram for a real pole at s = 1
Frequency (rad/sec)
P
h
a
s
e

(
d
e
g
)
M
a
g
n
i
t
u
d
e

(
d
B
)
50
40
30
20
10
0
10
10
2
10
1
10
0
10
1
10
2
90
45
0
Exact
Asymptotes
13.4 Example:
Draw a Bode diagram for the system:
G(s) =
300s
(s + 1)(s + 30)
129
First, identify the elements.
1. A gain (compute this last).
2. A factor of s in the numerator.
3. A real pole at s = 1,
1
s + 1
4. A real pole at s = 30. Normalize this, so that its gain is 0 dB at low frequency....
30
s + 30
Since we added a factor of 30 to the numerator of one of the poles (to normalize it),
the real gain is,
K =
300
30
= 10.
Thus, the real gain gives us, 20 dB gain, and 0 degrees phase.
The numerator factor of s, give us a gain characteristic with a slope of 20 dB per
decade, passing through 0 dB at = 1. Its phase is +90
o
.
10
2
10
1
10
0
10
1
10
2
10
3
40
20
0
20
40
60
G
a
in

in

d
B
Approximate Bode Plots for Numerator factors
10
2
10
1
10
0
10
1
10
2
10
3
135
90
45
0
45
90
135
P
h
a
s
e

in

d
e
g
r
e
e
s
Frequency (r/s)
K
s
The pole at s = 1, gives us a gain of 0 (approximately) dB from = 0 to = 1
rad/sec , followed by a slope of -20 dB/decade thereafter.
The (normalized) pole at s = 30 gives us a gain of about 0dB for = 0 to = 30
rad/sec, followed by a slope of -20 dB/decade.
130
10
2
10
1
10
0
10
1
10
2
10
3
60
40
20
0
20
G
a
in

in

d
B
Approximate Bode Plots for Denominator factors
1/(s+1)
30/(s+30)
10
2
10
1
10
0
10
1
10
2
10
3
135
90
45
0
45
P
h
a
s
e

in

d
e
g
r
e
e
s
Frequency (r/s)
Adding these up, we have a slope of + 20 dB/decade, passing through 20 dB at 1
rad/sec (gain + numerator). Both poles are still providing 0 dB gain.
starting at = 1, the slope becomes 0, since the pole at s = 1 contributes 20
dB/decade after this.
starting at = 30, the slope becomes 20dB/decade, since the pole at s = 30
becomes active.
If you want to be more precise, put in the 3 dB points, and draw a smooth curve,
starting at 0.1 r/s (i.e. 1 / 10), and nishing at 300 r/s (10 * 30).
Now for the phase. The numerator contributes 90 at all frequencies.
The pole at s = 1 contributes 0 at low frequencies, until 0.1r/s, and 90
o
for
> 10r/s. Joint these with a straight line (so 45
o
at 1r/s).
The pole at s = 30 contributes 0 at low frequencies, until 3r/s, and 90
o
for >
300r/s. Joint these with a straight line (so 45
o
at 30r/s).
Add up the characteristics.
The complete bode diagram is
131
10
2
10
1
10
0
10
1
10
2
10
3
60
40
20
0
20
40
60
G
a
in

in

d
B
Approximate Bode Plot for G(s) = 300s/(s
2
+ 31s + 30)
10
2
10
1
10
0
10
1
10
2
10
3
135
90
45
0
45
90
135
P
h
a
s
e

in

d
e
g
r
e
e
s
Frequency (r/s)
G(s)
elements
To be more precise, we could use the Matlab commands:
>>Gs = tf([300 0],[1 31 30])
>>bode(Gs)
Here is a comparison of the bode plot generated by Matlab, and the hand drawn
approximation.
Bode Diagram
Frequency (rad/sec)
P
h
a
s
e

(
d
e
g
)
M
a
g
n
it
u
d
e

(
d
B
)
20
10
0
10
20
10
2
10
1
10
0
10
1
10
2
10
3
135
90
45
0
45
90
135
Exact
Approximation
13.5 Bode Diagrams for Second-Order poles and zeros
.
The last building blocks on out list, are pairs of complex conjugate poles and/or zeros.
I will deal with complex poles explicitly. By now, you should be able to gure out how
to deal with zeros.
132
Normalized form:
G(s) =

2
n
s
2
+ 2
n
s +
2
n
for
n
> 0 and 0 < < 1.
p =
n
j
n
_
1
2
Note that for > 1, the poles will both be real. For < 0 both poles will be in the
right half plane, and hence unstable.
If we plot the plot the poles in the complex plane, we see that:
x
x

j
p
2
p
1

The poles lie on a circle of radius


[p[ =
n
_

2
+ 1
2
=
n
The angle between the poles and the
negative real axis is
= tan
1
_
_
1
2

_
13.5.1 Low Frequency Behaviour
The transfer function can be written:
G(j) =

2
n

2
+ 2j
n
+
2
n
=
1
1
_

n
_
2
+j2
_

n
_
In the low frequency case, let
n
. Then /
n
0, and
G(j) G
LF
(j) =
1
1 0 +j0
= 1
Thus, at low frequencies, we have 0dB gain and 0
o
phase.
13.5.2 High Frequency Behaviour
In the high frequency limit,
n
. Thus
_

n
_
2

n
_
1
133
Hence, the high frequency asymptote will be
G(j) G
HF
(j

) =
1
_

n
_
2
This is a negative real number, so the phase is 180
o
(or +180
o
, or radians, or...).
What does the gain asymptote do?
[G
HF
(j
n
)[ = 1/1 = 0dB
[G
HF
(j10
n
)[ = 1/(10
2
) = 40dB
[G
HF
(j100
n
)[ = 1/(100
2
) = 80dB
so, the slope is -40 dB/decade, and the asymptote passes through 0dB at =
n
.
Thus, the asymptotes look just like they do for a pair of real poles located at s =
n
.
10
2
10
1
10
0
10
1
10
2
80
60
40
20
0
20
Bode Diagram: Asymptotes for SecondOrder Poles
G
a
i
n
:

d
B
10
2
10
1
10
0
10
1
10
2
150
100
50
0
P
h
a
s
e
:

d
e
g
r
e
e
s
Frequency /
n
13.5.3 What happens near =
n
?
First, compute the gain and phase for =
n
.
G(j
n
) =
1
1 1 + 2j
=
j
2
[G(j
n
)[ =
1
2
arg(G(j
m
)) = 90
o
134
Consider the s-plane picture, for the case 1
x
x

j
j
Magnitude is (1 over) the product of
the lengths of the two vectors.
Phase is (negative the) sum of the
two angles from the poles to the test
point on the imaginary axis.
The situation isnt radically dierent
from having two poles on the real
axis.
Consider the s-plane picture, for the case 0
x
x

j
j
Now, as the test point moves along
the imaginary axis, it passes very
close to one of the poles.
Magnitude is (1 over) the product of
the lengths of the two vectors. One
of these will become very small, as
the test point passes by the pole.
The phase contributed by the pole in
the lower left quadrant will be about
90
o
for all positive frequencies, .
The phase contributed by the pole in the upper left quadrant will change from
+90
o
(giving a total of 0
o
) for 0, to 90
o
(for a total of 180
o
) when
n
.
The closer the pole is to the imaginary axis, the faster this transition will happen.
The eect of on the shapes of the magnitude and phase plots is shown in the next
gure:
135
13.5.4 Recipe for dealing with complex poles
1. Normalize,
G(s) =

2
n
s
2
+ 2
n
s +
2
n
2. Plot low frequency asymptote,0 < <
n
/10.
gain: 0dB
phase: 0
o
phase
3. Plot high frequency asymptote,
gain: -40 dB/decade, passing through 0dB at =
n
,
phase: -180 degrees.
4. Compute , and ll in the appropriate trace for the behaviour near =
n
.
136
13.6 Steady State Error Behaviour
If we are going to be able to base controller design tools on Bode diagrams, it would be nice
to be able to get some information about the steady state error behaviour from them.
13.6.1 Review of Static Error Constants
Recall, that a system with exactly n poles at s = 0, was called a Type n system.
A Type n system can be written in the form,
G(s) =
K
s
n
(1 s/z
1
)(1 s/z
2
) . . . (1 s/z
m
)
(1 s/p
1
)(1 s/p
2
) . . . (1 s/p

)
where none of z
1
. . . z
m
or p
1
. . . p

are equal to zero.


The steady state error in response to a unit step input is given by:
e
ssstep
=
1
1 +K
p
where K
p
= lim
s0
G(s)
The steady state error in response to a unit ramp input is given by:
e
ssramp
=
1
K
v
where K
v
= lim
s0
sG(s)
The steady state error in response to a unit parabola input is given by:
e
sspar
=
1
K
a
where K
a
= lim
s0
s
2
G(s)
13.6.2 Type 0 systems and K
p
Suppose you drew the a Bode diagram of a Type-0 system
G(s) = K
(1 s/z
1
)(1 s/z
2
) . . . (1 s/z
m
)
(1 s/p
1
)(1 s/p
2
) . . . (1 s/p
n
)
The rst step, would be to break the system into its normalized poles and zeros. You
would get
A constant gain of K
m zeros at s = z
1
. . . z
m
.
n poles at s = p
1
. . . p
n
.
At low frequencies, all of the normalized poles and zeros would contribute 0 dB of gain,
and 0
o
of phase.
The gain K would contribute 20 log
10
(K) dB of gain, and 0
o
of phase at all frequencies.
137
Thus, at low frequencies, the phase plot will approach 0
o
. and the gain plot will
approach 20 log
10
(K) dB.
If the low frequency phase is 0
o
, and the low frequency gain is at, the Bode diagram
is from a Type-0 system. The low frequency gain is 20 log
10
(K
p
) dB.
10
2
10
1
10
0
10
1
10
2
60
40
20
0
20
Flat Gain of 20 log
10
(Kp) dB
at Low Frequency
Bode Diagram of a Type 0 System
G
a
i
n

(
d
B
)
10
2
10
1
10
0
10
1
10
2
180
135
90
45
0
Low Frequency
Phase of 0
o
P
h
a
s
e

(
d
e
g
r
e
e
s
)
Frequency (rad/s)
13.6.3 Type 1 systems and K
v
Can we do something similar for a Type I system?
Lets draw a Bode diagram for a Type-I system
G(s) =
K
s
(1 s/z
1
)(1 s/z
2
) . . . (1 s/z
m
)
(1 s/p
1
)(1 s/p
2
) . . . (1 s/p
n
)
To make things easier, assume that all of the poles and zeros (other than the one at
s = 0), occur at very high frequencies,
z
1
, z
2
, . . . , z
m
, p
1
, p
2
, . . . , p
n
1
and only draw the low frequency portion of the Bode diagram.
As before, decompose the transfer function into normalized elements,
A gain K
An integrator (aka a pole at s = 0), 1/s,
m zeros at s = z
1
. . . z
m
.
n poles at s = p
1
. . . p
n
.
138
At low frequencies, all of the normalized poles and zeros would contribute 0 dB of gain,
and 0
o
of phase.
The gain K would contribute 20 log
10
(K) dB of gain, and 0
o
of phase at all frequencies.
The integrator will contribute a phase of 90
o
at all frequencies. Its gain plot will be
a straight line with a slope of 20 dB/decade, and will pass through 0 dB of gain at
= 1r/s.
Thus, at low frequencies, the only non-zero contributions will come from the gain, and
the integrator.
The phase will be 90
o
.
The gain will be a straight line with a slope of 20 dB/decade. At = 1, the gain
will be 20 log
10
(K).
Thus, phase at low frequencies tends toward 90
o
, and the gain has a slope of 20
dB/decade, also at low frequencies, then the system is a Type I system.
If the 20 dB/decade slope extends from = 0 all the way to = 1r/s, then, the
value of the gain plot at = 1 will be 20 log
10
(K
v
).
10
2
10
1
10
0
10
1
10
2
40
20
0
20
40
At = 1 r/s, the only nonzero
term in |G(j)| is 20 log
10
(Kv)
Bode Diagram of a Type I System
G
a
i
n

(
d
B
)
10
2
10
1
10
0
10
1
10
2
90
45
0
Low Frequency Phase is
90
o
for a Type I System
P
h
a
s
e

(
d
e
g
r
e
e
s
)
Frequency (rad/s)
G(s)
K
1/s
remaining terms
What if G(s) contains low frequency poles or zeros?
Example:
G(s) =

10(1 +s/0.1)
s
139
First, decompose the system into normalized poles and zeros.
A gain of

10 = 10dB
A pole at s = 0
A normalized zero at s = 0.1
The gain of

10 provides 10 dB of gain, and 0


o
of phase at all frequencies.
The pole provides 90
o
of phase at all frequencies. Its gain characteristic is a straight
line at a slope of 20 dB/decade, passing through 0 dB at = 1r/s.
The zero provides 0 dB of gain at frequencies below 0.1 rad/sec, and then increases at
20 dB/decade after that.
The phase plot for the zero starts at 0
o
, until 0.01 r/s, and then reaches +90
o
for
frequencies above 1 r/s.
Plot the Bode diagram, for all three components.
Now, plot the Bode diagram for just K/s.
10
2
10
1
10
0
10
1
0
10
20
30
40
50
Gain Plot for Type I System
G
a
i
n

(
d
B
)
Frequency (rad/s)
(1, 20 log
10
(Kv))
Low Frequency Gain has
20 dB/decade slope
P
lo
t

f
o
r

K
/
s

o
b
t
a
in
e
d

b
y
e
x
t
e
n
d
in
g

2
0

d
B
/
d
e
c
a
d
e

s
lo
p
e
G(s)
K
1/s
(1 + s/0.1)
K/s
20 log
10
(K
v
) can be read o of the gain plot for K/s, by reading the gain value at
= 1 r/s, as in the case with all high-frequency poles and zeros.
The gain plot for K/s can be obtained by extending the -20/dB portion of the Bode
diagram (i.e. the low frequency gain plot), to higher frequencies.
Thus, to estimate K
v
from the Bode diagram,
140
1. Find the low frequency range, where the gain is a straight line with a slope of
20 dB/decade.
2. Extend this line at least as far as = 1r/s.
3. This line passes through the point (1, 20 log
10
(K
v
)).
13.6.4 Type-2 systems, and K
a
At this point, the pattern should be obvious.
At low frequencies, the gain will have a -40 dB/decade slope, and the phase will be
-180

.
Extend the low frequency line segment as a straight line, and read o the value where
this line crosses = 1. This is K
a
.
141
14 Checking Stability using Bode Diagrams
So far, we have been discussing how steady state errors relate to Bode Diagrams. We
have seen that the static error coecients can be read directly from the Bode plots of
the open loop transfer function.
Of course, this is pointless if the closed-loop system turns out to be unstable.
To analyze stability, we must answer the question: Does the closed-loop system have
any poles in the right half plane?
In other words, are there any solutions to
1 +G(s) = 0
in the right half plane? (Notice that we have absorbed the gain K back into the open
loop transfer function).
So far this is the same analysis that lead to the root locus. However, we want to answer
this question using only the value of G(s) on the j axis.
The challenge, then, is to determine the number of right half plane solutions to
1 +G(s) = 0
using only the information present in G(j, for < < .
14.1 Using G(s) as a mapping
To answer this question, we are going to need to develop a little bit of complex analysis
(which you really should have been taught a proper math course on complex analysis).
The complex variable s denes a plane (which we always call the complex plane,
s = +j.
There is nothing stopping us from dening another complex plane say = +j.
Let G(s) be any rational function of s,
G(s) =
K(s z
1
) . . . (s z
m
)
(s p
1
) . . . (s p
n
)
which will turn out to be the open loop transfer function, when we actually get around
to using these ideas for something that looks like engineering....
If we then specify = G(s), then G becomes a mapping from the s-plane to the
-plane.
142
-plane
j

s-plane
j

G(s)
G(s)

0
s
1
s
0
If G(s), the mapping function, is continuous, then small changes in s, will lead to small
changes in . Thus, continuous lines/curves on the s plane will map onto continuous
traces in the plane.
14.1.1 The image of a contour
Suppose that G(s) = s +a.
-plane
j

s-plane
j

Draw a circle (clockwise) around the point s = a.


What does the image of this circle look like in the plane?
Well, since = G(s) = s + a, we just shift the circle to the right by a, so that it
encircles the origin (also in a clockwise sense).
Clearly, with this simple mapping, we can easily image any contour.
If the contour encloses the zero at s = a, its image encloses the origin (in the same
direction).
143
14.1.2 Mapping a pole
Now, what happens if G(s) = 1/(s +a).
X
-plane
j

s-plane
j

1/R
R
Trace a circle of radius r around the pole (clockwise).
s = a +re
j
: 0 2
s +a = re
j
= G(s)
= 1/(s +a)
= (1/r)e
+j
In other words, when we encircle a pole in the clockwise direction, the image encircles
the origin, but in the opposite direction counter-clockwise.
14.1.3 Back to Complex Mappings and Transfer Functions
If = G(s) maps the complex numbers to the complex numbers, we would need a
4-dimensional white-board to be able to sketch the function...
However, we can still show the correspondence between points in s and points in
= G(s).
In general, mapping these contours is pretty tricky.
However, we can at least gure out the number of encirclements of the origin (which
is all we are going to need anyways).
Suppose the transfer function is
G(s) =
s + 1
s
2
+ 2s + 2
and we draw a contour which encloses the zero (at s = 1), and the two poles (at
s = 1 j).
144
Consider the contour
s = 1 +re
j
: 0 2
which is a circle, centered at the point s = 1, with radius r.
= G(s) for s = 1 +re
j
where : 0 2
=
1 +re
j
+j
(1 +re
j
+ 1 +j)(1 +re
j
+ 1 j)
=
re
j
(re
j
+j)(re
j
j)
: 0 2
If the circle is very small, so that r 0, then the denominator is approximately 1
lim
r0
G(s) =
re
j
1
= re
j
: 0 2
so we get one clockwise encirclement of the origin.
If, the circle is very large, so that r , then
lim
r
G(s) =
re
j
re
j
re
j
=
1
r
e
j
( + +) =
1
r
e
j
: 0 2
and we get one counter-clockwise encirclement of the origin.
Thus, if we travel clockwise around a closed contour, its image will encircle the origin
N times in the clockwise direction, where
N = Z P
where P is the number of poles inside the contour, and Z is the number of zeros inside
the contour.
6 4 2 0 2 4 6
6
4
2
0
2
4
6
Real Axis
I
m
a
g
i
n
a
r
y

A
x
i
s
G(s) = (s+1)/(s
2
+ 2s + 2)
145
14.2 Innite Contours
Consider the transfer function G(s) = 1/(s +a).
Suppose we construct a countour that includes the whole right half plane, but that
does not include the pole at s = a.
For example, try the following contour. Let the radius of the large half circle, R, tend
to , and let the radius of the small half circle (around the pole), 0.
X
j

5
-plane
j

s
0
s
1
s
2
s
3
s
4
s
5
s-plane
Start at s
0
= a +j, which maps to = 1/(s
0
+a) = j/. As 0, j.
Move up the line from s
0
= a +j to s
1
= a +jR. moves up the line from j,
to j/R 0, as R .
Travel around the little bump. [[ = 1/ . However, the argument of moves
from +90
o
, through 0, to 90
o
.
Continue on up the vertical line. Now, the magnitude of reduces to zero.
Travel around the outer contour, which maps to a little bump.
Notice that the contour does not enclose the pole in the s-plane, and that its image
does not enclose the origin in the plane.
What happens if we ip the little bump over, enclosing the pole? The large half-circle
in the plane ips as well, enclosing the origin.
146
X
j

s
0
s
1
s
2
s
3
s
4

5
s-plane
-plane
s
5
14.3 Nyquist Stability
The basic idea is to map a con-
tour which encloses the entire right
half plane in the s-plane, to the
(or G(s)) plane, and then use the
mapped contour to determine how
many closed loop poles lie in the right
half plane.
To map the contour, evaluate G(s)
along the contour, and plot the re-
sulting points in the plane.
R

=

Infinite D Contour Enclosing the Right Half Plane


Real Axis
I
m
a
g
i
n
a
r
y

A
x
i
s
14.4 Drawing the Nyquist Plot
Each time you evaluate G(s), you get a complex number. Plot this as a point in the
-plane.
147
It is usually best to work in polar co-ordinates, in which case, the radius is [G(s)[, the
magnitude of G(s), and the angle is arg(G(s)), the argument (or phase) of G(s).
In general, we are using the frequency response, G(j), for a nite range of positive
frequencies. These can be plotted directly onto the Nyquist plot.
For Example, consider the open-loop transfer function:
G(s) =
1
(s + 1)
3
which has the following Bode Diagram
Bode Diagram
Frequency (rad/sec)
P
h
a
s
e

(
d
e
g
)
M
a
g
n
it
u
d
e

(
d
B
)
100
80
60
40
20
0
10
2
10
1
10
0
10
1
10
2
270
225
180
135
90
45
0
Read of the gain at several easy an-
gles (say 0, -45 , -90, etc), and plot
them in the plane (dont forget to
undo the 20 log
10
in the gain).
For example, when the phase is 45
o
,
the frequency is about 0.27 radians
per second (on the phase plot). From
the gain plot, the gain at = 0.27 is
about -1 dB, or 0.9. Thus, in polar
co-ordinates, you would plot a point
at a radius of 0.9, at an angle of 45
o
.
0.4 0.2 0 0.2 0.4 0.6 0.8 1 1.2
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0.1
0.2
Real Axis
I
m
a
g
i
n
a
r
y

A
x
i
s
= 0
gain = 1
phase = 0
= 0.268
gain = 0.901
phase = 45
= 0.577
gain = 0.650
phase = 90
= 1
gain = 0.354
phase = 135
= 1.73
gain = 0.125
phase = 180
Polar Plot of the G(j) on the Positive Frequency Axis
Now, deal with the curve from +j, to j.
Case 1: The high frequency gain in the Bode plot goes to dB (i.e. 0). In this
case, the system has more poles than zeros. Clearly, [G(Re
j
)[ 0 as R .
Technically, this is a circle of radius zero about the origin. However, when all the
dust settles, we will wind up counting encirclements of -1, so whether or not this
circle encloses the origin is of no concern to us.
148
Case 2: The high frequency gain reaches a nite, non zero gain. This only
happens if the number of poles and zeros is equal. Thus, as R , the phase
of G(Re
j
) must go to zero, for all . Thus, the curve becomes a point on the
positive real axis.
Finally, draw the image of the -ve j axis.
Recall that G(s) = Lg(t), thus,
G(j) =
_

0
g(t)e
jt
dt
=
_

0
g(t) cos(t)dt
_

0
g(t) sin(t)dt
On the negative frequency axis, we have
G(j) =
_

0
g(t) cos(t)dt
_

0
g(t) sin(t)dt
=
_

0
g(t) cos(t)dt +
_

0
g(t) sin(t)dt
Thus, Re(G(j) = Re(G(j), and Im(G(j) = Im(G(j).
Thus, reect the image of the positive frequency axis through the real axis of the
plane.
The complete Nyquist plot is therefore
Nyquist Diagram
Real Axis
I
m
a
g
i
n
a
r
y

A
x
i
s
1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1
0.6
0.4
0.2
0
0.2
0.4
0.6
14.5 Determining Stability Using the Nyquist Plot
If we were to plot the Nyquist diagram for 1+G(s), we would simply shift the Nyquist
plot for G(s) one unit to the right.
Thus, the number of encirclements of the origin in the 1 + G(s) plot is equal to the
number of encirclements of = 1 in the polar plot of G(s).
149
If the Bode plot was determined experimentally by applying sinusoidal inputs in open
loop, then the plant must be open loop stable. G(s) is stable in open loop, then
1 + G(s) has no poles in the right half plane, since the poles of G(s) are the same as
the poles of 1 +G(s) just think about 1 +, and youll see why.
Thus, the number of clockwise encirclements of = 1 is equal to the number of right
half plane zeros of 1 + G(s), and hence the number of closed-loop poles in the right
half plane.
In this example, N = 0 the Nyquist plot does not encircle the point -1.
Thus, the closed-loop system has no right half plane poles, and is therefore stable.
150
14.6 Closed Loop Stability of KG(s)
Now, insert a gain K into the open-loop transfer function, so that the closed-loop
system becomes:

+
R(s) C(s)
KG(s)
To investigate the stability of this system, draw the Nyquist diagram for KG(s).
Notice that
[KG(j)[ = K[G(j)[
arg(KG(j)) = arg(G(j))
Thus, the shape of the Nyquist plot remains the same, it just that its size is scaled by
the gain K
Nyquist Diagram
Real Axis
I
m
a
g
i
n
a
r
y

A
x
i
s
1 0.5 0 0.5 1 1.5 2
1.5
1
0.5
0
0.5
1
1.5
G(s) =
2
(s+1)
3
G(s) =
1
(s+1)
3
151
14.6.1 Gain Margin
Look at the point where the Nyquist diagram crosses the negative real axis, and nd
the corresponding point on the Bode plot.
In other words, let
pc
be the frequency where the phase crosses through 180
o
. Thus,
arg(G(j
pc
)) = 180
o
This is known as the frequency at phase cross-over hence the subscript PC (Nothing
to do with Joe Clark).
Let K
pc
. be the gain at phase cross-over
K
pc
= [G(j
pc
)[
so that K
pc
is the amplitude of the frequency response at the frequency where the
phase crosses through 180
o
.
If we scale the open-loop transfer function by anything larger than 1/K
pc
, the system
will become unstable this will cause the point where the Nyquist plot cuts the negative
real axis to move farther left than -1, hence encircling the point = 1.
This critical gain, K
g
= 1/K
pc
, is called the gain margin. It is the largest gain that
can be added to the closed loop system without making it become unstable. When
we talk about adding gain to a system, this is in a logarithmic sense we are really
multiplying the open loop transfer function by the gain K.
Notice that the gain margin can be read directly o of a Bode Diagram
1. On the phase plot, nd the frequency at which the phase crosses through 180
o
.
This is the phase cross-over frequency
pc
.
2. On the gain plot, read the gain at
pc
. The distance that this point is below 0dB
is K
g
, the gain margin (in dB, of course).
152
Bode Diagram
Frequency (rad/sec)
P
h
a
s
e

(
d
e
g
)
M
a
g
n
i
t
u
d
e

(
d
B
)
100
80
60
40
20
0
Gain Margin = 18 dB
10
2
10
1
10
0
10
1
10
2
270
225
180
135
90
45
0

pc
= 1.73 r/s
14.6.2 Phase Margin
Here is a Nyquist plot of the example
system, with a gain of 2 added to the
forward path. Notice that the system
is still stable.
To this diagram, I have added the
unit circle.
The angle between the point where
the Nyquist plot crosses the unit cir-
cle, and the negative real axis is
called the phase margin.
Nyquist Diagram
Real Axis
I
m
a
g
in
a
r
y

A
x
is
2 1.5 1 0.5 0 0.5 1 1.5 2 2.5
1.5
1
0.5
0
0.5
1
1.5
Phase
Margin
The phase margin represents the maximum phase lag that can be added to the system
without making it unstable in closed loop.
If a phase lag of was added to the system, then the gain would be unity when the
phase crossed through 180
o
, and the system would become unstable.
The phase margin can also be read directly from the Bode diagram.
1. On the gain plot, locate the frequency where the gain crosses through 0 dB (i.e.
a gain of 1). This is the gain cross-over frequency,
gc
2. On the phase plot, measure the phase at the gain cross-over frequency, arg(G(j
gc
)).
153
3. The phase margin is the distance that this point is above 180
o
.
= 180 + arg(G(j
gc
))
Bode Diagram
Frequency (rad/sec)
P
h
a
s
e

(
d
e
g
)
M
a
g
n
i
t
u
d
e

(
d
B
)
100
80
60
40
20
0

gc
= 0.76 r/s
10
2
10
1
10
0
10
1
10
2
270
225
180
135
90
45
0
Phase Margin: 68
o
154
15 Frequency Response Methods for Controller Design
When frequency response methods are used, design criteria are usually given in terms
of the open-loop Bode diagram
30
o
< PM < 60
o
GM 6dB
are common specications, that lead to rather stable systems.
To meet these specications, it is usually necessary for the gain plot to have a slope of
-20 dB/decade at cross-over. It is very dicult to get a reasonable phase margin when
the slope is -40 dB/decade.
For a second-order system, with no zeros, it can be shown that the phase margin is
approximately related to the damping factor of the closed-loop poles by
100
where the phase margin is given in degrees.
Static error constants (give in dB) are used to specify the steady state tracking errors.
The open-loop bandwidth of the system (usually given in terms of the 0 dB cross-over
frequency) eects the time-constants, and hence the speed of the systems response.
(In reality, the speed of the response is determined by the bandwidth of the closed loop
system, but the open loop bandwidth is directly available, so it is often used).
10
1
10
0
10
1
40
30
20
10
0
10
G
a
i
n

(
d
B
)
Gain Margin
6 dB
Kp = 5 dB
Estimating Kp, Gm and Pm from a Bode Diagram
10
1
10
0
10
1
270
180
90
0
Phase Margin
49 degrees
Frequency (r/s)
P
h
a
s
e

(
d
e
g
r
e
e
s
)
155
15.1 Proportional Controllers
We have discussed several performance measures that can be read directly from the
Bode Diagram:
1. Gain and Phase Margins (relative stability).
2. Static Error Constants (tracking errors).
3. Open loop bandwidth.
To improve the steady state error performance, we can always increase the open loop
gain, K.
This, however, reduces both the gain margin and the phase margin.
Clearly, increasing the gain takes up part of the gain margin.
Increasing the gain also tends to increase the cross-over frequency, which usually re-
duces the phase margin.
By increasing the gain cross-over frequency, the open-loop bandwidth is also increased.
This tends to speed up the response of the system.
15.1.1 Example: Using a Proportional Controller
Given the plant:
G(s) =
3
s(s + 1)(s + 3)
Plot the Bode diagram for the uncompensated system
10
2
10
1
10
0
10
1
10
2
120
80
40
0
40
Bode Diagram for Uncompensated Plant
G
a
i
n

(
d
B
)
GM: 12 dB

GC
= 0.77 r/s
K
v
= 0dB
10
2
10
1
10
0
10
1
10
2
270
240
210
180
150
120
90
P
h
a
s
e

(
d
e
g
r
e
e
s
)
Frequency (r/s)
PM: 38
o

PC
= 1.7 r/s
156
Place the plant in a unity negative feedback loop with a proportional controller.
Choose K so that K
v
= 10 dB.
Evaluate the gain and phase margins with this new value of K.
From the Bode diagram, we see that K
v
= 1, PM = 38
o
and GM = 12dB.
To obtain K
v
= 10 dB, we must shift the gain curve up by 10 dB (i.e. choose K =

10).
Plot the Bode diagram of the compensated system, and evaluate the gain and phase
margins.
10
2
10
1
10
0
10
1
10
2
100
60
20
20
Bode Diagram for Plant and Proportional Controller
G
a
i
n

(
d
B
)
GM: 2 dB

GC
= 1.5 r/s
K
v
= 10dB
10
2
10
1
10
0
10
1
10
2
270
240
210
180
150
120
90
P
h
a
s
e

(
d
e
g
r
e
e
s
)
Frequency (r/s)
PM: 6
o

PC
= 1.7 r/s
From the plot, the Gain Margin has been reduced to 2 dB, and the Phase Margin has
shrunk to 6 degrees. The system is just barely stable.
15.2 Lag Controllers
To increase the static error constant, without reducing the gain and phase margins, we
will need to use some sort of compensator.
G
p
(s) G
Lag
(s)
Consider a Lag Network
G
Lag
(s) =
s + 1/T
s + 1/T
=
1 +sT
1 +sT
where > 1.
157
Draw the Bode diagram for this system. It contains
1. A constant gain of Magnitude of 20 log
10
(), Phase of 0
o
at all frequencies
2. A zero at a frequency of 1/T. Magnitude of 0dB for < 1/T, then increasing at
20 dB/decade. Phase is 0 degrees for < 1/10T and +90 degrees for > 10/T.
3. A pole at a frequency of 1/T. Magnitude of 0dB for < 1/T, then a slope of
-20 dB/decade. Phase is 0 degrees for < 1/10T and -90 degrees for > 10/T.
10
2
10
1
10
0
10
1
10
2
0
5
10
G
a
i
n

(
d
B
)
Lag Network, T = 1, = 3.16
~0 dB Gain
from here
10
2
10
1
10
0
10
1
10
2
45
30
15
0
P
h
a
s
e

(
d
e
g
r
e
e
s
)
Frequency (r/s)
approx. 0
o
phase shift
from here
Notice that for > 10/T, the gain of the lag controller is about 0dB, and the phase
is close to 0
o
.
Provided we keep the gain and phase cross-over frequencies above this, the lag controller
will not have an adverse eect on the gain and phase margins.
Thus, to design the lag controller,
Choose to get the required low frequency gain. (Static error constants will
increase by 20 log
10
().
Choose T so that 10/T <
gc
.
It is possible to meet gain and phase margin specications, and static error require-
ments using only a lag controller.
Reduce K until the GM and PM are adequate.
Use a lag controller to get the required static error constant.
However, doing this generally requires dropping the system gain to meet the gain and
phase margins. This has the unfortunate eect of reducing the systems bandwidth,
and hence slowing down the response.
158
15.2.1 Example: Using a Lag Controller
Given the plant:
G(s) =
3
s(s + 1)(s + 3)
use a Lag Controller, and produce a closed-loop system with K
v
10 dB, PM 50
o
,
and GM 6dB.
To accomplish this, rst use a proportional controller to get the required phase margin,
then design a lag compensator to get the required K
v
.
First, look at the Bode diagram for the uncompensated plant. Notice that the phase
margin is 38
o
, and the gain margin is 20dB.
10
2
10
1
10
0
10
1
10
2
120
80
40
0
40
5.3 dB
Finding the gain required for a 50
o
phase margin
G
a
i
n

(
d
B
)
10
2
10
1
10
0
10
1
10
2
270
240
210
180
150
120
90
50
o
New Gain Crossover Frequency
P
h
a
s
e

(
d
e
g
r
e
e
s
)
Frequency (r/s)
To get a 50 degree phase margin, we will have to move the gain cross-over frequency
to the frequency at which the phase crosses through -130 degrees. From the Bode
diagram, this appears to be about = 0.5r/s
At = 0.5r/s, the gain is about 5 dB. Thus, to get the required phase margin, we
must set K = 5.3dB = 0.54
To get K
v
= 10dB, we need to apply a total gain of 10 dB at low frequencies. Thus,
= 15.3dB = 5.8 will be required.
Place the zero of the lag compensator at about
GC
/10. The idea is to use the highest
possible frequency, that is still far enough below the phase cross-over that the lag
controller wont aect the phase margin. Thus
T = 10/
GC
= 10/0.5 = 20
159
so that the controller is
G
c
(s) = K
1 +sT
1 +sT
= 3.1
1 + 20s
1 + 112s
Now, lets evaluate the controller
10
4
10
3
10
2
10
1
10
0
10
1
10
2
120
80
40
0
40
80
Bode Diagram for Lag Compensated Plant
G
a
i
n

(
d
B
)
GM: 17 dB

GC
= 0.5 r/s
K
v
= 10dB
10
4
10
3
10
2
10
1
10
0
10
1
10
2
270
240
210
180
150
120
90
P
h
a
s
e

(
d
e
g
r
e
e
s
)
Frequency (r/s)
PM: 49.7
o

PC
= 1.7 r/s
We see that the phase margin is 49.7 degrees, rather than the 50 that we designed for.
This is probably due to some small negative phase provided by the lag controller (since
it isnt exactly zero at 1 decade above the zero frequency). In addition, some errors
get introduced by rounding, and from eyeballing values o of the Bode diagrams. We
should have added a small positive phase to the desired phase shift, (say 5 - 10 degrees)
as a safety margin.
15.3 Lead Controllers
A lead controller
G
c
(s) =
1

s + 1/
s + 1/
=
1 +s
1 +s
with 0 < < 1, can be used to increase the gain and phase margins, while simultane-
ously increasing the open loop bandwidth.
Consider the Bode diagram of a lead controller.
The DC gain is 0 dB.
A zero at 1/
160
A pole at 1/.
10
2
10
1
10
0
10
1
10
2
0
10
20
G
a
i
n

(
d
B
)
Lead Controller = 0.333, T = 1
Gain at Max. Phase Lead
4.77 dB
10
2
10
1
10
0
10
1
10
2
0
15
30
45
P
h
a
s
e

(
d
e
g
r
e
e
s
)
Frequency (r/s)
Maximum Phase Lead

m
= 30
o
The maximum phase lead occurs at the frequency:

m
=
1

T
The maximum phase lead is given by:
sin(
m
) =
1
1 +
The corresponding gain is
[G
Lag
(
m
)[ =
1

15.3.1 Example: Lead Compensation


Let the plant transfer function be:
G
p
(s) =
10
s(s + 1)
Design a controller which meets the following specications
1. K
v
= 26sec
1
2. PM = 50
o
161
3. GM 10dB
Draw a Bode diagram for the system
10
0
10
1
20
0
20
40
G
a
i
n

(
d
B
)
Plant Gp(s) = 10/(s
2
+ s)
Gain Margin
(at = )
Kv = 20 dB
10
0
10
1
180
135
90
P
h
a
s
e

(
d
e
g
r
e
e
s
)
Frequency (r/s)
Phase Margin
18.0
o
In this case, PM 18
o
.
GM = , since there are only two extra poles.
Use a proportional controller to get the required Kv.
To get K
v
= 20, we need K = 2 (i.e. 6dB).
However, this reduces the phase margin to PM 13
o
.
10
0
10
1
20
0
20
40
G
a
i
n

(
d
B
)
Plant + Gain KGp(s) = 20/(s
2
+ s)
Gain Margin
(at = )
Kv = 26 dB
10
0
10
1
180
135
90
P
h
a
s
e

(
d
e
g
r
e
e
s
)
Frequency (r/s)
Phase Margin
13.0
o
162
We need an additional 37
o
(i.e. 50-13) of phase lead to meet our PM.
Initial Lead Controller
First, lets try a slightly naive solution...
Choose so that
m
= 37
o
. Thus,
1
1 +
= sin(37
o
) = 0.6018
= 0.2486
Put the maximum phase lead at the gain cross-over frequency, to maximize the phase
margin, Thus,
m
= 4.41r/s.
1

T
= 4.41
1
T
= 2.2r/s
Thus, the compensator is
G
c
(s) =
2

s + 2.2
s + 8.8
0.5
s + 2.2
s + 8.8
Note that the factor of 2 is the initial gain from the proportional controller.
add this compensator to the bode diagram, and evaluate the phase margin.
10
0
10
1
10
2
20
0
20
40
G
a
i
n

(
d
B
)
Plant + Lead Controller = 0.2486, T = 0.4548
Plant
Compensator
Combined
10
0
10
1
10
2
180
90
0
90
P
h
a
s
e

(
d
e
g
r
e
e
s
)
Frequency (r/s)
Phase Margin
41.0
o
The phase margin is only 41
o
. What went wrong?
Notice that the gain cross-over frequency is now 7.3 r/s, rather than 4.4 r/s.
The maximum phase lead in the controller is happening at 4.4 r/s.
163
A Better Approach
Adding the lead compensator increases the gain cross-over frequency.
Since the phase decreases with increasing frequency, this osets some of the phase lead.
Furthermore, moving the gain cross-over frequency meant that the maximum phase
advance happened below the gain cross-over.
To x these problems we need a more sophisticated strategy.
1. Add about 5
o
to the required phase lead. In this example,
m
= 37 + 5 = 42
o
.
2. Compute the corresponding value of (0.1982 in this example).
3. Compute the controller gain at maximum phase lead.
[G
c
(
m
)[ = 1/

= 2.2462 = 7dB
4. Find the new gain cross-over frequency. This is the frequency where the gain of
the plant is equal to [G
c
(
m
)[ (7 dB in this case, so
m
= 6.66r/s).
5. Choose T so that the maximum phase lead occurs at this new cross-over frequency.
1
T

= 6.66 (1/T) = 2.97r/s


Using this approach, the controller becomes
G
c
(s) = 10.09
s + 2.97
s + 14.97
10
0
10
1
10
2
20
0
20
40
G
a
i
n

(
d
B
)
Plant + Lead Controller = 0.1982, T = 0.3370
Plant
Compensator
Combined
10
0
10
1
10
2
180
90
0
90
P
h
a
s
e

(
d
e
g
r
e
e
s
)
Frequency (r/s)
Phase Margin
50.5
o
The maximum phase lead now occurs at the new gain crossover frequency.
164
16 State Space Models
Lets concentrate on a type of system that we have got lots of experience with a
circuit.
Chapter 2 contains a discussion of the relationship between various physical systems,
and equivalent electrical elements.
Thus, the principals shown here can be used in lots of dierent applications.
We will be discussing what is called a state variable model, or a state-space de-
scription of a system (electric circuit in this case).
16.1 RC Ladder Example
Consider the second-order RC ladder network.
i
2
(t) i
1
(t)
R
1
R
2
C
2
C
1
v
in
(t)
Let q
1
(t) and q
2
(t) be the charges on the two capacitors.
This and the input, v
in
(t), is all the information necessary to solve the circuit.
For example, the voltages on the two capacitors, call them v
1
(t) and v
2
(t) are simply,
v
1
(t) = q
1
(t)/C
1
v
2
(t) = q
2
(t)/C
2
The two loop currents, i
1
(t) and i
2
(t), shown in the gure, are given by
i
1
(t) =
1
R
1
(v
in
(t) v
1
(t))
=
1
R
1
C
1
q
1
(t) +
1
R
1
v
in
(t)
and
i
2
(t) =
1
R
2
(v
1
(t) v
2
(t))
=
1
R
2
C
1
q
1
(t)
1
R
2
C
2
q
2
(t)
In other words, we own the circuit all your bases are belong to us.
165
16.2 The Concept of State
In the RC ladder example, the two charges are an example of the state of the sys-
tem. Together with any external inputs, the state is all the information necessary to
completely describe the systems behaviour.
It is customary to group the state variables into a vector, called the state vector.
x(t) =
_
q
1
(t)
q
2
(t)
_
One of the things that we can gure out from the input and state vector, is the time
derivative of the state vector.
x(t) =
dx(t)
dt
=
_
q
1
(t)
q
2
(t)
_
In the example, the state derivative are the currents owing into the two capacitors.
q
1
(t) = i
1
(t) i
2
(t)
=
1
R
1
v
in
(t)
1
R
1
C
1
q
1
(t)
1
R
2
C
1
q
1
(t) +
1
R
2
C
2
q
2
(t)
=
(R
1
+R
2
)
R
1
R
2
C
1
q
1
(t) +
1
R
2
C
2
q
2
(t) +
1
R
1
v
in
(t)
and
q
2
(t) = i
2
(t)
=
1
R
2
C
1
q
1
(t)
1
R
2
C
2
q
2
(t)
Customarily, these are written as a matrix equation,
x(t) =
_
(R
1
+R
2
)
R
1
R
2
C
1
1
R
2
C
2
1
R
2
C
1
1
R
2
C
2
_
x(t) +
_
1
R
1
0
_
v
in
(t)
= Ax(t) +Bv
in
(t)
Notice, that we have a rst-order (matrix) matrix equation for the state (vector). In
principle, we could solve this, and then know the state for all time.
For example, we could choose a very short time-step, t, and use
x(t +t) = x(t) + t x(t)
= x(t) + tAx(t) + tBv
in
(t)
over and over and over to compute the state vector as a function of time.
166
In practise, there are much more ecient and accurate methods for doing numerical
integration, but you get the idea.
If we can compute the state for all t, then, we can compute anything about the system
for all t. So, this rst-order dierential equation is a mathematical model of the system.
So far, we havent really mentioned the output. Suppose that v
2
(t) is the system
output. Then, we can write a matrix equation
v
2
(t) =
1
C
2
q
2
(t)
=
_
0
1
C
2

x(t)
= Cx(t)
16.3 Multiple Outputs
So far, the state-space model seems like a rather complicated way of doing things. You
may be wondering why bother?....
Suppose, instead, that i
1
(t) is the system output. Then, we could write,
i
1
(t) =
1
R
1
C
1
q
1
(t) +
1
R
1
v
in
(t)
=
_
1
R
1
C
1
0

x(t) +
_
1
R
1

v
in
(t)
= Cx(t) +Dv
in
(t)
Notice that all we did, was gure out how to compute the new output from the state
and input. We didnt have to change the state equation at all.
OK, now suppose that the system has 2 outputs, v
2
(t) and i
1
(t). Then, we could dene
an output vector,
y(t) =
_
v
2
(t)
i
1
(t)
_
=
_
0
1
C
2
1
R
1
C
1
0
_
x(t) +
_
0
1
R
1
_
v
in
(t)
We can still write the system output (now a 2 1 vector) as,
y(t) = Cx(t) +Dv
in
(t)
its just that C and D now have 1 row per output.
167
16.4 RLC Example
Construct a state variable model of this RLC circuit, driven by a voltage source (r(t)).
Let y(t), the voltage between the resistor and capacitor, be the output.
C
R L
y(t)
r(t)
First of all, we must choose a state vector. The two energy storing elements are the
inductor and the capacitor.
We already know that the charge on the capacitor works well as a state variable (total
stored energy is q
2
/2C)
The energy stored in an inductor is Li
2
/2. So, why not use the inductor current as the
second state variable.
Thus, choose the state vector as
x(t) =
_
q(t)
i(t)
_
since these reect the energy stored in the system.
Next, gure out
dx(t)
dt
in terms of x(t) and r(t).
The rst one is easy,
dq(t)
dt
= i(t)
For the second state derivative, consider the voltage drops around the loop,
r(t) = Ri(t) +L
di(t)
dt
+q(t)/C

di(t)
dt
=
1
LC
q(t)
R
L
i(t) +
1
L
r(t)
Thus, the state equation is,
dx(t)
dt
=
_
0 1
1
LC
R
L
_
x(t) +
_
0
1
L
_
r(t)
The output is
y(t) = u(t) Ri(t)
=
_
0 R

x(t) +
_
1

r(t)
168
16.5 Multiple Inputs
Suppose we add an ideal current source to the system.
C
r1(t)
r2(t)
R
y(t)
L
What changes? Well, the input is now a 2 element vector,...
r(t) =
_
r
1
(t)
r
2
(t)
_
What about the state equations? Well,
di
L
dt
is still computed from the voltage drops
around the (left) loop. So the equation remains the same.
How about
dq
C
dt
? In this case, we must add the current owing out of the source r
2
(t).
Thus, the state equation becomes.
dx(t)
dt
=
_
0 1
1
LC
R
L
_
x(t) +
_
0 1
1
L
0
_
r(t)
For completeness, we should also change the output equation (although, in this case,
the additional input does not have a direct eect on the output, all of the extra
matrix entries will be 0).
y(t) = r
1
(t) Ri(t)
=
_
0 R

x(t) +
_
1 0

r(t)
Note, in a multiple input system, B and D have one column per input. The form of the
equations, and the A matrix, is exactly the same, regardless of the number of inputs
or outputs.
This is much dierent than a IRF or transfer function based model, where the system
would need one single-input single-output model for each combination of input and
output.
169
16.6 State Space Models of Mechanical Systems
The basic building block in a mechanical system was the point mass, which obeyed
Newton II,
m x =

applied forces
where forces could be external forces, or due to springs (f = kx) or dampers (f =
b x).
Consider a simple mass-spring-dashpot system:
m
y(t)
f
e
(t)
m
y(t)
k b
f
e
(t)
ky(t) b y(t)
which has the equation of motion
m y(t) = f
e
(t) b y(t) ky(t)
To describe the motion of any particular mass requires solving a second-order dif-
ferential equation, and hence involves specifying two initial condtions (i.e. y(0) and
y(0).)
Thus, each point mass will require 2 states: its position and its velocity.
Its state vector will be
x(t) =
_
y(t)
y(t)
_
which leads to the state equation
dx(t)
dt
=
_
0 1
k
m
b
m
_
x(t) +
_
0
1
m
_
f
e
(t)
The upper row comes from the fact that x(t) = x(t).
The lower row is obtained by dividing both sides of the equation of motion by m.
170
16.6.1 Example: The car suspension (revisited)
Consider the quarter-car model,
Suspension
Chassis
Axle
Tire
m
1
k
2
y
2
(t)
y
1
(t)
b
2
m
2
u(t)
k
1
In this case, we have two masses, and hence 4 states.
x(t) =
_

_
y
1
(t)
y
2
(t)
y
1
(t)
y
2
(t)
_

_
As before, we draw free-body diagrams for both masses.
First, consider the chassis,
k
2
y
2
(t)
b
2
m
2
y
1
(t)
m
2
k
2
(y
1
(t) y
2
(t)) b
2
( y
1
(t) y
2
(t))
which has the equation of motion
m
2
y
2
(t) = b
2
( y
1
(t) y
2
(t)) +k
2
(y
1
(t) y
2
(t))
Divide both sides by m
2
, to solve for y
2
(t)
y
2
(t) =
b
2
m
2
( y
1
(t) y
2
(t)) +
k
2
m
2
(y
1
(t) y
2
(t))
=
_
k
2
m
2
k
2
m
2
b
2
m
2
b
2
m
2
_
_

_
y
1
(t)
y
2
(t)
y
1
(t)
y
2
(t)
_

_
Similarly, for the axle,
171
m
1
k
2
y
1
(t)
b
2
u(t)
k
1
y
2
(t)
m
1
k
1
(u(t) y
1
(t))
k
2
(y
2
(t) y
1
(t)) b
2
( y
2
(t) y
1
(t))
which has the equation of motion
m
1
y
1
(t) = b
2
( y
2
(t) y
1
(t)) +k
2
(y
2
(t) y
1
(t)) +k
1
(u(t) y
1
(t))
Solving for y
1
(t),
y
1
(t) =
b
2
m
1
( y
2
(t) y
1
(t)) +
k
2
m
1
(y
2
(t) y
1
(t)) +
k
1
m
1
(u(t) y
1
(t))
=
_
k
1
k
2
m
1
k
2
m
1
b
2
m
1
b
2
m
1
_
_

_
y
1
(t)
y
2
(t)
y
1
(t)
y
2
(t)
_

_
+
k
1
m
1
u(t)
Plug all of this in to the state equation
dx(t)
dt
=
_

_
0 0 1 0
0 0 0 1
k
1
k
2
m
1
k
2
m
1
b
2
m
1
b
2
m
1
k
2
m
2
k
2
m
2
b
2
m
2
b
2
m
2
_

_
x(t) +
_

_
0
0
0
k
1
m
1
_

_
u(t)
Lastly, we need to get the output(s) of the system. Generate a model that has the
chassis position and acceleration as outputs:
y(t) =
_
y
2
(t)
y
2
(t)
_
=
_
_
0 1 0 0
k
2
m
2
k
2
m
2
b
2
m
2
b
2
m
2
_
_
x(t) +
_
0
0
_
u(t)
16.7 State Space Models and Transfer Functions
What if we take Laplace transforms on both sides, ignoring initial conditions.
s

X(s) = A

X(s) +BU(s)
Y (s) = C

X(s) +DU(s)
172
Solve the rst equation for the state,
(sI A)

X(s) = BU(s)


X(s) = (sI A)
1
BU(s)
Substitute this into the output equation,
Y (s) = C(sI A)
1
BU(s) +DU(s)
Thus, the transfer function is
Y (s)
U(s)
= C(sI A)
1
B +D
Notice that for a single-input single-output (SISO) system, C has 1 row, B has 1
column, so that C(sI A)
1
B is a scalar function of s. So that you get a single
transfer function.
For a multiple-input multiple-output (MIMO) system, the result will be a matrix where
each entry is a transfer function. The (i, j) entry will be the transfer function from the
jth input to the ith output.
16.7.1 Transfer Function of the RLC example
Last lecture we derived a state space model for the series RLC curcuit,
C
R L
y(t)
r(t)
d
dt
_
q(t)
i(t)
_
=
_
_
0 1
1
LC
R
L
_
_
_
q(t)
i(t)
_
+
_
_
0
1
L
_
_
v
in
(t)
v
out
(t) =
_
1
C
0
_ _
q(t)
i(t)
_
+ [0] v
in
(t)
which we abbreviated as

x(t) = Ax(t) +Bv


in
(t)
v
out
(t) = Cx(t) +Dv
in
(t)
173
To get the transfer function
G(s) = D +C(sI A)
1
B
frist compute (sI A)
sI A =
_
_
s 0
0 s
_
_

_
_
0 1
1
LC
R
L
_
_
=
_
_
s 1
1
LC
s +
R
L
_
_
Now invert it its just a 2 2 matrix:
_
a b
c d
_
1
=
1
ad bc
_
d b
c a
_
To compute, (sI A)
1
, rst tackle the denominator,
= s(s +
R
L
) +
1
LC
= s
2
+
Rs
L
+
1
LC
Thus
(sI A)
1
=
1

_
s +
R
L
1
1
LC
s
_

_
Since is just a number,
G(s) =
1

_
1
C
0
_
_

_
s +
R
L
1
1
LC
s
_

_
_

_
0
1
L
_

_
+ 0
=
1

1
LC
=
1
LC
s
2
+
Rs
L
+
1
LC
=
1
1 +RCs +LCs
2
174
Notice, that we could get the same result (a lot more easily in this case), by setting up
a voltage divider in the frequency domain.
Where do the poles come from? These are the solutions to
= 0
The system poles are completely determined by the A matrix.
In fact, the system poles are the eigenvalues of the A matrix.
16.8 Other Choices of State Vector
The idea behind the state, is that it is the minimum information needed to describe
the system completely.
Look back at the RC ladder example.
Suppose we construct the vector
w(t) =
_
v
2
(t)
i
2
(t)
_
i
1
(t)
R
1
R
2
C
2
C
1
v
in
(t)
i
2
(t)
q
2
(t) q
1
(t)
v
2
(t) v
1
(t)
Could we use w(t) as a state vector?
Notice that we can compute the original state vector from w(t),
q
2
(t) = C
2
v
2
(t) (1)
q
1
(t) = C
1
v
1
(t)
= C
1
(v
2
(t) +R
2
i
2
(t)) (2)
Therefore, we can completely solve the circuit using w(t), so w(t) also contains all of
the information needed to describe the systems behaviour.
175
Can we construct a state-space model of the form:
d w(t)
dt
= A

w(t) +B

v
in
(t)
y(t) = C

w(t) +D

v
in
(t)
First write down matrix equations relating x(t) and w(t)
x(t) =
_
C
1
C
1
R
2
C
2
0
_ _
v
2
(t)
i
2
(t)
_
= T w(t)
and the reverse,
w(t) =
_

_
0
1
C
2
1
R
2
C
1
1
R
2
C
2
_

_
_
_
q
1
(t)
q
2
(t)
_
_
= T
1
x(t)
To get the new state equation, compute
d w(t)
dt
d w(t)
dt
= T
1
dx(t)
dt
= T
1
Ax(t) +Bv
in
(t)
= T
1
AT w(t) +T
1
Bv
in
(t)
Thus,
A

= T
1
AT
B

= T
1
B
Now, express the output equation in terms of w(t)
y(t) = Cx(t) +Dv
in
(t)
= CT w(t) +Dv
in
(t)
Thus,
C

= T
D

= T
1
B
In principle, T could be any n n, invertible matrix, where n is the length of the
state-vector (2 in this example).
Clearly, there is an innite number of choices for the state-vector (corresponding to an
innite number of choices for the invertible transformation matrix T).
176
16.9 From Transfer Function to State Space
16.9.1 Special Case:
Suppose we have this second-order transfer function
Y (s) =
1
s
2
+a
1
s +a
0
R(s)
which corresponds to the ODE
y(t) +a
1
y(t) +a
0
y(t) = r(t)
Is the vector,
x(t) =
_
y(t)
y(t)
_
a valid state vector?
In other words, can we write down an equation for

x(t) in terms of x(t) and r(t)?
The rst equation is easy,
x
1
(t) = y(t) = x
2
(t)
The equation for the second state is,
x
2
(t) = y(t) = a
1
y(t) a
0
y(t) +r(t)
= a
1
x
2
(t) a
0
x
1
(t) +r(t)
Thus, the state equation is

x(t) =
_
0 1
a
0
a
1
_
x(t) +
_
0
1
_
r(t)
Clearly, the output equation is
y(t) =
_
1 0

+
_
0

r(t)
16.9.2 Check: Compute the Transfer Function
Recall that the transfer function is given by:
G(s) = C(sI A
1
B) +D
177
Compute (sI A)
sI A =
_
s 0
0 s
_

_
0 1
a
0
a
1
_
=
_
s 1
a
0
s +a
1
_
Invert sI A
(sI A)
1
=
1
s(s +a
1
) +a
0
_
s +a
1
1
a
0
s
_
Multiply out C(sI A)
1
+D
G(s) =
1
s
2
+a
1
s +a
0
_
1 0

_
s +a
1
1
a
0
s
_ _
0
1
_
+ 0
=
1
s
2
+a
1
s +a
0
_
s +a
1
1

_
0
1
_
=
1
s
2
+a
1
s +a
0
This is what we started with....
In Class Exercise:
Write down a state-space model which is equivalent to the transfer function:
Y (s) =
2
s
4
+ 2s
3
+ 3s
2
+ 2s + 1
R(s)
178
16.9.3 General Case:
How can we deal with a more general case, like
Y (s) =
b
2
s
2
+b
1
s +b
0
s
2
+a
1
s +a
0
R(s)
or, equivalently
y(t) +a
1
y(t) +a
0
y(t) = b
2
r(t) +b
1
r(t) +b
0
r(t)
Separate out the direct transmission (in that it produces an impulse in the impulse
response) term by long division.
G(s) = b
2
+
(b
1
a
1
b
2
)s + (b
0
a
0
b
2
)
s
2
+a
1
s +a
0
= D +C(sI A)
1
B
By inspection, D = b
2
.
The poles of this system are the same as in the special case, above. Since the poles are
generated exclusively by the A matrix, we must have
A =
_
0 1
a
0
a
1
_
Choose the coecients in the B and C matrices to equate the numerators of the two
transfer functions.
Notice that we have 4 unknowns, but only 2 equations. Therefore, we can (more or
less) arbitrarily choose two of the coecients.
For arguments sake, choose
C =
_
1 0

There are a few reasons for this choice....


This is the C that we used in the all pole case
These numbers make the resulting equations easy to solve.
Obviously, we cannot choose
_
0 0

(WHY NOT???).
Now, let
B =
_

1

0
_
and compute C(sI A)
1
B.
179
We have already computed,
(sI A)
1
=
1
s(s +a
1
) +a
0
_
s +a
1
1
a
0
s
_
Thus,
C(sI A)
1
B =
1
s
2
+a
1
s +a
0
_
1 0

_
s + a
1
1
a
0
s
_ _

1

0
_
=
1
(s +a
1
) +
0
But this must be equal to the numerator (after the long division),
(b
1
a
1
b
2
)s + (b
0
a
0
b
2
)
Therefore, equating the transfer function numerators, we have 2 equations in 2 un-
knowns: one for the s coecient, and one for the ones coecient.
s : b
1
a
1
b
2
=
1
1 : b
0
a
0
b
2
=
1
a
1
+
0
Solving for the s

1
= b
1
a
1
b
2

0
= b
0

1
a
1
b
2
a
0
= b
0
a
1
b
1
+a
2
1
b
2
b
2
a
0
Thus, the state-space model is,

x(t) =
_
0 1
a
0
a
1
_
x(t) +
_
b
1
a
1
b
2
b
0
a
1
b
1
+ a
2
1
b
2
b
2
a
0
_
r(t)
y(t) =
_
1 0

x(t) +
_
b
2

r(t)
Notice that the D matrix is equal to b
2
. Thus, the D term is only non-zero when b
2
(the s
2
term in the numerator) is non-zero.
Thus, if D is non-zero, the number of poles and zeros is equal.
Furthermore, if D is non-zero, there is a constant (D = b
2
) in the transfer function.
Inverse Laplace transforming this will produce an impulse (in the impulse response).
This is called a direct feedthrough term.
180
A Lab Policies
A.1 Lab Groups
For labs 1 2 & 3, lab groups should consist of either 2 or 3 students. Lab groups may change
from week to week. Lab 4 is to be done individually.
A.2 Reports
Each lab group (student for lab 4) should turn in one report.
You are not required to write a formal report in a laboratory notebook. Instead your
report should be informal but neat, well-organized, and written in complete, gramatically
correct sentences. Compose your report from laser printer output and/or hand-written
material on ordinary loose-leaf paper.
Make a simple cover page for each report; put all partners names on the cover. Put all
partners names and ID numbers on an inside page of the report. Hand in your report to
the ENEL 441 Lab Assignment box (for whichever section you are in), on the second oor
of the ICT building.
A.3 Due dates
Labs are due one week after the lab period when the experiement was performed.
181
Laboratory Assignment #1
Introduction to Simulinux and
the Matlab Real-Time Workshop
Author: David Westwick
Equipment
Built into the lab station, you should nd,
PC, with Multi-Q data acquisition card.
Oscilloscope,
Function Generator
Digital Multimeter
I/O Panel for the Multi-Q card
On the bench in front of you (or in the little red drawer in the lab station), there should
be
DC motor with brass inertia wheel and angular position encoder, attached to a linear
actuator system.
RCA cable.
8-pin DIN cable
Co-axial T connectors.
Coaxial cables can be found hanging in the rack on the end of the lab bench.
Introduction
In this lab, you will use the Simulinux software to communicate with a Multi-Q board in
the PC. The Multi-Q board includes Analog to Digital (A/D) converters, Digital to Analog
(D/A) converters, and demodulators for quadrature position encoders. In this lab, you will
use the A/D and D/A converters to read electrical signals with the PC, and to send signals
from the PC to the real world. You will us an encoder to measure the position of the shaft
of a DC motor, which you will drive in both open and closed loop.
182
Getting Started
Simulinux runs under RTLinux, which is a Linux operating system built around a Real
Time kernel. If your computer is running ms windows, reboot it, and select rtlinux at the
LILO boot prompt.
Log in. If X doesnt start automatically, type startx at the command prompt. Open
up an xterm. Create a directory for ENEL 441 lab1, and cd to it. At this point, Simulinux
only runs under Matlab 5.3.1, so start Matlab by typing
]$matlab5.3
in the xterm. To initialize Simulinux, type
>>slx setoptions
in your Matlab session. Then start up Simulink
>>simulink
Be sure to power up the oscilloscope, function generator, power supply, multimeter and the
I/O interface, all of which are in the panel to the right of the monitor.
Sine Wave
Quanser Consulting
MultiQPCI DAC
Analog Output
Figure 1: Simulink Block Diagram for Exercise A
Exercise A: Digital to Analog Conversion
In this exercise, you will generate a sine wave in a Simulink model, send it out through a
D/A converter, and observe the result on the oscilloscope.
In the Simulink window, choose File-New-Model.
In the Simulink window, double-click on the sources library and drag a Sine-Wave
block from the resulting window into your model window.
Open the Blockstets & Toolboxes library, which contains several libraries including
one called Quanser Toolbox.
From the Quanser toolbox, open the Quanser Consulting MultiQ-PCI series li-
brary. It is very important that you use this library, since it contains the drivers for
the PCI card that is installed in the computer.
Drag a copy of the Analog Output (Quanser Consulting MultiQ-PCI DAC) block and
put it in your model window.
Connect the two blocks as shown in Figure 1.
183
Figure 2: Screenshot of the Simulation Parameters Dialog Box
Double click on the Sine-Wave block, to bring up its parameters dialog box, and change
its amplitude to 5 and its frequency to 31.4 radians per second (approximately 5 Hz).
Connect a co-axial cable from the output of DAC A (topmost BNC connector in the
centre of the patch panel) to the oscilloscope.
Getting Simulink to communicate with the real-time software requires several parame-
ters to be set correctly.
From the menus on your model window, choose Simulation--External.
Choose Simulation--Parameters from the menus on top of your model window. In
the resulting dialog box:
Select the Solver tab, if it is not active. This should reveal three panels.
In the Simulation time panel (top most), change the Stop time to large number
(say 999).
In the Solver options panel, click on the Type menu, and select Fixed-step.
The lower half of this panel should now display the xed step size options (and
the bottom-most panel should become inactive).
Change the Mode from Auto to Single-tasking.
Set the Fixed step size to 0.01 seconds. This is where you will specify the
sampling rate for the A/D and D/A cards.
Click on Apply, and then OK to close the dialog box.
The next step, is to compile the code that will run your model in real time, and interface
with the Analog to Digital converter that will send signals out to the physical world.
184
Choose Tools---RTW Build to compile the real-time code. The compiler should report
its progress in the Matlab window. If all goes well, the last line should read ****
Download Complete.
Once the real-time code has been compiled, choose Simulation--Connect to Target
to start the system. You should see a sine wave appear on the oscilloscope.
You may get a popup dialog box with a warning message, telling you that no signals
will be saved (which happens to be true for this exercise). You can safely ignore it,
and hit cancel.
The auto-scale feature on the HP scopes is designed for high-frequency signals. It may
have problems locking on to the low frequency signals common in control applications. You
will probably have to set the time-base and triggering levels manually.
Set the time-base to 50.0 ms.division
Set the vertical scale to 2V/division
Make sure that the scope is triggering o of the same channel that you are using for
the sine-wave.
Trigger on a rising edge, and set the level to 0V.
Notice that the display on the scope consists of a staircase, and that the stairs appear to
roll slowly up and down.
In the Sine Wave block change the frequency to 10*pi, and hit Apply. If you get an
error message, stop the real-time code, rebuild it and then restart it.
In your report, explain why the oscilloscope display is a staircase, instead of a perfect
sinusoid, and discuss the origin of the rolling eect. Include a a sketch of the oscilloscope
output in your report.
Exercise B: Analog to Digital Conversion
The objective of this exercise is to read in a signal from the real world, display it on a virtual
scope in the Simulink environment, and import the data into the Matlab work-space so
that it can be analyzed.
Hardware Setup
Connect the output of the function generator to the input to Chn. A of the analog to
digital converter (upper left hand BNC on the patch panel).
Use a T connector to split the coaxial cable, and send the output to the HP scope as
well.
Set the function generator to produce a 5 Hz, 10 Vpp sine wave.
185
Scope
Quanser Consulting
MultiQPCI ADC
Analog Input
Figure 3: Simulink Block Diagram for Exercise B
Make sure that the function generator is set to drive a high-impedance load (such as
the A/D input).
Verify the amplitude and frequency of the sine-wave on the oscilloscope.
Software Setup
Open a new model window.
Set Simulation -- External, and open the Simulation -- Parameters dialog box.
Set the stop time to 1 second, and set the time step to 0.001 sec (a sampling frequency
of 1000 Hz).
Go to the Quanser - Multi-Q PCI series library, and copy an analog input (ADC)
block into your model window.
Open up the sinks library, and copy a scope into your model window.
Connect the ADC and Scope blocks, as shown in Figure 3.
Figure 4: Screenshot of the Signal and Triggering Control Panel
186
Conguring the Scope Block
Next, congure the virtual scope to read the signals in real time, as follows,
Select Tools--External Mode Control Panel from your model window, and click on
Signal and triggering ... button in the resulting dialog box.
Click on the line that says Scope to select it.
Activate the scope by clicking on the the On button located to the right of the window.
Click on the Arm when connect to target button in the lower left corner of the
control panel.
Fig. 4 shows the Signal & Triggering dialog box, after conguration.
Double click on the scope icon, to bring up the virtual scope display window.
Conguring the A/D converter
Double click on the ADC block to bring up its parameters dialog
set the range to 10 (i.e. 10 Volts, which is the maximum range of the ADC).
Note that there is only one board in the computer, and that it is board 0 (the default
setting).
The channels (0,1,2,3) correspond to the BNC connectors on the I/O Panel marked
Chn. A, Chn. B, Chn. C and Chn. D, respectively.
Testing the Virtual Scope
Build the real-time code, and select Connect to Target.
If nothing happens at this point, select Simulation -- Start Real Time Code, at
which point, a sine wave should start to appear in the virtual scope window.
Importing the Scope Output to MATLAB
Choose Tools -- External Mode Options and click on Signals and Triggering.
Make sure that the duration (lower left corner) is set to 1000. (1000 points = 1
second sampled at 1000 Hz).
Click on the the Properties button on the Scope window (second button from the
right), and then on the Data History tab in the resulting dialog box.
Click on the Save to Workspace button.
In the drop-down menu, select Matrix, and choose a name for the scope output (the
default is ScopeData).
187
De-select the button labelled Limit Rows to Last.
Rebuild the model and then run the code. After the simulation stops, click on the
Matlab xterm window, and type
>> who
to get a list of the variables in the Matlab workspace. There should be a variable called
ScopeData (or whatever you decided to name the output of the Scope). This will be a 2
column matrix: the rst column contains the time points, the second column contains the
data. Plot the captured data by typing
>> plot(ScopeData(:,1),ScopeData(:,2))
The plot should show 5 cycles of a sine-wave (1 second of a 5 Hz. sine wave). Zoom in on a
short time range by typing (for example)
>> set(gca,xlim,[0.5 0.7]);
To add a label to the x-axis, type
>> xlabel(Time (sec));
To give to plot a title
>> title(Zoomed in Plot of a Sine Wave);
Finally, add a label to the y-axis
>> ylabel(Amplitude (V));
Hand in a copy of this zoomed in plot with your report.
Printing: THe printer name is lw-305.
Scope
Quanser Consulting
MultiQPCI ENC
Encoder Input
Figure 5: Reading an Encoder Input: Exercise C
Exercise C: Reading an Encoder
In this exercises, you will use an encoder to read the position of the motor shaft. The encoder
output will then be transformed into an analog voltage by an A/D converter. You will set a
software gain so that the A/D converter returns +5 volts per rotation of the motor shaft.
An encoder consists of a transparent ring, with equally spaced radial lines, all around
its circumference. The ring is placed between a LED and photocell. As the ring spins,
the photocell counts the number of dark bars that pass it by, and so calculates the angular
position of the shaft.
This encoder ring has 512 lines, each of which produces 4 equally spaced pulses (it is a
quadrature encoder). Thus, the encoder should count 2048 pulses per revolution.
188
Set up the Simulink model, as shown in Fig 5, using the Encoder input from the
Quanser Multi-Q PCI-series library.
Use the procedures outlined In Exercise B to congure the the scope block so that it
sends its data to the Matlab workspace. Set the stop time to 10 seconds (Simulation
-- Parameters), and set the duration (External Mode Options -- Signals and
Triggering, lower left corner), to 10000 (i.e. 10 seconds times 1000 Hz.).
Build the real-time code.
Connect the 8-pin DIN connector on the motor bracket to the Optical Encoder 1-2
input on the I/O panel.
Start the simulation, and rotate the motor shaft through one complete turn (approxi-
mately).
Wait for the simulation to end, and then look at the scope-output in the Matlab
workspace.
What were the initial and nal values of the encoder output?
Plot the encoder output as a function of time, and hand it in with your report. Record
the initial and nal values of the encoder output.
Note: You probably didnt get exactly 2048 pulses, since the rotation probably wasnt
exactly 360
o
. This is just a quick and dirty check.
Setting the Encoder gain
add a gain block (from the math library) and a D/A converter, from the Multi-Q/PCI
library, as shown in Fig. 6.
Double-click on the D/A converter block, to bring up its properties. Set channel(s)
to 3, which sends the output to Dac. D on the I/O panel, and leave the other settings
at their defaults.
Double click on the gain element, and set it so that the D/A produces 5 volts per
revolution of the shaft.
Include the gain, and its computation, in your report.
Build the real-time code.
Connect the output of the D/A converter to the Digital Multimeter, and set up the
multimeter so that it reads a DC voltage.
Set your code running. Turn the motor shaft counter-clockwise through 3 complete
rotations, and then back.
189
Compare the output on the virtual scope in your Simulink diagram with that of the
multimeter on your lab bench.
Were there any dierences? If so, describe them in your report, and explain why they
might have happened.
Scope
1
Gain
Quanser Consulting
MultiQPCI ENC
Encoder Input
Quanser Consulting
MultiQPCI DAC
Analog Output
Figure 6: Reading an encoder input, and sending the signal out a D/A converter
Exercise D: Driving the Motor in Open Loop
Set up the block diagram shown in Figure 7. The only new element is the step input
block. It can be found in the Sources library.
Set the gain in the gain block so that the encoder reads 5 volts per revolution of the
shaft.
Double click on the step input block, to open its conguration dialog. Set the nal
value to 5. This will produce a 5 volt step in the analog output.
Connect an RCA cable between the Motor A output, and the RCA jack on your motor.
Note that the plastic insulation has been partially stripped from one of the RCA plugs,
so that it can t into the recessed RCA jack on the I/O panel.
Connect a DIN cable between the encoder output on the motor and the Enc. 1-2 input
on the I/O panel.
Step
Input
K
Gain
Quanser Consulting
MultiQPCI ENC
Encoder Input
Angle
Quanser Consulting
MultiQPCI DAC
Analog Output
Figure 7: Driving the motor in open loop
190
Congure the encoder input and analog output blocks as you did in the previous
exercises. Set up the scopes to export data into the Matlab workspace, into variables
called InputData and AngleData.
Set the simulation duration to 5 seconds, at a sampling rate of 100 Hz, and build your
code.
Run your code. After a delay of 1 second (the start time of the step, set in the step
inputs dialog box), the motor should start spinning. Wait until the code stops running
(4 more seconds).
The Matlab workspace should now contain matrices corresponding to the outputs of
the 2 scopes. As before these will have two columns: the rst will be time, the second
will be the variable.
In the Matlab window, type >> subplot(211)
>> plot(InputData(:,1),InputData(:,2))
>> subplot(212)
>> plot(AngleData(:,1),AngleData(:,2))
Give your plot a title, and label the axes. Hand in this plot with your report.
Create a similar plot, that shows the step input and angle output but limit the time
axes of the two windows the show the range between t = 0.8 seconds and t = 1.2
seconds.
Hand in this plot with your report
Exercise E: A Simple Position Controller
Set up the block diagram in Figure 8.
The summing junction is in the Math library. Double click on the summing junction
to change the signs (it defaults to 2 + signs).
Set the gain on the encoder output so that its output reads 5 volts per revolution of
the shaft.
Check your plots from Exercise D. Make sure that applying a positive voltage to the
motor causes the shaft to turn in the positive direction (i.e. so that the output
increases as a time goes on.)
Congure the 3 scopes to export their data to the Matlab workspace into matrices
named InputData, ErrorData and AngleData.
Build and run the code.
191
What happened? How does this compare to the open loop response observed in Exer-
cise D?
Generate a plot that superimposes the input, error and angle signals, by typing the
following
>> clf
>> plot(InputData(:,1),InputData(:,2));
>> hold on
>> plot(ErrorData(:,1),ErrorData(:,2),--);
>> plot(AngleData(:,1),AngleData(:,2),-.);
>> legend(Input,Error,Angle);
Give the plot a title, and label its axes.
Hand in this plot with your report.
Use your plot to answer these questions
1. How long did it take for the error to fall below 0.5 V?
2. How long did it take for the error to fall below 0.25 V?
3. What is the nal value of the error signal?
Step
Reference
K
Gain
Error
Quanser Consulting
MultiQPCI ENC
Encoder Input
Angle
Quanser Consulting
MultiQPCI DAC
Analog Output
Figure 8: A closed loop position controller
192
Laboratory Assignment #2
Measuring the step response of a
DC-motor operating as a position servo.
Author: David Westwick
Equipment
Built into the lab station, you should nd,
PC, with Multi-Q data acquisition card.
Oscilloscope,
On the bench in front of you (or in the little red drawer in the lab station), there should
be
DC motor with encoder.
RCA and DIN cables for the motor and encoder.
coax to banana plug adaptor.
Introduction
In this lab, you will examine the step response of a DC motor operating as a closed loop
position servo.
Pre-Lab Preparation
Go to the ENEL 441 web page, and follow the links to the Lab2 pages. Download the le
called Trise.m. This is a MATLAB m-le that computes the 10/90 rise time of a step
response. Modify this function so that it also computes,
The 5% settling time
The peak time (if any overshoot)
The percentage overshoot (if any).
There are several datasets linked to the webpage, called StepResponse1.mat, StepResponse2.mat,
etc. These each include a matrix called ScopeData, that contains a step response. The analy-
sis of the step responses is presented in gures called StepResponse1.pdf, StepResponse2.pdf,
etc.
Test your function on the simulated step responses, and compare your results to those
printed on the gures.
193
Getting Started
This lab will use Simulinux, and builds upon the experience gained in lab 1. As before, make
sure that you are running RTlinux, and log in, and type startx to start up Gnome.
Open up an x-term, and start matlab5.3. At the Matlab prompt, type
>>slx setoptions
Then start up Simulink. Be sure to power up the black I/O board, and the HP oscilloscope.
Step Motor Position
Motor Input Input Voltage
K
Gain1
2
Gain
Quanser Consulting
MultiQPCI ENC
Encoder Input
Quanser Consulting
MultiQPCI DAC
Analog Output
Figure 9: Simulink block diagram for Exercise A
.
Exercise A Step Response of a Position Servo
In this exercise, you will obtain the step response of a DC position servo.
Open up a new model window in simulink, and set the simulation mode to external.
Set the sample time to a xed step size of 0.001 seconds, and set the simulation mode
to single tasking.
Set up the model as in Figure 9.
Set the encoder gain to -5/2048, so that the encoder reads 5 volts per revolution of the
motor (where the direction that the motor spins when a positive voltage is applied is
dened to be the positive direction).
Set the controller gain (i.e. the gain at the input to the DAC) to 2.
Set the three scopes to send their data to the Matlab workspace.
Set the step amplitude to 0.5 volts.
Connect the motor and encoder wires, then build and run your code.
Generate a plot superimposing the input step, the motor input and the motor position.
Hand in this plot as part of your report.
Answer the following questions in your report
1. Is the system over-damped or under-damped?
194
2. What is the 5% settling time?
3. What is the 10/90 rise time?
4. What is the percentage of overshoot?
Exercise B Testing the Linearity of the Position Servo
Now, you will test the linearity of the position servo, by comparing the responses to step
inputs of several dierent amplitudes.
Obtain the responses to input steps with amplitudes of 0.5, 1, 2 and 5 volts.
If the system is truly linear, the responses should all be scaled versions of each other.
Generate a plot which superimposes the motor positions resulting from the 4 dierent
step inputs. Hand in this plot with your report
Test superposition by dividing each of the motor inputs and motor positions by the
amplitude of the step inputs which generated them. (i.e. for the 0.5 volt step input,
multiply the responses by 2). Generate a plot which superimpose the 4 scaled motor
inputs, and one which superimposes the 4 scaled motor position signals. Hand in these
plots with your report.
Based on these plots, is the system linear?
Exercise C Examining Saturation
One of the most common nonlinearities that control engineers have to deal with is amplier
saturation. This phenomenon was demonstrated in Lab 1, when you tested the encoder
the scope in simulink increased to 15 volts, whereas the D/A output stopped increasing at
the 10 V power supply rail. In this exercise, you will see how this aects a control system.
Attach the HP scope across the power-amplier. Connect the scope ground to any of
the ground connections on the black I/O panel. Connect the scope input to the output
of the op-amp (i.e. the right-most banana plug on the resistor in the feedback path of
Op-Amp A on the I/O panel).
Set the input step to 1 V amplitude, and re-run your code. Compare the trace that
you see on the HP oscilloscope to that on the Motor Input simulink scope. (You may
have to adjust the triggering setup on the HP scope to capture the response).
What is the gain of the Op-Amp circuit?
Set the input step amplitude to 10 V, and re-rerun your code.
Compare the output of the HP and simulink scopes. Aside from the additional gain,
are there any other dierences?
Compute the amplitude of the largest step input which does not cause the amplier
to saturate (or nd it experimentally).
195
Obtain the position output and motor input of the system in response to this Largest
Linear Step input. Superimpose them, together with the step input on a single plot.
Hand in this plot with your report .
Exercise D Changing the Controller Gain
Next, you will change the feed-forward gain in the controller, and observe the eect that it
has on the step response.
Change the controller gain, labelled Gain in Figure 9, to 20.
Calculate the amplitude of the largest step that will not cause saturation with this new
controller gain.
Obtain the step response to this input.
Answer the following questions in your report
1. Is the system over-damped or under-damped?
2. What is the 10/90 rise time?
3. What is the 5% settling time?
4. What is the percentage of overshoot?
Change the controller gain back to 2, and obtain the response to the same step input
(i.e. the largest step that did not cause saturation with the controller gain set to 20).
Generate a plot superimposing the two motor position responses.
Hand in this plot with your report. Discuss any dierences between the two step re-
sponses.
196
Laboratory Assignment #3
Proportional and PI control
of a DC-motor position servo.
Author: David Westwick
Equipment
Built into the lab station, you should nd,
PC, with Multi-Q data acquisition card.
Oscilloscope,
On the bench in front of you (or in the little red drawer in the lab station), there should
be
DC motor with encoder.
RCA and DIN cables for the motor and encoder.
coax to banana plug adapter.
Introduction
In this lab, you will proportional and proportional plus integral controllers to enhance the
step response of a DC motor operating as a closed loop position servo. You will use the tran-
sient analysis Matlab function that you developed in Lab 2 to analyze the step responses.
Getting Started
This lab will use Simulinux, and builds upon the experience gained in labs 1 and 2. As
before, make sure that you are running RTlinux, and log in, and startx.
Open up an x-term, and start matlab5.3. At the Matlab prompt, type
>>slx setoptions
Then start up Simulink. Be sure to power up the black I/O board, and the oscilloscope.
In the last lab, you set up a DC position servo with a proportional controller. Recall, that
friction in the motor caused the system to have a non-zero position tracking error. In this
lab, you will add an integrator to the control loop, which should eliminate the steady state
error, despite the friction. In order to keep the system stable, you will use a proportional
plus integral controller.
197
Step
Saturation
Position
Input
2
Gain2
K
Gain1
Kp
Gain
Error
Quanser Consulting
MultiQPCI ENC
Encoder Input
Controller Output
Quanser Consulting
MultiQPCI DAC
Analog Output
Figure 10: Simulink block diagram for Exercise A
.
Exercise A A Proportional Controller
This exercise is a recap of Lab 2. You will modify your Simulink block diagram so that you
can monitor amplier saturation without using the HP oscilloscope.
Open up a new model window in Simulink, and set the simulation mode to external.
Set the sample time to a xed step size of 0.001 seconds, and set the simulation mode
to single tasking.
Set up the model as in Figure 10.
Note that a gain (in the math library) and a saturation block (in the nonlinear library)
have been added to the Controller Output scope. These will be used to mimic the
gain and saturation in the (physical) power amplier.
Set this new gain to 2 (to mimic the gain of the op-amp).
Determine the maximum output of your power amplier, and set the limits on the
saturation block to this level.
In the simulation parameters dialog, set the stop time to 10 seconds.
When you activate the scopes in the Signals and Triggering control panel, make
sure that the duration is set to 10,000 samples.
Set the encoder gain, (gain 1 in Figure 10), to -5/2048, so that the encoder reads 5
volts per revolution of the motor, with the input and output polarities in the same
direction.
Set the controller gain, Kp, to 20.
Set the four scopes to send their data to the Matlab workspace.
Set the step amplitude to 2.5 volts.
Use the HP scope to measure the output of the power amplier (as you did in lab 2).
Connect the motor and encoder wires, then build and run your code.
198
Compare the output on the HP scope with that of the Controller Output Simulink
scope. If there are any signicant dierences, adjust the gain and/or saturation limits
until they agree.
Use your transient analysis program from Lab 2 to answer the following questions.
(you may have to modify it to compute the steady state error).
1. Is the system over-damped or under-damped?
2. What is the 5% settling time?
3. What is the percentage of overshoot?
4. What is the steady state error?
Generate a plot superimposing the error signal and the controller output. Zoom in on
the last 6 seconds of the error/controller output. Hand in a copy of this plot with your
report. Why doesnt the system reduce the error to 0?
Step
Saturation
Position
Input
2
Gain2
K
Gain1
Kp
Gain
Error
Quanser Consulting
MultiQPCI ENC
Encoder Input
s+4
s
Discretized
Transfer Function
Controller Output
Quanser Consulting
MultiQPCI DAC
Analog Output
Figure 11: Simulink block diagram for Exercise B
.
Exercise B A Proportional plus Integral Controller
In this exercise, you will set up a DC position servo with a proportional plus integral con-
troller, and measure its step response. You will see how the integral action changes the
behaviour of the control system.
Save your model from Exercise A, and then modify it as in Figure 11. Note that the
Discretized Transfer Function block is found in the Quanser Toolbox.
The Discretized Transfer Function will be used to implement a proportional plus
integral (PI) controller. The transfer function of a PI controller can be written as,
G
c
(s) = K
p
+
K
i
s
= K
p
_
s +K
i
/K
p
s
_
= Kp
_
s +a
s
_
199
Initially, we want Kp = 2 and K
i
= 8, so double-click on the Discretized Transfer
Function block and set the numerator polynomial to
[1 4]
and set the denominator polynomial to
[1 0]
Set the controller gain, K
p
to 2.
In the simulation parameters dialog, set the stop time to 20 seconds.
When you activate the scopes in the Signals and Triggering control panel, make
sure that the duration is set to 20,000 samples (i.e. 20 seconds).
Build and run your code.
Generate a plot superimposing the input step, the motor position. Hand in this plot
as part of your report.
Answer the following questions in your report
1. Is the system over-damped or under-damped?
2. What is the 5% settling time?
3. What is the percentage of overshoot?
4. What is the steady state error?
Exercise C Varying the Parameters of a PI controller
In this exercise, you will vary the parameters of the PI controller, and observe their eect
on the transient response of the system.
Set a = 0.25, and K
p
= 1. Obtain the response to a 1V step, and compute the
overshoot, rise time and settling time. Check the controller output, to make sure that
the amplier is not being driven into saturation.
Obtain the overshoot, rise time and settling time for K
p
= 2, 4 and 8. Did the amplier
saturate in any of these cases?
Include a table, showing K
p
, the rise time, settling time and percent overshoot for these
4 step responses.
Set the gain K
p
= 4, and obtain step responses for a = 0.25, 0.5, 1 and 2. Did the
amplier saturate for any of these? Include a table, showing K
p
, the rise time, settling
time and percent overshoot for these 5 step responses.
Using the tables generated above as a starting point, tune the controller so that the
unit step response has
200
Peak Overshoot < 5%.
Rise Time < 0.25 sec.
Steady State error < 0.5%.
No saturation.
Exercise D Saturation and PI controllers.
In this exercise, you will see what happens to a PI controller when the amplier saturates.
The phenomenon is often called integrator windup.
Modify your controller so that K
p
= 20, and a = 3.
Apply a 5 volt step to the system, and record the result.
Superimpose the error signal and the controller output on a single plot.
Zoom in on the rst 3 seconds of the response. Hand in a copy of this plot with your
report.
How long does the controller output remain saturated?
When does the error rst cross through zero?
Why does the controller stay at full positive saturation, even though the error is neg-
ative and decreasing?
201
Laboratory Assignment #4
Drawing Bode Diagrams and Polar Plots
Author: Chris Macnab
Group sizes
Work individually. You do not have to come to the lab but help is available there if you
want it.
What to hand in, where to hand it in
You are required to write a informal report and hand it in to the lab assignment box. The
report will consist of answering the questions outlined in this manual.
Instructions
Read the instructions below and attempt all 3 parts of the lab. You are to attempt the lab
and write the report individually (i.e. by yourself!). You can attempt the lab on your own
time or come into the regularly scheduled lab where the TA or professor can give you any
help you need.
This lab uses MATLAB, and a MATLAB function written for this lab. First create a
directory in your account (on your computer) where you want to put this function. Now
download the function which is called do bode.m from
http://enel.ucalgary.ca/People/Macnab/enel441/lab4/do bode.m
and save it in your new directory. Now run MATLAB from your new directory, since
do bode.m must be in MATLABs working directory.
We will simply be drawing bode diagrams and then getting MATLAB to do it for us
so we can see if our answer was right. MATLAB will also graph the time domain solution
for us. All the necessary MATLAB code is given to you. You will simply change certain
variables in the code as youre told.
To do this lab you will need semi-log graph paper and a ruler. If you dont have your
own semi-log paper, photocopy the last page of this lab manual and do your plots on that.
Labs handed in with graphs that are not on semi-log paper will receive a mark of zero.
Part 1: Frequency response in time domain
Lets look at the open-loop transfer function of a PID control applied to a second order
system
G(s) =
K
I
+K
P
s +K
D
s
2
s(s
2
+as +b)
202
Type the following commands (comments are optional). Type them into a text editor
before cutting and pasting them into MATLAB so that you dont have to retype them every
time.
%define the control gains
kp=3
ki=2
kd=1
%define the plant parameters
a=1
b=10
%create the transfer function
num=[kd kp ki]
den=[1 a b 0]
sys=tf(num,den)
We are going to examine what happens to the output of this transfer function G(s) when
the input is sinusoidal. Lets look at the time domain solution. Since we are applying a
sinusoidal input, we should see a transient response followed by a steady-state oscillation.
%set our variables of interest (you will have to change these)
%frequency in radians per second
w=3; %use values of w=0.01,0.03,0.1,0.3,1,3,10,30
%number of oscillations that will be graphed
ncycles=10; %you may have to change this to see anything
%now calculate and graph the solution
T=2*pi/w;
tmax=ncycles*T;
dt=1/w/10;
t=[0:dt:tmax];
u=sin(w*t);
[y,tout]=lsim(sys,u,t);
clf;
plot(t,u,r--,tout,y,b);
legend(input,output);
xlabel(time (s));
The above code lets you answer questions 1 and 2 (Part 1) for a particular frequency w.
Before you go back and try it for a dierent frequency, try the next piece of code with the
same frequency w which will allow us to get a better look at the steady-state performance.
203
min1=round(T*(ncycles-1)/dt);
max1=round(T*ncycles/dt);
s=size(tout);
dt2=tmax/s(1);
min2=round(T*(ncycles-1)/dt2);
max2=round(T*ncycles/dt2);
plot(t(min1:max1),u(min1:max1),r--,tout(min2:max2),y(min2:max2),b);
legend(input,output);
xlabel(time (s));
grid on;
Now you can answer questions 3,4,5 for a particular frequency. Then you can go back
and repeat all the above code for another frequency (change w) which will let you ll in the
table for Part 1. Note that you may have to change the variable ncycles to get a good look
at the transient performance.
Part 2: Bode Diagrams
We now want to draw a bode diagram. For a particular frequency w you now have a
gain (ratio of amplitudes), gain in dB, and a phase. You will be plotting points on three
graphs, one for magnitude (the gain), one for magnitude in dB (the gain in dB), and one
for phase as a function of frequency (the log of frequency actually). Decide the ranges you
need on your plots and put numbers on the axes. Remember that the frequency axis is
logarithmic (base 10), so that the evenly spaced vertical lines are a factor of 10 apart (e.g.
0.01,0.1,1,10,...). If you dont understand why there are vertical lines not evenly spaced,
whip out your calculator and take a few logarithms to convince yourself why. Now graph
your points and try to connect them with a smooth line (not straight lines).
You have now drawn a Bode diagram. Now lets see if MATLAB agrees with you. Try
the following:
%draw a bode diagram for sys=tf(num,den)
clf;
bode(sys);
grid on;
Notice MATLAB only gives you the magnitude in dB, so there are only 2 plots instead
of three. If your plot does not agree with MATLAB, try it again (you can just leave your
incorrect plots on the graph; no marks will be deducted).
We just plotted bode diagrams the hard way. The easy way is to plot bode diagrams of
individual functions and then add them together. Use the tables and graphs given in the
back of the lab manual to nd the plots of individual functions. This works because both
logarithms and phase angles are added when functions are multiplied. Note that it doesnt
work for gain/magnitude not in dB. First we must factor out any terms multiplying the
204
highest values of s. There arent any in this case. Notice with kd=1,kp=3,ki=2,a=1,b=10
that we can factor the numerator with real coecients (but not the denominator) so the
transfer function looks like:
G(s) =
(s + 1)(s + 2)
s(s
2
+s + 10)
We can now see there are two simple leads (two zeros on the real axis), one integrator
(s in the denominator), and one quadratic lag (one pair of complex poles). Plotting the
Bode Diagram using these functions is what you have to do for Part 2 of this lab. Plot
these individual functions on your Bode diagram (gain in dB and phase as functions of
frequency) with dotted lines. Now plot the summation of all the functions with a solid line.
The next piece of code gets MATLAB to do this for you and you can check your answer.
The MATLAB graph plots the individual function asymptotes with dotted lines, the total
asymptote (summation) with a dashed line, and the real answer with a solid line. You are
only to expected to be able to draw the asymptotes exactly; the total function you can only
estimate.
K=2/10;
num=[1 3 2];
den=[1 1 10 0];
ndiffs=0;
nints=1;
lags=[]; nlags=0;
leads=[1 2]; nleads=2;
qlags=[sqrt(b)]; nqlags=1;
qleads=[]; nqleads=0;
min=0.01;
max=100;
clf;
do_bode(num,den,K,nints,ndiffs,leads,nleads,lags,nlags,qlags,nqlags,qleads,
nqleads,min,max);
%you can turn the grid off to see the asymptotes more clearly
subplot(2,1,1);
grid off;
subplot(2,1,2);
grid off;
Part 3: Drawing a polar plot
Now we want to produce a polar plot (and ultimately what we call a Nyquist diagram) from
the above graphs. Use the data from the table you made in part one. For each frequency
205
you have a phase and magnitude(gain). Plot six points on the complex plane (no semi-log
graph for this), where each point is the tip of a vector with a certain magnitude and phase.
The basic part of a Nyquist diagram consists of a polar plot with its mirror image.
MATLAB will plot it for us and we can check our answer. If you found 6 points was not
enough to get close to the real shape, you can use other points by simply estimating a
magnitude and phase at a certain frequency right o the bode diagram (remember you will
be estimating magnitude in dB so you have to convert it to real units).
clf;
nyquist(sys);
Work to be handed in
You are to hand in the answers to the following questions. Do not hand in any of the
MATLAB work.
Questions for Part 1: Frequency response in the time
domain
For the frequencies w =0.01,0.03,0.1,0.3,1,3,10,30 estimate the following from the graphs and
enter them in a table layed out like the one below:
1. The time and number of oscillations (ncycles) it takes for the transient response to die
out (when the steady state takes over)
2. The frequency of the output (steady-state) in Hz
3. The ratio of the amplitude of the output to the amplitude of the input (the gain)
4. The gain in decibels (calculate this by taking 20 times the base 10 logarithm of the
original gain)
5. The phase measured as the number of degrees the output leads the input.
w time ncycles freq gain gain(dB) phase
0.01
0.03
0.1
0.3
1
3
10
30
206
Questions for Part 2: Bode Diagrams
1. Using the data from the table, plot 3 graphs (8 points plotted on each graph). USE
SEMI-LOG PAPER. The top graph should have gain vs. frequency, the middle gain
in dB vs. frequency, and the bottom phase vs. frequency. Connect your points with a
smooth line on each graph (straight lines not necessary)
2. Lets do it the easy way now. Draw a Bode Diagram (magnitude and phase vs fre-
quency) using the individual functions plots from the original transfer function (not
using the data from the table). USE SEMI-LOG PAPER.
Question for Part 3: Polar Plots
Make a polar plot using the data from the table. This is plotted on the complex plane so
you do not need semi-log paper.
207
Bode plots of basic functions
Constant gain, zeros, and poles.
K (j)
n
1/(j)
n
M(dB) 20 log K n20 log() n20 log()
slope (dB/dec) 0 n20 n20
(deg) 0 n90 n90
10
2
10
1
10
0
10
1
10
2
100
50
0
50
100
G
a
i
n

(
d
B
)
10
2
10
1
10
0
10
1
10
2
100
50
0
50
100
150
200
P
h
a
s
e

(
d
e
g
)
Freq. (rad/s)
Pole on the real axis (simple lag) 1/(j + 1)
<< 1/ >> 1/
M(dB) 10 log(
2

2
+ 1) 0 20 log
slope (dB/dec) 0 20
(deg) tan
1
() 0 90
Zero on the real axis (simple lead) (j + 1).
<< 1/ >> 1/
M(dB) 10 log(
2

2
+ 1) 0 20 log
slope (dB/dec) 0 20
(deg) tan
1
() 0 90
Examples of simple lag and simple lead for 1/ = 2 shown below
10
2
10
1
10
0
10
1
10
2
40
20
0
20
40
G
a
i
n

(
d
B
)
10
2
10
1
10
0
10
1
10
2
100
50
0
50
100
P
h
a
s
e

(
d
e
g
)
Freq. (rad/s)
Complex conjugate poles (quadratic lag) 1/ ((ju)
2
+ 2uj + 1) where u = /
n
u << 1 u >> 1
M(dB) 10 log((1 u
2
)
2
+ 4
2
u
2
) 0 40 log u
slope (dB/dec) 0 40
(deg) tan
1
(2u/(1 u
2
)) 0 180
Quadratic lag with
n
= 1 with examples for = 0.02 and = 2 shown below
10
2
10
1
10
0
10
1
10
2
100
80
60
40
20
0
20
40
G
a
i
n

(
d
B
)
10
2
10
1
10
0
10
1
10
2
200
150
100
50
0
P
h
a
s
e

(
d
e
g
)
Freq. (rad/s)
Magnitude Magnitude (dB) Phase (deg)
F
r
e
q
u
e
n
c
y

(
r
a
d
/
s
)

Вам также может понравиться