Sunteți pe pagina 1din 227

ME 132, Dynamic Systems and Feedback

Class Notes

Andrew Packard, Roberto Horowitz, Kameshwar Poolla, Francesco Borrelli

Spring 2015

Instructors:

Profs. F. Borrelli and R. Horowitz

Department of Mechanical Engineering


University of California
Berkeley CA, 94720-1740

copyright 1995-2015 A. Packard, Horowitz, Poolla, Borrelli


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz i

Contents

1 Introduction 1

1 The Power of Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 The Idea of a Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . 1

3 Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

4 The Structure of Control Systems . . . . . . . . . . . . . . . . . . . . . . . . 3

5 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

6 The Ingredients of Control System Design . . . . . . . . . . . . . . . . . . . 6

7 A General Architecture for Control Systems . . . . . . . . . . . . . . . . . . 8

8 Example: A simple Cruise Control System for a Car . . . . . . . . . . . . . 8

2 Modeling 15

1 The Uses of Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2 Modeling Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3 Models for Use in Control System Design . . . . . . . . . . . . . . . . . . . . 15

4 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

5 First Order Linear Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

5.1 Example: Moving Mass . . . . . . . . . . . . . . . . . . . . . . . . . . 16

5.2 Example: RC Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

6 Second Order Linear Systems . . . . . . . . . . . . . . . . . . . . . . . . . . 18

6.1 Example: Spring-Mass-Damper . . . . . . . . . . . . . . . . . . . . . 18

6.2 Example: RLC Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . 20

7 n-th Order Linear Dynamical Systems . . . . . . . . . . . . . . . . . . . . . 21

7.1 SLODE Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

7.2 State-Space Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz ii

7.3 SLODE to State-Space Models and Viceversa . . . . . . . . . . . . . 22

7.4 The Concept of State . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

8 Nonlinear Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

8.1 Example: Magnetically Suspended Ball . . . . . . . . . . . . . . . . . 23

8.2 Example: Water Tank . . . . . . . . . . . . . . . . . . . . . . . . . . 25

8.3 Example: Pendulum . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

9 Nonlinear Dynamical Systems in State Space Form . . . . . . . . . . . . . . 26

10 Properties of Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

11 Models in Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

11.1 Composing integrators . . . . . . . . . . . . . . . . . . . . . . . . . . 28

11.2 State Space Linear Models . . . . . . . . . . . . . . . . . . . . . . . . 29

12 Additional Example: DC motor . . . . . . . . . . . . . . . . . . . . . . . . . 30

3 First Order, Linear, Time-Invariant (LTI) ODE 34

1 The Big Picture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

2 Solution of a First Order LTI ODE . . . . . . . . . . . . . . . . . . . . . . . 35

3 The Free Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

4 The Step Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

4.1 Linearity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

5 The Sinusoidal Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

6 The Frequency Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

7 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

4 Review of SLODEs 53

1 Linear, Time-Invariant Dierential Equations . . . . . . . . . . . . . . . . . 53

2 Importance of Linearity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz iii

3 Solving Homogeneous Equation . . . . . . . . . . . . . . . . . . . . . . . . . 54

3.1 Interpretation of complex roots to ODEs with real-coecients . . . . 56

4 General Solution Technique . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

5 Behavior of Homogeneous Solutions as t . . . . . . . . . . . . . . . . . 58

6 Response of stable system to constant input (Steady-State Gain) . . . . . 60

7 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

8 Stability Conditions for 2nd order dierential equation . . . . . . . . . . . . 62

9 Important 2nd order example . . . . . . . . . . . . . . . . . . . . . . . . . . 64

10 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

1 Main Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

2 General Solution Technique . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

3 Behavior of Homogeneous Solutions as t . . . . . . . . . . . . . . . . . 78

4 Stability of Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

5 2nd order dierential equation . . . . . . . . . . . . . . . . . . . . . . . . . . 79

6 Solutions of 2nd order dierential equation . . . . . . . . . . . . . . . . . . . 79

5 Derivatives on the inputs: Eect on the forced response 81

1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

2 Other Particular Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

3 Limits approaching steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

4 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

6 Distributions 87

1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

2 Procedure to get step response . . . . . . . . . . . . . . . . . . . . . . . . . . 89

3 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz iv

7 Frequency Responses of Linear Systems 97

1 Complex and Real Particular Solutions . . . . . . . . . . . . . . . . . . . . . 98

2 Response due to real sinusoidal inputs . . . . . . . . . . . . . . . . . . . . . 99

3 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

8 Bode Plots 103

1 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

9 Transfer functions 106

1 Linear Dierential Operators (LDOs) . . . . . . . . . . . . . . . . . . . . . . 106

2 Algebra of Linear dierential operations . . . . . . . . . . . . . . . . . . . . 108

3 Feedback Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

4 More General Feedback Connection . . . . . . . . . . . . . . . . . . . . . . . 110

5 Cascade (or Series) Connection . . . . . . . . . . . . . . . . . . . . . . . . . 112

6 Parallel Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

7 General Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

8 Systems with multiple inputs . . . . . . . . . . . . . . . . . . . . . . . . . . 116

9 Poles and Zeros of Transfer Functions . . . . . . . . . . . . . . . . . . . . . . 116

10 Remarks/Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

11 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

10 Simple Cruise-Control 124

1 Dynamic Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

2 Control of the First Order Car Model . . . . . . . . . . . . . . . . . . . . . . 125

2.1 Open-Loop Control System . . . . . . . . . . . . . . . . . . . . . . . 126

2.2 Closed-Loop Control System . . . . . . . . . . . . . . . . . . . . . . . 126


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz v

2.3 Open/Closed Loop Comparison . . . . . . . . . . . . . . . . . . . . . 127

3 Integral Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

3.1 Cruise Control with Integral Action and Velocity Feedback . . . . . . 132

4 Understanding the Integral Controller By Using Second Order SLODE . . . 134

5 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

A Arithmetic of Feedback Loops 149

1 Tradeos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

2 Signal-to-Noise ratio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

3 Whats missing? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

4 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

B Saturation and Antiwindup Strategies 160

1 Saturation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

2 Anti-Windup PI control action . . . . . . . . . . . . . . . . . . . . . . . . . . 163

3 Alternate architecture for AntiWindup Logic . . . . . . . . . . . . . . . . . . 166

4 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

C Robustness Margins 169

1 Gain Margin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

2 Time-Delay Margin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

3 Percentage Variation Margin . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

3.1 The Small-Gain Theorem . . . . . . . . . . . . . . . . . . . . . . . . 177

3.2 Necessary and Sucient Version . . . . . . . . . . . . . . . . . . . . . 179

3.3 Application to Percentage Variation Margin . . . . . . . . . . . . . . 181

4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz vi

5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183

5.1 Generic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183

5.2 Missile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184

5.3 Application to percentage variation margin . . . . . . . . . . . . . . . 188

6 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192

D Nonlinear Systems 197

1 Input-output Dierential Equation Models . . . . . . . . . . . . . . . . . . . 198

2 State-space Realizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198

3 Example: Magnetically Suspended Ball . . . . . . . . . . . . . . . . . . . . . 199

4 Equilibrium Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

5 Jacobians and the Taylor Theorem . . . . . . . . . . . . . . . . . . . . . . . 202

6 Linearization about Equilibrium Points . . . . . . . . . . . . . . . . . . . . . 203

7 Control using Jacobian Linearized Plant Models . . . . . . . . . . . . . . . . 205

8 Gain Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

9 Feedback Linearization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208

E Complex Arithmetic 210

1 Basic Stu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210

2 Magnitude and Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210

3 Functions of a Complex Variable . . . . . . . . . . . . . . . . . . . . . . . . 210

4 Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211

5 Subsets of the complex-plane . . . . . . . . . . . . . . . . . . . . . . . . . . . 211

F Linear Algebra 213

1 Matrices and Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz vii

2 Linear Simultaneous Equations . . . . . . . . . . . . . . . . . . . . . . . . . 214

3 Transposes and Adjoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214

4 Determinants and Inverses . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215

5 Eigenvalues and Eigenvectors . . . . . . . . . . . . . . . . . . . . . . . . . . 216

6 Simple-case of the Jordan form . . . . . . . . . . . . . . . . . . . . . . . . . 217

7 Matrix Exponentials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 1

1 Introduction

1 The Power of Feedback

Every morning I wake up and have a shower. I live in North Berkeley, where the housing
is somewhat run-down, but I suspect the situation is the same everywhere. My shower is
very basic. It has hot and cold water taps that are not calibrated. So I cant set the shower
temperature I like, and then step in. Instead, I am forced to use feedback control. I stick
my hand in the shower to measure the temperature. In my brain, I have an idea of what
shower temperature I would like. I then adjust the hot and cold water taps based on the
discrepancy between what I measure and what I want. In fact, it is possible to set the shower
temperature to within 0.5 F this way using this feedback control. Moreover, using feedback,
I can compensate for all sorts of changes: environmental changes, toilets flushing, etc.
This is the power of feedback: it allows us to make a precision device out of a crude one
that works well even in changing environments.

2 The Idea of a Block Diagram

We will, in this course, consider complex interconnections of physical systems. Each of


these physical systems may themselves have complicated dynamics, often represented by
dierential equations. These interconnections form the core of our study of control systems.
We therefore need a convenient means of handling and representing complex interconnections
of physical systems. The basic unit for doing this is a block diagram.

Oven
u1 y1
Oven y2
u2 y3

Figure 1: Block diagram of an


oven. Figure 2: Complex interconnected system.

Consider for example an oven with two electrical heating coils, and three thermometers to
measure temperature. The recorded temperatures y1 , y2 , y3 at each of the three thermometers
is a function of the past history of the voltages u1 , u2 applied to the heating coils. Indeed,
this dependence of yi on uj is very complicated: it involves partial dierential equations
to model conduction eects, and radiative and convective losses. Instead of carrying these
equations along with us, we simply represent the oven as a block as shown in Figure 1. This
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 2

block has two inputs (the applied voltages yi ) and three outputs (the temperatures yj ). We
may now connect various inputs and outputs of this oven to other devices, each of which may
have complicated dynamics, but is represented conveniently as a block, as shown in Figure
2. This simple idea makes possible the study of complex interconnections.
It is very important to remember that the inputs and outputs in a block diagram are not
numbers but signals, i.e. they are functions of time. Also, the value y(t) of the output y at
time t can depend on the entire past history of the applied input signals u(t).

3 Terminology

We need to agree on a common vocabulary before we embark on our study of control systems.
We will explain terms we introduce in the context of the shower temperature control system
discussed earlier.
The physical system to be controlled is called the plant. This term has its origins in chemical
engineering where the control of chemical plants or factories is of concern. In the shower
example, the plant consists of the hot and cold water tanks, the heating elements, connecting
pipes, plumbing connecting to the city water supply and to other showers and toilets all across
town.
A sensor is a device that measures a physical quantity like pressure, acceleration, humidity,
or chemical concentration. Very often, sensors produce an electrical signal whose voltage
is proportional to the physical quantity being measured. This is very convenient, because
these signals can be readily processed with electronics, or can be stored on a computer for
analysis or for real-time processing. In the context of our shower example, the sensor is our
hand. The water temperature is measured and converted to electrical signals that propagate
along neuro-sensory pathways to the brain.
An actuator is a device that has the capacity to aect the behavior of the plant. An electrical
signal is applied to the actuator, which results in some mechanical motion such as the opening
of a valve, or the motion of a motor, which in turn induces changes in the plant dynamics.
Sometimes, as for example electrical heating coils in a furnace, the applied voltage directly
aects the plant behavior without mechanical motion being involved. In the shower example,
the actuator is our hand which can open or close hot and cold water taps in response to
electrical signals sent along neuro-muscular pathways from the brain.
The controlled variables are the physical quantities we are interested in controlling. In the
shower example, this is simply the water temperature of the shower.
The reference or command is an electrical signal that represents what we would like the
regulated variable to behave like. In the context of the shower example, this is the desired
shower temperature.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 3

Disturbances are phenomena that aect the behavior of the plant being controlled. In our
shower example, disturbances include the outside temperature (which aects the character-
istics of the water heater and the heat loss through the plumbing), and other user of the
water supply (flushing an adjacent toilet can decrease the cold water pressure head resulting
in scalding of the unfortunate person taking a shower). Disturbances are often induced by
environmental changes such as temperature and humidity.
The controller is a device that processes the measured signals from the sensors and the ref-
erence signals and generates the actuated signals which in turn, aects the behavior of the
plant. In the shower example, our brain serves as the controller. Based on the dierence
between the reference or desired shower temperature and the electrical signals that repre-
sent the measured shower temperature, our brain sends out electrical signals along neural
pathways that cause our hand muscles (the actuators) to adjust the hot and cold water
taps. Controllers are essential an algorithm that prescribes how to process sensed signals
and reference signals to generate the actuator inputs.
Finally, noises are present at various points in the overall system. We will have some amount
of measurement noise (which captures the inaccuracies of sensor readings), actuator noise
(due for example to the power electronics that drives the actuators), and even noise aecting
the controller itself (due to quantization errors in a digital implementation of the control
algorithm).
Throughout these notes, we will consistently use the following symbols:

P plant K controller
u input y output
d disturbance n noise
r reference

4 The Structure of Control Systems

Based on our discussion above, we can draw the block diagram of Figure 3 that reveals the
structure of many control systems. Again, the essential idea is that the controller processes
measurements together with the reference signal to produce the actuator input u(t). In this
way, the plant dynamics are continually adjusted so as to meet the objective of having the
plant outputs y(t) track the reference signal r(t).

5 Discussion
A. Commands or Reference Signals
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 4

Disturbances
Measurement noise
Actuator noise

Actuators Plant Sensors

Controller

Controller noise Commands

Figure 3: Basic structure of a control system.

These are often piecewise constant signals or ramps as shown in Figure 4. For example,
in the temperature control system of an oven, we may set a desired temperature value
as the command, and later select a dierent temperature value. In most applications,
the reference signal does not change very rapidly. An exception is target tracking.
Here, we might have a missile that is tracking a moving target. The control objective
is to have the position vector of the missile track the position vector of the missile.
Eventually, when the tracking error is small enough, we might declare the missile to
be successful. Notice in this example that the reference signal (the position vector
of the target) changes quickly, as the target is bound to attempt evasive maneuvers.
In the common situation where the reference signal is a constant, such as cruise-control
in a car, the value of the reference is called the set-point.
Who generates the reference signal? It many applications it is a human operator. For
example, a pilot may issue a command to bank his/her aircraft starboard by 12 degrees
by manually turning the steering column. This mechanical motion is converted into
an electrical reference signal which drives the banking control system of the aircraft.
In other applications, the command is generated by a higher level control system, or
by other physical systems. For example, we might have an automated steering system
for a car. Here, we could have a vision system consisting of a camera and related
electronics that watches the center-line of the roadway. The system generates steering
commands that instruct the car to turn appropriately based on the curvature of the
upcoming road. These commands drive the car steering control system.
B. The Controller
Observe that the controller processes voltage signals (the command and the sensor
outputs) and produces voltage signals (applied to the actuators). This is desirable
because it is very convenient to process voltage signals. This can be done with analog
or digital electronics, or with software. The controller is then a mapping or algorithm
that processes the signals y(t) and r(t) and generates the signals u(t). This algorithm
can be very complicated. It may contain logical elements (if .. then .. else
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 5

2
Reference (volts)

2
0 2 4 6 8 10
Time (secs)

Figure 4: Typical reference signal.

statements), or dierential equations. Software implementations of the control algo-


rithm are more flexible than hardware implementations, and are natural candidates
for development or prototyping. However, control algorithms are realized in hardware
for production units because these can be much more cost-eective.

C. Robustness
As we shall discover soon, the design of a control system begins with a model of
the plant dynamics. The controller is designed to deliver the requisite performance
assuming the plant behaves as predicted by the model.
The controller should also work well even if the actual plant behaves slightly dierently
than the plant model. Equivalently, the controller should be designed deliver satisfac-
tory performance for modest perturbations of the plant model. This very important
design requirement is often stated as insisting that the controller or the feedback system
be robust to modeling errors.
There are several reasons why the actual plant dynamics may be dierent than the
plant model.
First, we may have made many simplifying assumptions in modeling the plant. For
example, we often choose to neglect friction terms or aerodynamic eects.
Second, in many situations, the plant dynamics may change during operation. For
example, in chemical reactors, there is often a build-up of slag at the base of the reactor
which changes the heat-transfer characteristic of the reactor. This in turn causes the
dynamics of the reactor to change, and over time, this change can be significant.
The third reason is that we may have changed the physical plant itself. For example,
in a manufacturing situation, we produce many copies of the same car design, each of
which behaves slightly dierently. But we dont custom design a controller for each car
rolling o the assembly line: its too expensive. We design one controller that works,
say for all Ford Mustangs, keeping in mind the variations in the car dynamics that
occur in the manufacturing cycle.

D. The Notion of Performance


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 6

There is no universal measure to assist us in deciding whether one controller is better


than another. This decision is often problem specific.
Consider for example the step responses shown in Figure 5. In the context of position
control of an elevator, the response in panel (b) is unacceptable. The response exhibits
undershoot and significant oscillations. Both of these features would cause great con-
sternation to elevator passengers. Undershoot means the elevator travels momentarily
in the wrong direction, while the under-damped behavior corresponds to the elevator
oscillating with significant amplitudes before settling to the correct floor level.

2 2
1.5 1.5
step response

step response

1 1
0.5 0.5
0 0
0.5 0.5
0 2 4 6 8 0 2 4 6 8
time time

Figure 5: Illustrating the notion of performance: (a) overdamped and (b) lightly damped
responses.

Conversely, consider the position control problem of the end-eector of a robot arm
in a high-precision manufacturing facility. Assuming the robot workspace is free of
obstacles, the response in panel (b) is preferable to that in panel (b). This is because
the step response of panel (b) has a much smaller settling time. In this application, it
is imperative for the robot arm to be in place quickly so that subsequent machining
can be done. The intermediate trajectory of the robot arm is of little consequence.
The response of panel (a) takes 6 seconds to settle to within 2 % of the final value.
This will cause a significant reduction in the processing throughput, or the number of
parts per hour that the robot can service.
There are some aspects of performance that are universal. For example, we would
always want our control system to result in closed-loop dynamics that are insensitive
to disturbances. This is called disturbance rejection. Also, as pointed out previously,
we would want the controller to be robust to plant modeling errors.

6 The Ingredients of Control System Design

In designing a complete feedback control system, we are faced with several dicult choices.
Let us discuss these choices in the context of a realistic example.
Our example is drawn from semiconductor manufacturing. One of the critical processing
steps in processing silicon wafers in plasma etching, illustrated in Figure 6. Here, ions are
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 7

accelerated towards a silicon wafer by means of an external voltage. The wafer is selectively
protected from this ion bombardment by a photo-resist mask. The unprotected regions of
the wafer are etched by the plasma bombardment, creating a fine pattern on the silicon
wafer. Our objective is to engineer a feedback control system for plasma etching that allows
for removal of material at a carefully controlled rate that is uniform across the wafer.

3 concentric
electrodes

etch chamber
ions

wafer

ground plate

Figure 6: Illustration of the plasma etch process.

The first decision we are confronted with is to select what physical variables we wish to
control or regulate. This decision is based on considerations specific to the process being
controlled. In the plasma etch example, we wish to control etch rate uniformity.
The next step is to select appropriate sensors and actuators. The simplest situation is if
we can directly measure the regulated variables. This results in the most straightforward
control problem. However, in many situations (particularly in process control), we can only
indirectly measure the regulated variables. In other words, we get to measure some other
physical variables that are aected by
Then, we have to construct a model for the plant, based on which we design a control system.
This can be done from first principles or using empirical methods based on experimental data.
For the purposes of control, we usually require a simple, approximate model. A rule of thumb
is that the controller is as complex as the model that was used to design it.
We can then design and test the controller. There are many choices of design methods
distinguished by the type of plant model we have, and the measure of performance we
demand from the closed-loop system. Testing the controller can be first done in simulations,
using a very detailed plant model. Then a prototype controller can be built (usually in
a software implementation) and tested with the real plant. Finally, we can design and
manufacture production versions of the controller. These will have user-friendly software
interfaces.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 8

7 A General Architecture for Control Systems

A general control system architecture is shown in Figure 7. This general architecture pro-
vides a universal framework in which to address apparently dierent control system design
problems.

regulated exogenous
variables z inputs w
generalized
plant
measured controlled
outputs y inputs u

controller

Figure 7: General control system architecture.

In the diagram above, we have the generalized plant which includes the physical plant to be
controller, the sensors, and the actuators.
There are two sets of input signals to the generalized plant. The controlled inputs u are the
inputs that we may adjust in the course of controlling the plant. These are just the actuator
inputs. The exogenous inputs are signals that aect the generalized plant over which we
have no authority. These include the commands r, the external disturbances d, and noises
n that aect various components of the generalized plant.
There are two sets of outputs from the generalized plant. The measures outputs y are all
signals available to the control system. These typically include the sensor outputs ys and
the commands r. The regulated outputs are a collection of signals which we would like to
keep small. These typically include tracking errors (r yr ), and the actuator inputs u.
As an example, we can redraw a standard tracking feedback system to resemble the general
configuration of Figure 7. This is illustrated in Figure 8.

8 Example: A simple Cruise Control System for a Car

We will now go through a simple control system design example. The plant consists of a
car, and the regulated variable is the speed v of the car. We have available a speedometer
that is our sensor, and an electric motor that opens the fuel throttle serves as our actuator.
The driver of the car issues a command r for the desired car speed. The dynamics of the
car is aected by various disturbances, most prominent of these being d, the incline of the
roadway. We do not have any sensor that measures the roadway incline (if we did, then d
would a measured output and not a disturbance).
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 9

d e P r
+- ++ d
u +
P + y u

e -+
Kp r
++
Ko Kp ++
Ko

Figure 8: Standard tracking control system, redrawn in the general architecture.

A. The model
We begin by oering a very simple model of the car. Common experience reveals
that for a fixed fuel throttle position the car achieves a certain steady speed. With
the throttle being held fixed, if the roadway is inclined uphill, this steady speed is
diminished. We therefore suggest a model of the form

y = Gu Hd

Experiments confirm that this model is reasonable, and for the particular car under
consideration, nominal values of the constants G and H are

Go = 20, H o = 5

It is these nominal values that will be used to design our controllers. However, the
behavior of the actual plant may be better represented by other values of G and H
that are close to, but not exactly equal, to these nominal values. Indeed, we may
better describe the plant by a more complex model. Many important dynamics have
been ignored in our extremely simplified plant model. In fact, our model suggests that
changes in the throttle immediately aect the speed, which we know from common
experience to be unrealistic.

B. Control design
Next we will design a control system to regulate the speed of the car. Our first objective
will be to achieve reference tracking (y(t) r(t)) for the nominal model (G = Go ) and
in absence of disturbances (d = 0). Then, we will analyze the behavior of the controlled
system in the presence of disturbances (d = 0) and model mismatch (G = Go ). We
will study the dierence between open-loop control and closed-loop control.

1. Open-loop Control System


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 10

To begin with lets design an open-loop control system to regulate the speed of
the car. The configuration is shown in Figure 9 below. The controller gain Kol is
to be designed. Notice that there is no feedback of measured information to the
actuator. Analyzing Figure 9 gives us the relationships y = Gu Hd, u = Kol r,
which can be combined to yield

y = GKol r Hd

As a first cut, we should demand that the cruise control system work perfectly
for the nominal plant (i.e. G = Go , H = H o ), and in the absence of disturbances
(i.e. d = 0). Thus, we insist that
1
r = Go Kol r, or Go Kol = 1, which forces the design Kol = = 0.05
Go
This results in the open-loop control system behavior
G
y= r Hd (1.1)
Go
which is
G
y= r Hd
20

d H

r u +- y
K ol G

Car Model

Figure 9: Open-loop cruise control sys- Figure 10: Closed-loop cruise control system.
tem.

2. Closed-loop Control System


Now lets design a closed-loop or feedback control system. The configuration is
shown in Figure 10. The controller gains K and Kfb are to be designed. Analysis
of Figure 10 yields the relationships

y = Gu Hd, u = K r Kfb y

These can be combined as

y = GK r GKfb y Hd, or (1 + GKfb )y = GK r Hd


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 11

We therefore have the closed-loop control system behavior


GK H
y= r d (1.2)
1 + GKfb 1 + GKfb
Again, for the nominal plant model with no disturbances, we demand perfect
tracking. As a result,
Go K
r= r
1 + Go Kfb
which gives us the design rule
G o K
=1 (1.3)
1 + Go Kfb
One way to achieve this is through high-gain feedback. This means that if we
select |Go Kfb | >> 1 and K = Kfb then
Go K
1 (1.4)
1 + Go Kfb
For instance if we choose Go Kfb = 2000, then Kfb = 100 and K = 100. This
results in the closed-loop control system behavior
100G H
y= r d
1 + 100G 1 + 100G
C. Robustness
So far we have designed Kol or K and Kfb in order to obtain y r under no model
mismatch and d = 0. Two important questions need to be answered:

What is the eect of the road incline d on the vehicle speed? (Disturbance Re-
jection)
How sensitive is the controller performance (y r) to (small) inaccuracies in
model parameters and model simplification. (Sensitivity Analysis)

A good control design should provide minimal variation of the vehicle speed in both
cases.

1. Disturbance Rejection
We analyze the nominal model case: G = Go , H = H o , and focus only on the
disturbance eect on the output: r = 0 and d = 0.
(a) Open-loop Disturbance Rejection
From equation (1.1) we have

y = H o d
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 12

Therefore we notice that the open-loop control has no power to reduce the
eect of the disturbance d on the output y. For instance since H 0 = 5 a slope
of 1degree provides a speed reduction of 5m/s ( 11 miles per hours) which
is definitely not acceptable and cannot be changed by any choice of Kol .
(b) Closed-loop Disturbance Rejection
From equation (1.5) we have
Ho
y= d
1 + Go Kfb
o
Clearly, if we use a high-gain feedback controller we obtain 1+GHo Kfb 0
and therefore we are able to almost cancel the eect of the disturbance on
the output.
For our choice of controller parameters we have
5
y= d = 0.002d
1 + 20 100
which says that a slope of 1degree provides a speed reduction of 0.002m/s
( 0.004 miles per hours).
2. Sensitivity Analysis
If we have a nominal model G = Go and H = H o and d = 0, then we have
a nominal output y = y o . The question we are trying to answer is: what is the
variation of the output y around the nominal output y o when there is a variation
of the plant G around the nominal plant Go .
To this aim are going to use the quantity

y
y y Go
S = G =
G
o o
G G=Go , y=yo y o
G=G , y=y

The number S will represent the controlled system sensitivity to plant variation.
A small S implies that y is small with respect to G and thus the controlled
system behavior does not drastically change if we have some model mismatch.
(a) Open-loop Sensitivity
Let us now calculate the sensitivity of the output y with respect to G at the
nominal value Go in the absence of disturbances (d = 0). Using the open-loop
control system behavior (1.1), we obtain
y G r G
S= = o =1
G y G Gr/Go
This means that a 1 percent deviation of the plant from its nominal value Go
will result in a 1 percent deviation in the output y.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 13

(b) Closed-loop Sensitivity


Let us repeat the sensitivity calculation for the closed-loop control scheme.
The closed-loop system behavior in the absence of disturbances is
GK
y= r
1 + GKfb
We can then compute

y G K (1 + GKfb )r Kfb GK r 1 + GKfb 1
S= = =
G y (1 + GKfb )2 K r 1 + GKfb G=Go
In conclusion
1
S=
1 + Go Kfb
We can again conclude that a high-gain feedback controller allow us to have
a small sensitivity to uncertain parameters and plant/model mismatch.
Lets evaluate S for the controller chosen in the past sections
1 1
S= =
1 + Go Kfb 2001
In this case, we see that a 1 percent deviation of the plant from its nominal
value Go will result in an insignificant 1/2001 .0005 percent deviation in
the output y. Thus, the behavior of the closed-loop control scheme is far less
sensitive to modeling errors in G.
D. Noise attenuation
So far we have seen that a high-gain feedback controller solves all our problems:
reference tracking, robustness to disturbances and small sensitivity to model mismatch.
Here is one reason why feedback control design is not so trivial... and high-gain
feedback has to be carefully used.
Assume now that we have a noisy sensor and thus the information fed back to the
controller is
ym = y + n
where n is the sensor noise. The control input will be

u = K r Kfb ym

which yields the closed loop behavior

y = GK r GKfb y GKfb n Hd

or
GK H GKfb
y= r d n (1.5)
1 + GKfb 1 + GKfb 1 + GKfb
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 14

GKfb
The term 1+GKfb
n characterizes the eect of the sensor noise on the plant output.
A good controller should make sure that any noise injected at the sensor output should
be significantly attenuated at the process output y . This requires

GKfb

1 + GKfb << 1

This is equivalent to requiring


|GKfb | << 1
This is clearly in direct conflict with the high-gain feedback control design.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 15

2 Modeling

1 The Uses of Models

Modeling of physical systems is a vital component of modern engineering. A model often


consists of complex coupled dierential equations. The solution of these dierential equations
describe the evolution of the physical system being considered.
Models may be developed for a variety of purposes including

simulation & prediction


design
control

2 Modeling Errors

It is extremely important to be aware that models of physical systems are always inaccurate.
They involve varying degrees of approximation. For example in modeling a car, we may
choose to ignore rolling resistance, aero-dynamic eects, road-tire interactions, etc.

3 Models for Use in Control System Design

As we have discussed earlier, models are a key ingredient in the design of control systems.
Models used for this purpose need not be extremely accurate. The general rule of thumb is
that the complexity of the control system is approximately the same as the complexity of the
model used to design the controller1 . If we use an exceedingly detailed model, the resulting
controller may be so complex as to render implementation unreliable, or even worse, we may
not be able to implement the control algorithm in real time. On the other hand, if we use
a too simple model to design control systems, the resulting controller may not function as
anticipated when used with the real physical plant.

4 Notation

Let x(t) be a function of time. We will use the following notation:


x(t)
= dx(t)
dt
2
x(t) = d dtx(t)
2

1
We will make this assertion precise in a very specific context when we develop state-space controller
design methods.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 16

Often we will also remove the time dependence and only write x for x(t)
and x for x(t).

5 First Order Linear Systems

5.1 Example: Moving Mass

Consider the moving mass in Figure 11. Assume we can measure the mass speed v(t).

Figure 11: Moving Mass.

We also have an actuator that applies a force u(t) to the mass. The goal is to derive a
model describing the behavior of v(t) under any input u(t). The mass is also aected by a
viscous braking force Fb (t). We assume that Fb is proportional to the speed of the mass:
Fb (t) = bv(t), where b is the friction coecient.
Using Newtons laws we can easily write the equations of motion as
= u(t) Fb (t) = u(t) bv(t)
mv(t) (2.1)

Use the notation y(t) = v(t) and rewrite (2.1) with one being the coecient of y
b 1
y + y = u(t) (2.2)
m m
Equation 2.2 is a single linear ordinary dierential equation (SLODE).
It is an Ordinary Dierential Equation since it involves only ONE independent variable (the
time t). In case the dierential equations involve two or more independent variables they
are called partial dierential equations. In this class we will study only ODEs. Equation 2.2
is a first order SLODE since the highest derivative that appears in the dierential equation
is the first.
In order to compute the speed of the mass at a time T , we need to specify the speed v(t)
at time 0 (the initial condition) AND the input u(t) from 0 till T . If we denote the initial
speed with the symbol v0 , the initial condition will have the form
v(0) = v0
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 17

Therefore the complete SLODE model is

b 1
y + y = u(t) (2.3)
m m
y(0) = v0 (2.4)

An alternative modeling formalism is obtained as follows. Use the notation x(t) = v(t) and
rewrite (2.1) with only the highest derivative on the left hand side of the equality:

b 1
x = x+ u (2.5)
m m
x(0) = v0 (2.6)

Equation 2.5 is the state-space model of the system and x(t) is the system state at time t.
Equation 2.6 is the initial condition. Note that in order to compute the state at time T we
just need the state x(0) at time 0 and the input from 0 till T .

5.2 Example: RC Circuit

Consider the electric circuit in Figure 12 consisting of a capacitor C and a resistor R in series
with a voltage source u(t) which represents the input to the system.

Figure 12: RC Circuit.

If u(t) = 0 then the capacitor would discharge its energy into the resistor. We are interested
in deriving a model describing the behavior of the voltage across the capacitor vC (t) under
any input u(t).
Recall the fundamental equations linking the current i(t) through the resistor and the the
voltage across the resistor
vR (t) = Ri(t)
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 18

and the fundamental equations linking the current i(t) through the capacitor and the the
voltage across the capacitor (in an ideal capacitor wholly characterized by a constant capac-
itance C)
dvC (t)
i(t) = C
dt
The circuit equation can be easily derived by using the Kirchhos voltage law (the algebraic
sum of the electrical potential dierences around any closed circuit must be zero):

u(t) vR (t) vC (t) = 0

which becomes
u(t) RC v C (t) vC (t) = 0

The SLODE model with y(t) = vC (t) is


1 1
y + y= u(t) (2.7)
RC RC
y(0) = vc,0 (2.8)

where vc,0 is the initial condition, i.e., the voltage across the capacitor at time 0.
The state space model with x(t) = vC (t) is
1 1
x = x+ u (2.9)
RC RC
x(0) = vc,0 (2.10)

6 Second Order Linear Systems

6.1 Example: Spring-Mass-Damper

Consider the spring-mass-damper arrangement of Figure 13


The position of the mass S(t) is measured relative to the un-stretched position of the spring.
2
We assume that

we have an actuator that applies a force u(t) to the mass. 3

2
There are many schemes available to inexpensively measure S(t). For example, an optical sensor sends
a light pulse out which reflects o the mass, and its position S(t) can be deduced from the elapsed travel
time of the light pulse.
3
Note that the actuator accepts a voltage input and converts it to a force. We presume that this conversion
is has a unit gain, i.e., 1 volt produces 1 Newton of force.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 19

Figure 13: Spring-Mass-Damper System.

the spring element has mass zero and it generates a braking force FK (t) proportional
to the mass position S(t):
FK (t) = KS(t)
where K is the spring constant.
the position of the mass is also aected by a viscous damper, which supplies a braking
force Fb = by proportional to, and opposing the velocity of the mass. b is the friction
coecient.

Using Newtons laws we can easily write the equations of motion as


= KS(t) bS(t)
mS(t) + u(t)

The SLODE model with y(t) = S(t) is


b K 1
y + y + y = u(t) (2.11)
m m m
y(0) = s0 , y(0)
= v0 (2.12)

where s0 and v0 are the initial conditions, i.e., the position and speed of the mass at time 0.
The state space model consists of 2 coupled first order dierential equations. Define the two

states as x1 (t) = S(t) and x2 (t) = S(t), then

x 1 = S = x2
b K 1
x 2 = S = x2 x1 + u(t)
m m m

These equations can be written in matrix form as


[ ] [ ][ ] [ ]
x 1 0 1 x1 0
= + 1 u
x 2 Km
mb x2 m
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 20

The initial conditions are x1 (0) = s0 and x2 (0) = v0 . Also we have two states but we have
only one sensor (the mass position). For this reason we introduce the output equation:
[ ]
x1
y=[ 1 0 ]
x2

to emphasize the fact that we measure only y(t) = x1 (t) = S(t). The final model is
{
x(t)
= Ax(t) + Bu(t)
y(t) = Cx(t)
x(0) = x0
[ ] [ ] [ ]
x1 (t) 0 1 0
where x(t) = ,A= , B = 1 , C = [ 1 0 ], x0 = [ s0 v0 ].
x2 (t) Km
mb m

6.2 Example: RLC Circuit

Consider the electric circuit in Figure 14 consisting of a capacitor C, a resistor R and an


inductor L in series with a voltage source u(t) which represents the input to the system.

Figure 14: RLC Circuit.

We are interested in deriving a model describing the behavior of the voltage across the
capacitor vC (t) under any input u(t).
Recall the fundamental equations linking the current i(t) through the inductor and the
the voltage across the inductor (in an ideal inductor wholly characterized by a constant
inductance L)
di(t)
vL (t) = L
dt
The circuit equation can be easily derived by using the Kirchhos voltage law (the algebraic
sum of the electrical potential dierences around any closed circuit must be zero):

u(t) vR (t) vC (t) vL (t) = 0


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 21

which becomes
u(t) RC v C (t) vC (t) LC vC (t) = 0

The SLODE model with y(t) = vC (t) is


R 1 1
y + y + y= u(t) (2.13)
L LC LC
dvC i0
y(0) = vc,0 , y(0)
= (0) = (2.14)
dt C
where vc,0 and i0 are the initial conditions, i.e., the voltage across the capacitor and the
current through the inductor (and the whole circuit) at time 0.
The state space model consists of 2 coupled first order dierential equations. Define the two
states as x1 (t) = vC (t) and x2 (t) = v C (t), then
x 1 = s = x2
R 1 1
x 2 = s = x2 x1 + u(t)
L LC LC

These equations can be written in matrix form as


[ ] [ ][ ] [ ]
x 1 0 1 x1 0
= + u
x 2 LC
1
RL
x2 1
LC

The initial conditions are x1 (0) = vc,0 and x2 (0) = iC0 . Also we have two states but are
interested only in one output (the voltage across the capacitor). For this reason we introduce
the output equation: [ ]
x1
y=[ 1 0 ]
x2
to emphasize the fact that out output is only y(t) = x1 (t) = vC (t). The final model is
{
x(t)
= Ax(t) + Bu(t)
y(t) = Cx(t)
x(0) = x0
[ ] [ ] [ ]
x1 (t) 0 1 0 [ ]
where x(t) = ,A= ,B= , C = [ 1 0 ], x0 = vC,0 iC0 .
x2 (t) L LC
R 1 1
LC

7 n-th Order Linear Dynamical Systems

7.1 SLODE Models

A generic n-th order SLODE model has the form


y [n] (t) + a1 y [n1] (t) + a2 y [n2] (t) + + an y(t) =
(2.15)
b0 u[n] (t) + b1 u[n1] (t) + b2 u[n2] (t) + + bn u(t)
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 22

[0] [1] [2] [n1]


subject to initial conditions y(0) = y0 , y [1] (0) = y0 , y [2] (0) = y0 , . . . , y [n1] (0) = y0 .
where y [k] denotes the kth derivative of the function y,
dk y
y [k] =
dtk

7.2 State-Space Models

A generic n-th order state space consist of n coupled first order dierential equations that
look like: {
x(t)
= Ax(t) + Bu(t)
y(t) = Cx(t) + Du(t)
x(0) = x0
Here A, B, C, D are the matrices of the state-space realization. We shall reserve the letters
m, n, p for the numbers of inputs, states, and outputs respectively. In this course we will
consider m = 1 and p = 1 (Single-Input Single-Output (SISO) Systems).
The dimension of the system is the number of states n. Note the sizes of the various matrices:
A Rnn , B Rnm , C Rpn , D Rpm .

7.3 SLODE to State-Space Models and Viceversa

We can rewrite a n-th order SLODE model as a set of n coupled first-order dierential
equations (and thus a state-space model). For example, consider the dierential equation
model
y [3] + 3
y + 4y + 7y = u
Define the states by
x1 = y, x2 = y,
x3 = y
We can then re-write this dierential equation model as
x 1 = y = x2
x 2 = y = x3
x 3 = y [3] = 3
y 4y 7y + u = 7x1 4x2 3x1 + u
y = x1
These equations can be written in matrix form as
[ ] [ ][ ] [ ]
x 1 0 1 0 x1 0
x 2 = 0 0 1 x2 + 0 u (2.16a)
x3 7 4 3 x3 1
[ ]
x1
y = [ 1 0 0 ] x2 (2.16b)
x3
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 23

Lets do the inverse exercise. Assume we are given the state space model (2.16). We want
to derive the equivalent SLODE model. We observe from (2.16b) that y = x1 . Therefore
y = x 1 , which is y = x 1 = x2 (use the first equation in (2.16a)). Therefore y = x 2 , which
is y = x3 (use the second equation in (2.16a)). Finally y [3] = x 3 , which is y [3] = x 3 =
7x1 4x2 3x3 + u (use the third equation in (2.16a)). In conclusion y = 7y 4y 3 y+u
which gives the SLODE:
y [3] + 3
y + 4y + 7y = u

7.4 The Concept of State

The state x(t) at time t0 is the information you need at time t0 that together with future
values of the input (i.e., u(t) for all t t0 ), will let you compute future values of the output
y (i.e., y(t) for all t t0 ).
In other words, past history (before t0 ) of the systems evolution is not important in deter-
mining its evolution beyond t all of the relevant past information is embedded in the state
variables values at t0 .
For example, suppose we have a point mass subject to a force [input]. In order to predict
the future motion of the particle, we need to know the force, and also the initial condition
which is the position and velocity of the particle.
For an unconstrained rigid body moving in three dimensions, its state consists of the position
and velocity its center of mass and its orientation (three angles) and rotation (three angular
velocities). So its state has 12 dimensions.
The concept of state is very powerful and has applications well beyond control and dynamics.
For example, in a graphical user interface, the state is the value of every button, slider bar,
editable text box on the interface. The idea of the state of a GUI is a very useful construct
in GUI programming. Once we know the current state, if the users takes an action [input]
for example by clicking on a button, we can decide what the program should do to the state.
Maybe if you click this button which is now green, a new button become visible and other
interface options become disabled.

8 Nonlinear Systems

8.1 Example: Magnetically Suspended Ball

A magnetically suspended ball consists of a ball of mass m suspended by an electromagnet


as shown below. Let y be the position of the ball, measured down from the base of the
electromagnet. If a current u is injected into the coils of the electromagnet, it will produce a
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 24

2
magnetic field which in turn exerts an upward force on the ball given by Fup = cu y2
. Note
2
that the force decreases as the 1/y because the eect of the magnet weakens when the ball
is further away, and that the force is proportional to u2 which is representative of the power
supplied to the magnet.

Fup y

mg

Figure 15: Magnetically suspended ball.

Let us assume that we can measure the position y of the ball. This can be arranged optically
using light-emitting diodes with photocells.
We can then write a simple model for the motion of the ball from Newtons second law as
cu2
y = mg 2
m (2.17)
y
Note that this is a single-input, single-output nonlinear model. The input and output of this
model are

u the current injected into the magnet coils


y the position of the ball

In the context of numerical exercises, use the following constants:

m 0.15 Kg mass of ball


c 0.01 Kg-m3 /Coul2 magnetic coupling constant

We can convert this nonlinear dierential equation model to a state space model by defining
the states:
x1 = y, x2 = y
We get the state-space equations:
x 1 = f1 (x1 , x2 , u) = x2
( )2
cu2 u
x 2 = f2 (x1 , x2 , u) = g = 10
mx21 3.87x1
y = h(x1 , x2 , u) = x1
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 25

There are a number of sources of modeling error in our simple model above. The most
significant of these is the leakage of the magnetic field. This is appreciable as y increases,
and this manifests itself in a decrease in the exponent of u in Fup . A second serious modeling
omission is that we have treated the motion of the ball as rectilinear. In practice, unless the
ball is confined to a vertical guide, it will have small motions in the horizontal plane also.
These have significant eects on the dynamics of the ball, as the magnetic force reduces
significantly o the magnet axis. We have also neglected resistive and inductive eects in
the electromagnet coils, and approximated the ball as a point mass.
Despite the simplicity of this physical system, and the crudeness of our model, we stand
to gain an understanding of nonlinear control using this as a test-bed. Industrial levitation
systems are significantly more complex.

8.2 Example: Water Tank

Consider the water tank in Figure 16. Denote by qin (t) the water flow entering the tank and
qout (t) the water flow leaving the tank from a hole of size a.

Figure 16: Water Tank system.

Out goal is to obtain a model that describes the evolution of the tank height h(t) as a
function of the external input u(t) = qin (t). Let A be the area of the tank. By using the
conservation law we can state that

Ah(t) = qin (t) qout (t)

Let vout (t) be the speed of the water at the outlet. Then, qout (t) = avout (t)
Torricellis law states that the speed of a fluid through a sharp-edged hole under the force
of gravity is the same
as the speed that a body would acquire in falling freely from a height
h, i.e. vout (t) = 2gh(t), where g is the acceleration due to gravity. In conclusion our
nonlinear model is
1
h = (u(t) a 2gh(t))
A
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 26

in state space form we use x(t) = h(t) and write


a 1
x = 2gx + u
A A
with initial condition x(0) = h0

8.3 Example: Pendulum

Consider the pendulum shown in Figure 17 below.

Figure 17: Pendulum.

We assume that the pendulum has mass m1 = 0.333 Kg which is concentrated at the end
point and length l = 0.75 meters. The angle is measured, and an actuator can supply a
torque u = Tc (t) to the pivot point. The moment of inertia about the pivot point is I = ml2
By writing Eulers equation for the pendulum, we can readily arrive at a dierential equation
model for this system:
= Tc mglsin((t))
I (t)
or
= 1 Tc g sin((t))
(t)
ml2 l
which is a second order nonlinear dierential equation. The state space model with x1 (t) =
is
(t) and x2 (t) = (t)

x1 = x2
g 1
x2 = sin(x1 ) + 2 u
l ml

9 Nonlinear Dynamical Systems in State Space Form

Note that in the previous nonlinear examples we cannot write these equations in matrix
form as we did for linear dierential equations. However we can find a compact form for any
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 27

nonlinear dynamical systems in state space form. Consider the dierential equation model

+ 7 cos(y) = 4u2 + uy
y + 3yy

Define the states by


x1 = y, x2 = y
We can then re-write this dierential equation model as

x 1 = y = x2
x 2 = y = 3yy
7 cos(y) + 4u2 + uy = 3x1 x2 7x1 + 4u2 + ux1
y = x1

Note the form of these equations:

x 1 = f1 (x1 , x2 , u) = x2
x 2 = f2 (x1 , x2 , u) = 3x1 x2 7x1 + 4u2 + ux1
y = h(x1 , x2 , u) = x1

More generally, for an m-input, p-output nonlinear dierential equation model, we would
get equations like

x 1 = f1 (x1 , , xn , u1 , , um )
.. ..
. .
x n = fn (x1 , , xn , u1 , , um )
y1 = h1 (x1 , , xn , u1 , , um )
.. ..
. .
yp = hp (x1 , , xn , u1 , , um )

Here each of the possibly nonlinear functions f1 , , fn and h1 , , hp are scalar-valued.


These equations are quite a mess to write down. By introducing the notation:

x = (x1 , , xn ), u = (u1 , , um ), y = (y1 , , yp )

we can write these equation more compactly in standard state-space form as

x = f (x, u)
y = h(x, u)

Note that in this form, the nonlinear functions f and h are vector-valued. This means that
there are actually many scalar functions contained in the symbols f and h.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 28

10 Properties of Models

Consider a general model M with input u and output y. Note that u and y are signals. For
a signal u, we let u(t) denote the value of the signal at time t. Let us formally define some
properties of models, and then explore these definitions using examples.
The model M is said to be memoryless or static if y(t) depends only on u(t). Otherwise,
the output y at time t depends on input values at other times. In this case, the model M
has memory, and is called dynamic.
The model M is called causal if y(t) depends on u( ) for t, and is called strictly causal
if y(t) depends on u( ) for < t.
The model M is called linear if

M(1 u1 + 2 u2 ) = 1 M(u1 ) + 2 M(u2 )

for any input signals u1 and u2 , and any real numbers 1 and 2 . This is called superposition
principle.
The model M is called time invariant if the response to u(t ) is y(t ) for any 0.
This implies that if the input is delayed by seconds the output is also delayed by seconds.
SLODE models are time invariant if the coecients do not depend on time. Linear models
in state space form are time invariant if the matrices A, B, C and D do not depend on time.

11 Models in Simulink

Simulink is a powerful Matlab toolbox which allows to simulate dynamical systems by using
simple blocks.
We will teach you the basics during the discussion section. Below we report some funda-
mental blocks.

11.1 Composing integrators

In order to simulate a linear or nonlinear model, we will need the simplest model: the
integrator. x = u, x(0) = x0 is simulated by using the following diagram shown in Figure 18.
where the initial condition x0 is set by double clicking the integrator block as shown in
Figure 19.
By using multiple integrators in series we can draw more complex systems.
For instance Example 5.1 is simulated by using the following system shown in Figure 20.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 29

Figure 18: Simple Integrator Simulation.

Figure 19: Setting the initial condition in an Integrator.

Example 6.1 and in particular equations (2.9)-(2.10) are simulated by the following sytem
shown in Figure 21.
Note that the initial conditions in (2.10) are set in each integrator.

11.2 State Space Linear Models

A model of the form x = Ax + Bu, Y = Cx + Du and x(0) = x0 is readily simulated by


using the following block shown in Figure 22.
By clicking on the block you can set the matrices A,B,C,D and the initial condition x0 , see
Figure 23:
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 30

Figure 20: Simulink block diagram of a moving mass.

Figure 21: Simulink block diagram of Spring-Mass-Damper system.

12 Additional Example: DC motor

Motors are a central ingredient in almost all control systems4 . Most actuators contain a
motor that enables some mechanical motion which, in turn, aects the dynamics of the
plant. For example, the fuel flow in an automobile is actuated by a valve which is opened
and closed by means of a motor. Given the importance of motors to control systems, it is
worthwhile to briefly examine how they work, and to write down simple models that describe
their dynamics.
The basic principle in modeling a DC motor is that a charge q, moving in a magnetic field
B with velocity v experiences a force F = qv B. This yields two electromechanical ideas:
4
For a detailed discussion of the operating principles and design of modern motors see Hi-Dong Chai,
Electromechanical Motion Devices, Prentice-Hall, 1998.

Figure 22: Simple State-Space Simulation.


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 31

Figure 23: Setting the A,B,C,D matrices and the initial conditions.

a wiring carrying current perpendicular to a magnetic field experiences a external force; a


wire moving perpendicular to its length and perpendicular to a magnetic field experiences a
potential dierence across its ends.
The design and modeling of DC motors uses these two ideas. For design,

1. Mount permanent magnet in housing

2. Rigidly wind conductor along a rigid shaft

3. Suspend shaft/windings in magnetic field

4. Pass current through windings, causing shaft to rotate relative to the housing/magnet
assembly

A simple model for this has three aspects:

Electrical: Although the resistance and inductance of the windings are distributed
along the windings, we treat them as a single lumped resistance and a single lumped
inductance.

Mechanical: All moments acting on the shaft lead to the angular acceleration of the
shaft.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 32

Electromechanical: Relationships between the electrical properties and the mechanical


properties.

A diagram of the electrical circuit is shown in Figure 24.

Figure 24: DC Motor circuit.

The circuit voltages satisfy


di
ea (t) i(t)R L eb (t) = 0 (2.18)
dt
The induced voltage due to the motion is

eb (t) = Kb (t) (2.19)

where Kb is a constant, which depends on the geometry (dimensions) of the motor, and
the strength of the magnetic field. The torque that is exerted on the shaft due to the
current/magnetic field interaction is

Tm (t) = K i(t) (2.20)

where K is a constant, which depends on the geometry (dimensions) of the motor, and the
strength of the magnetic field.
Balance of angular momentum for the shaft gives
= Tm (t) + TF (t) + TL (t)
J (t) (2.21)

A simple friction model is linear, viscous friction,

TF (t) = BS (t) (2.22)

where BS is a constant, depending on the lubrication and bearing which supports the shaft.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 33

We can write these equations in the form


di 1
= [Ri(t) Kb (t) + ea (t)]
dt L
d
= (t)
dt
d 1
= [K i(t) B(t) + TL (t)]
dt J
which is easily put into matrix form
R Kb 1
[ ] 0 [ ] 0 [ ]
d i(t) L L i(t) L ea (t)

(t) = 0 0 1 (t) +
dt (t) 0 0
TL (t)
(2.23)
K B (t) 1
0 0
J J J
Note that if we define [ ] [ ]
i(t)
ea (t)
x(t) := (t) d(t) :=
TL (t)
(t)
then the equations are of the form x(t)
= f (x(t), d(t)), and that the function f is actually
linear,
x(t)
= Ax(t) + Bd(t)

Usually, the inductance L is quite small, and we can make an approximation that
di
L 0,
dt
which simplifies equation (2.18) into an algebraic equation, i(t)R+ea (t)eb (t) = 0. Solving
for i gives
ea (t) eb (t)
i(t) =
R
1 Kb
= ea (t) (t)
R R
Hence, i is no longer governed by a dierential equation, but rather an algebraic relation
between ea and . This can be substituted into the state equation for , yielding
K Kb + BR K 1
(t)
= (t) + ea (t) + TL (t) (2.24)
JR JR J
= (t) to get
Combine with (t)
[ ] [ 0 1
][ ] [
0 0
][ ]
d (t) (t) ea (t)
= K Kb + BR + K 1 (2.25)
dt (t) 0 (t) TL (t)
JR JR J
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 34

3 First Order, Linear, Time-Invariant (LTI) ODE

1 The Big Picture

We shall study models described by Linear Time-Invariant input-output dierential equa-


tions. The general form of such a model is

y [n] + a1 y [n1] + + an1 y + an y = b0 u[m] + b1 u[m1] + + bm1 u + bm u (3.1)


k
where y [k] denotes the k th derivative of the signal y(t): d dty(t)
k . Equation (3.1) is often called

SLODE (Single Linear Order Dierential Equation). Here we will require that m n. For
reasons we will understand later, this is equivalent to stating that the model (3.1) is causal.
We will learn how to solve these dierential equations, and more importantly, we will discover
how to make broad qualitative statements about these solutions. Much of our intuition
about control system design and its limitations will be drawn from our understanding of LTI
systems.
A great many models of physical processes that we may be interested in controlling are not
linear. Nevertheless, as we shall see much later, the study of LTI systems is a vital tool
in learning how to control even nonlinear systems. Essentially, feedback control algorithms
make small adjustments to the inputs based on measured outputs. For small deviations of
the input about some nominal input trajectory, the output of a nonlinear system looks like
a small deviation around some nominal output. The eects of the small input deviations on
the output is well approximated by a linear (possibly time-varying) system. It is therefore
essential to undertake a study of linear systems.
In this section, we review the solutions of linear, first-order dierential equations with time-
dependent forcing functions and constant coecients. The concepts of

stability

time-constant

sinusoidal steady-state

frequency response functions

are introduced. A significant portion of the remainder of the course generalizes these to
higher order, linear ODEs, with emphasis on applying these concepts to the analysis and
design of feedback systems.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 35

2 Solution of a First Order LTI ODE

Consider the following system

y(t)
+ a y(t) = b u(t) (3.2)

where u is the input, y is the dependent variable, and a and b are constant coecients (ie.,
numbers). Given the initial condition y(0) = yo and an arbitrary input function u(t) defined
on [0, ), the solution of Eq. (3.2) is given by
t
at
ys (t) = e y + ea(t ) b u( ) d . (3.3)
| {z }o
yh (t), free resp. | {z }
0

yp (t), forced resp.

The first term of the solution above is called the homogeneous solution yh (t). It is the part
of the output y that is due to the initial conditions only. It is also called the free response,
the zero-input response, or the initial-condition response.
The second term in the solution above is called the particular solution yp (t). This component
is due to the input u alone. It is also called the forced response, the zero-state response, or
the input response.
We can easily check that (3.3) is indeed the solution of (3.2) by verifying two facts: the
function ys satisfies the dierential equation for all t 0; and ys satisfies the given initial
condition at t = 0. The theory of dierential equations tells us that there is one and only
one function that satisfies both (existence and uniqueness of solutions). To verify, first check
the value of ys (t) at t = 0:
0
a0
ys (0) = e yo + ea(t ) b u( ) d = yo .
0

Taking the time derivative of (3.3) we obtain


{ t }
at d at
y s (t) = a e yo + e a
e b u( ) d
dt 0
t
at at
= a e yo a e ea b u( ) d +eat eat b u(t)
| {z 0 }
ays (t)

= a ys (t) + b u(t) .

as desired.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 36

3 The Free Response

We begin by plotting below the free response for various values of a. The values plotted
are a = [2 : 1/3 : 1]. Notice that the free response decays to zero if a > 0, approaches a
constant value if a = 0, and grows exponentially if a < 0.
3 1

2.5 0.8
2
0.6
1.5
0.4
1

0.5 0.2

0 0
0 1 2 3 0 1 2 3 4

Figure 25: The free response of a first-order system.

In the second panel, we have plotted the normalized free response when a > 0. More
precisely, we have plotted y(t)/yo versus at. The time
1
T :=
a
is called the time constant of a first order stable system ( a > 0). T is an indication of how
fast is the response of the system. The larger a, the smaller T and the faster the response
of the system.
Notice that
yh (T ) 1
= .37 = 37%
yo e
yh (2T ) 1
= 2 .13 10%
yo e
yh (3T ) 1
= 3 .05 = 5%
yo e

The calculations above states that the free response essentially decays to zero within three
time constants. This is a very useful rule-of-thumb to sketch responses to first-order-systems.
We will say that the system is stable if a > 0. This is a temporary definition, and we will
more formally explore stability in the next section. For now, its just our working definition.
What do we get from our idea of stability? As we observed earlier, if a system is stable, the
free response always decays to zero. This is because with u(t) = 0, we have

lim y(t) = lim eat yo = 0


t t
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 37

Another consequence of stability is that bounded5 inputs produce bounded outputs. To see
this, suppose |u(t)| Ku always. Then,

t t
at at a(t )

|y(t)| = e yo + ea(t )
bu( )d e yo + e bu( ) d
0 0
t
|yo | + Ku ea(t ) bd |yo | + Ku b = Ky
0

which establishes that y(t) is also bounded.


Henceforth. we shall assume that the first-order system under consideration is stable, i.e.
a > 0.
If a < 0 the free response of ODE (3.2) is unstable, i.e. limt |y(t)| = . When a = 0,
y(t) = yo and we say that this system is limitedly stable.

4 The Step Response

Now suppose the input is a step function:


{
0 t<0
u(t) =
uss t 0

We can use equation (3.3) to compute the output as


t
at buss ( )
y(t) = e yo + ea(t ) buss d = eat yo + 1 eat
0 a
b b
= eat yo uss eat + uss (3.4)
| {za } a
|{z}
ytr (t) yss (t)

Notice that the steady-state value of the step-response is


b
yss = lim y(t) = uss (3.5)
t a
so the steady-state gain to step inputs is b/a. This fact critically depends on our assumption
that the system is stable in order to have the transient response decay to zero.
5
A signal z(t) is called bounded if there exists a constant Kz such that

|z(t)| Kz < for all t

For example the signal z(t) = sin(t) is bounded, but the signal z(t) = t is not.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 38

0.5

0.5

1
response
1.5 input
2
0 2 4 6 8 10 12 14 16 18
Time (sec)

Figure 26: Response of the system y + y = u to step-like inputs.

The step response begins at yo and converges to yss exponentially with time constant T = 1/a.
Thus, after 3 time constants, i.e. t = 3/a, the response is within 95 % of (yss yo ). This fact
is very useful in sketching the response of first-order systems to inputs composed of steps of
various heights, as illustrated in Figure 26.

4.1 Linearity

Why is the dierential equation in (3.2) called a linear dierential equation? Suppose y1 is
the solution to the dierential equation with the initial condition y0,1 and forcing function u1 ,
and y2 is the solution to the dierential equation with the initial condition y0,2 and forcing
function u2 . In other words, the function y1 satisfies y1 (0) = y1,0 and for all t > 0,

y1 (t) + ay1 (t) = bu1 (t),

along with an analogous description for the solution y2 (dierent initial condition, dierent
forcing).
Now take two constants and . What is the solution to the dierential equation with
initial condition y(0) = y0,1 + y0,2 , and forcing function u(t) = u1 (t) + u2 (t)? It is easy
(just plug into the dierential equation, or the integral form of the solution) to see that the
solution is
y(t) = y1 (t) + y2 (t)
This is often called the superposition property. In this class, we will more typically use the
term linear, indicating that the solution of the dierential equation is a linear function of
the (initial condition, forcing function) pair.

5 The Sinusoidal Response

We now compute the response of a stable first-order LTI system to sinusoidal inputs. This
is important because any input may be decomposed via the Fourier Transform into a sum
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 39

of sinusoidal terms. Since the system under consideration is linear, the forced response is
simply the sum of the forced responses (weighted by the Fourier coecients) to the sinusoidal
terms. Studying the response of a first order system due to sinusoidal inputs will serve us
well in qualitatively understanding the response to general input signals.
Consider again the first-order system

y(t)
+ ay(t) = bu(t) with initial conditions y(0) = yo (3.6)

Let us again assume that this system is stable, i.e. a > 0.


Suppose that we apply a sinusoidal input to this system of the form
{
0 t<0
u(t) =
U sin(t) t 0

As before, we can use equation (3.3) to compute the output as


t
at
y(t) = e yo + ea(t ) bU sin( )d
0
bU at Ub
= eat yo + 2 2
e + 2 2
(a sin(t) cos(t)) (3.7)
| a{z + } |a + {z }
ytr (t) yss (t)

The response above is plotted together with the input in Figure 27 with a = U = 1, and
= 1.25. Notice that the transient response pretty much disappears within three time
constants (i.e. 3/a = 3 seconds), after which the total response y is indistinguishable from
the steady state response yss .

3
u
2 y
yss
1

0 2 4 6 8 10 12 14 16 18 20
Time (sec)

Figure 27: Sinusoidal response.

Observe that the response above has three terms: the first two decay to zero, and the third
persists in time. This observation rests on our assumption that the system is stable. The
components of the sinusoidal response that decay to zero are called the transient response,
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 40

while the component that persists in time is called the steady-state response. Lets look more
closely at the steady-state response. Using standard trigonometric identities 6 we can write
yss (t) = M ()U sin(t + )
where
b
M () = , () = Tan1 ( ) (3.8)
2
a + 2 a
This equation is extremely important. It says that

... if we apply a sine input of frequency to a stable first order system, in steady-
state the output will also be a sine wave. Moreover, it has the same frequency .
However, it will be amplified or attenuated with a gain M () and phase-shifted
by ().

It is quite easy to verify that the same result holds for cosine inputs also. The amplitude
gain M () and the phase shift () are called the frequency response of the stable first-order
LTI system (3.6).

6 The Frequency Response

It is very useful to plot the frequency response (3.8). In many physical systems the range of
frequencies we are interested in is quite broad, and the amplitude gain M () can have a wide
range of values. Experience has revealed that it is more informative7 to plot the magnitude
frequency response on a log-log scale, and the phase frequency response on a linear-log scale.
More precisely, engineers usually plot
20 log10 M () vs. log10 , and () vs. log10
The quantity 20 log10 M () occurs so commonly that it has its own units called decibels
which is abbreviated as db. The table of Figure 28 converts some gain values to decibels. It
is useful to remember that a ten-fold increase in the gain (i.e. an increase by a factor of 10)
corresponds to an increase of 20 db. Also, doubling the gain corresponds to an increase by
6 db.
In Figure 29, we plot the frequency response of the stable first-order system (3.6) that we
have derived in the previous section.
6
It is easy to verify that
A sin() + B cos() = A2 + B 2 sin( + )
where the phase oset is given by
B
= Tan1 ( )
A
7
This is particularly true for highly resonant systems.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 41

Magnitude (db)
10
M () 20 log10 M ()
.01 40 db 20

.1 20 db 30
1 0 db 40
2 6 db
5 14 db 20

Phase (deg)
10 20 db 40
20 26 db 60
50 34 db
80
100 40 db
0.1 1 10 100
Normalized Frequency /a (rad/sec)
Figure 28: Gain to
decibel conversions. Figure 29: Frequency response for first order system.

7 Problems

1. Use the integrating factor method to derive the solution given in equation (3.3) to the
dierential equation (3.2).
2. Suppose f is a piecewise continuous function. Assume A < B. Explain (with pictures,
or equations, etc) why B B

f (x)dx |f (x)| dx

A A
This simple idea is used repeatedly when bounding the output response in terms of
bounds on the input forcing function.
3. A stable first-order system (input u, output y) has dierential equation model
x(t)
= ax(t)
[ + bu(t) ]
= a x(t) a
b
u(t)
where a < 0 and b are some fixed numbers.
(a) Solve for the time-constant and steady-state gain in terms of a and b. Also,
invert these solutions, expressing a and b in terms of the time-constant and steady-
state gain.
(b) Suppose = 1, = 2. Given the initial condition x(0) = 4, and the input signal
u
u(t) = 1 for 0 t < 5
u(t) = 2 for 5 t < 10
u(t) = 6 for 10 t < 10.1
u(t) = 3 for 10.1 t < .
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 42

sketch a reasonably accurate graph of x(t) for t ranging from 0 to 20. The sketch
should be based on your understanding of a first-order systems response (using
its time-constant and steady-state gain), not by doing any particular integration.
(c) Now suppose = 0.001, = 2. Given the initial condition x(0) = 4, and the
input signal u
u(t) = 1 for 0 t < 0.005
u(t) = 2 for 0.005 t < 0.01
u(t) = 6 for 0.01 t < 0.0101
u(t) = 3 for 0.0101 t < .
sketch a reasonably accurate graph of x(t) for t ranging from 0 to 0.02. The
sketch should be based on your understanding of a first-order systems response,
not by doing any particular integration. In what manner is this the same as
the response in part 3b?

4. Consider the first-order linear system

x(t)
= A [x(t) u(t)]
1
with A < 0. Note that the system is stable, the time constant is c = A , and the
steady-state gain from u to x is 1. Suppose the input (for t 0) is a unit ramp input,
that is
u(t) = t
starting with an initial condition x(0) = x0 . Show that the solution for t 0 is

x(t) = t c + (x0 + c ) eat

Hint: you can do this in 2 dierent manners - carry out the convolution integral, or
verify that the proposed solution satisfies the initial condition (at t = 0) and satisfies
the dierential equation for all t > 0. Both are useful exercises, but you only need to
do one for the assignment. Note that if we ignore the decaying exponential part of the
solution, then the steady-state solution is also a unit-ramp, but it is delayed from
the input by c time units. This gives us another interpretation of the time-constant
of a first-order linear system (i.e., ramp-input leads to ramp-output, delayed by c ).

5. (a) Suppose > 0 and > 0. Let y1 (t) := sin t, and y2 (t) = sin(t ). Explain

what is meant by the statement that the signal y2 lags the signal y1 by 2 of a
period.
(b) Let := 3 . On 3 separate graphs, plot
i. sin 0.1t and sin(0.1t )
ii. sin t and sin(t )
iii. sin 10t and sin(10t )
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 43

(c) Explain how the graphs in part 5b confirm the claim in part 5a.
6. For the first-order linear system (constant coecients a, b, and c)
x(t)
= ax(t) + bu(t)
y(t) = cx(t)
(a) Using the convolution integral for the forced response, find the output y(t) for
t 0 starting from the initial condition x(0) = 0, subject to input
u(t) = 1 for t 0
u(t) = sin(t) for t 0
(b) For this first-order system, the frequency-response function G() is
cb
G() =
j a
Make a plot of
log10 |G()| versus log10
for 0.001 1000 for two sets of values: system S1 with parameters (a =
1, b = 1, c = 1) and system S2 with parameters (a = 10, b = 10, c = 1). Put
both magnitude plots on the same axis. Also make a plot of
G() versus log10
for 0.001 1000 for both systems. You can use the Matlab command angle
which returns (in radians) the angle of a nonzero complex number. Put both
angle plots on the same axis.
(c) What is the time-constant and steady-state gain of each system?
(d) For each of the following cases, compute and plot y(t) versus t for the :
i. S1 with x(0) = 0, u(t) = 1 for t 0
ii. S2 with x(0) = 0, u(t) = 1 for t 0
iii. S1 with x(0) = 0, u(t) = sin(0.1 t) for t 0
iv. S2 with x(0) = 0, u(t) = sin(0.1 t) for t 0
v. S1 with x(0) = 0, u(t) = sin(t) for t 0
vi. S2 with x(0) = 0, u(t) = sin(t) for t 0
vii. S1 with x(0) = 0, u(t) = sin(10 t) for t 0
viii. S2 with x(0) = 0, u(t) = sin(10 t) for t 0
Put cases (a), (b) on the same graph, cases (c), (d) on the same graph, cases
(e), (f) on the same graph and cases (g), (h) on the same graph. Also, on each
graph, also plot u(t). In each case, pick the overall duration so that the limiting
behavior is clear, but not so large that the graph is cluttered. Be sure and get
the steady-state magnitude and phasing of the response y (relative to u) correct.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 44

(e) Compare the steady-state sinusoidal responses of the response you computed and
plotted in 6d with the frequency-response functions that are plotted in part 6b. Il-
lustrate out how the frequency-response function gives, as a function of frequency,
the steady-state response of the system to a sin-wave input of any frequency. Mark
the relevant points of the frequency-response curves.

7. With regards to your answers in problem 6,

(a) Comment on the eect parameters a and b have on the step responses in cases
(a)-(b).
(b) Comment on the amplification (or attenuation) of sinusodal inputs, and its rela-
tion to the frequency .
(c) Based on the speed of the response in (a)-(b) (note the degree to which y follows
u, even though u has an abrupt change), are the sinusoidal responses in (c)-(h)
consistent?

8. Consider the first-order linear system (constant coecients A, B, C and D)

x(t)
= Ax(t) + Bu(t)
y(t) = Cx(t) + Du(t)

and assume that A < 0 (so the system is stable), B = A, C = 1 and D = 0. Let
:= A, so that the equations become

x(t)
= [u(t) x(t)]
y(t) = x(t)

Let the initial condition be x(0) = x0 . Let R be a given, fixed number. Suppose
that the input u is a sinusoid, for t 0 u(t) := sin t.

(a) (Trigonometry recap) Sketch a plot of tan(x) versus x, for all x R. Also, sketch
the inverse function tan1 (w) versus w for all w. Note that the inverse function
is multivalued, since for any angle and any integer n, tan () = tan ( + n).
From now on, when we refer to tan1 , we mean the function that for every
y R, 2 < tan1 (y) < 2 , and tan (tan1 (y)) = y.
(b) Find expressions M () and () such that

x,ss (t) = M () sin (t + ()) ,

where A() 0 for all . The angle will be known implicitly you will be
able to exactly describe what sin and what cos are. If you divide to write it
in tan1 form, make sure that you verify the rule we set out above.
(c) Numerically fill in the table below
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 45

M () ()
/1000
/100
/10

10
100
1000

(d) Pick several values for . Use MatLab to graph M () .vs. on a log-log plot
(log on the horizontal axis). In your graphs, choose min 1000 1
|A|, choose
max 1000|A|. Useful functions are logspace, loglog and ./ (period, slash).
On each graph, hand-draw in straightline approximations which come from the
entries in the table you derived above. Specifically, plot the 7 points, and connect
them with straight lines. Qualitatively, compare the straightline approximation
to the actual curves.
(e) Qualitatively explain how the function M () changes with parameter .
(f) Using the same values for , graph () .vs. on a linear()-log() plot. Quali-
tatively explain how the function () changes with . On each graph, hand-draw
in straightline approximations which come from the entries in the table you de-
rived above. Qualitatively, compare the straightline approximation to the actual
curves.
(g) So, consider the cascade connection of two, first-order, stable, systems

x 1 (t) = A1 x1 (t) + B1 u(t)


y1 (t) = C1 x1 (t) + D1 u(t)
x 2 (t) = A2 x2 (t) + B2 y1 (t)
y(t) = C2 x2 (t) + D2 y1 (t)

By stable, we mean both A1 < 0 and A2 < 0. The cascade connection is shown
pictorially below.

u y1 y
- S1 - S2 -

Suppose that the frequency response of System 1 is M1 (), 1 () (or just the
complex G1 ()), and the frequency response of System 2 is M2 (), 2 () (ie., the
complex G2 ()). Now, suppose that is a fixed real number, and u(t) = sin t.
Show that the steady-state behavior of y(t) is simply

y,ss (t) = [M1 ()M2 ()] sin (t + 1 () + 2 ())


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 46

(h) Let G denote the complex function representing the frequency response (forcing-
frequency-dependent amplitude magnification A and phase shift , combined into
a complex number) of the cascaded system. How is G related to G1 and G2 ?
Hint: Remember that for complex numbers G and H,

|GH| = |G| |H| , (GH) = G + H

9. Consider a first-order system P , with inputs (d, u) and output y, governed by

x(t)
= ax(t) + b1 d(t) + b2 u(t)
y(t) = cx(t)

A proportional control,
u(t) = K1 r(t) K2 ymeas (t)
is used, and the measurement is assumed to the be the actual value, plus measurement
noise,
ymeas (t) = y(t) + n(t)
As usual, y is the process output, and is the variable we want to regulate, r is the
reference signal (the desired value of y), d is a process disturbance, u is the control
variable, n is the measurement noise (so that y + n is the measurement of y), K1 and
K2 are gains to be chosen. For simplicity, we will choose some nice numbers for the
values, specifically b1 = b2 = c = 1. There will be two cases studied: stable plant,
with a = 1, and unstable plant, with a = 1. You will design the feedback gains
as described below, and look at closed-loop properties. The goal of the problem is to
start to see that unstable plants are intrinsically harder to control than stable plants.
This problem is merely a simple illustration of this fact, not a proof.

(a) Keeping a, K1 and K2 are variables, substitute for u, write the dierential equation
for x in the form

x(t)
= Ax(t) + B1 r(t) + B2 d(t) + B3 n(t)

Also, express the output y and control input u as functions of x and the external
inputs (r, d, n) as

y(t) = C1 x(t) + D11 r(t) + D12 d(t) + D13 n(t)


u(t) = C2 x(t) + D21 r(t) + D22 d(t) + D23 n(t)

Together, these are the closed-loop governing equations. Note that all of the
symbols (A, B1 , . . . , D23 ) will be functions of a and the controller gains. Below,
we will design K1 and K2 two dierent ways, and assess the performance of the
overall system.
(b) Under what conditions is the closed-loop system is stable? Under those conditions,
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 47

i. What is the time-constant of the closed-loop system?


ii. What is the steady-state gain from r to y (assuming d 0 and n 0)?
iii. What is the steady-state gain from d to y (assuming r 0 and n 0)?
(c) First we will consider the stable plant case, so a = 1. If we simply look at
the plant (no controller), u and d are independent inputs, and the steady-state
gain from d to y is cb
a
1
which in this particular instance happens to be 1. Find
the value of K2 so that: the closed-loop system is stable; and the magnitude of
the closed-loop steady-state gain from d to y is 15 of the magnitude of the open-
loop steady-state gain from d to y. That will be our design of K2 , based on this
disturbance rejection specification.
(d) With K2 chosen, choose K1 so that the closed-loop steady-state gain from r to y
is equal to 1 (recall, the goal is that y should track r, as r represents the desired
value of y).
(e) Next, we will assess the design in terms of the closed-loop eect that the external
inputs (r, d, n) have on two main variables of interest (y, u). For a change-of-pace,
we will look at the frequency-response functions, not time-domain responses. For
notational purposes, let Hvq denote the frequency-response function from a input
signal v to an output signal q (for example, from r to y). We will be making plots
of
|Hvq ()| vs and Hvq () vs
Specifically though, we will actually plot the magnitude on a log10 scale, frequency
on a log10 scale, and the angle on a linear scale, in radians. To do this, you
will use commands such as loglog, semilogx, abs and angle. As mentioned, the
plots will be arranged in a 2 3 array, organized as
|Hry |
|Hdy | |Hny |
Hry
|Hru |
|Hdu | |Hnu |
Hru
Note that because 2 of the entries actually have both the magnitude and angle
plotted, there will be 8 axes. If you forget how to do this, try the following
commands and see what happens in Matlab.
a11T = subplot(4,3,1);
a11B = subplot(4,3,4);
a12 = subplot(2,3,2);
a13 = subplot(2,3,3);
a21T = subplot(4,3,7);
a21B = subplot(4,3,10);
a22 = subplot(2,3,5);
a23 = subplot(2,3,6);
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 48

Plot the frequency-response functions. Use (for example) 100 logarithmically


spaced points for , varying from 0.01 to 100. Make the linetype (solid, black)
(f) Next we move to the unstable plant case, a = 1. In order make a fair compar-
ison, we need to make some closed-loop property similar to the previous cases
closed-loop property, and then compare other closed-loop properties. For the
unstable plant design, choose K1 and K2 so that
i. the closed-loop system is stable
ii. the time-constant is the same as the closed-loop time constant in the stable
plant case,
iii. the closed-loop steady-state gain from r to y is 1.
With those choices, plot the closed-loop frequency response functions on the ex-
isting plots, using (dashed/red) linetypes for comparison.
(g) Note that several curves are the same as the stable plant case. However in all
the other cases (d u, n y, n u) the unstable plant case has higher gains.
This means that in order to get the same r y tracking and d y disturbance
rejection, the system with the unstable plant uses more control input u, and is
more sensitive to noise at all frequencies.
(h) Look at the paper entitled Respect the Unstable by Gunter Stein. It is in the
IEEE Control Systems Magazine, August 2003, pp. 12-25. You will need to ignore
most of the math at this point, but there are some good paragraphs that reiterate
what I am saying here, and good lessons to be learned from the accidents he
describes. Please write a short paragraph about one of the accidents he describes.
10. Re-read Leibnitzs rule in your calculus book, and consider the time-varying dif-
ferential equation
x(t)
= a(t)x(t) + b(t)u(t)
with x(0) = xo . Show, by substitution, or integrating factor, that the solution to this
is
t
t
t
a()d
x(t) = e 0 xo + e a()d b( )u( )d
0

11. Suppose two systems are interconnected, with individual equations given as
= [u(t) y(t)]
S1 : y(t)
(3.9)
S2 : u(t) = 2 [y(t) r(t)]
(a) Consider first S1 (input u, output y): Show that for any initial condition y0 , if
u(t) u (a constant), then y(t) approaches a constant y, that only depends on
the value of u. What is the steady-state gain of S1 ?
(b) Next consider S2 (input (r, y), output u): Show that if r(t) r and y(t) y
(constants), then u(t) approaches a constant u, that only depends on the values
(
r, y).
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 49

(c) Now, assume that the closed-loop system also has the steady-state behavior
that is, if r(t) r, then both u(t) and y(t) will approach limiting values, u and
y, only dependent on r. Draw a block-diagram showing how the limiting values
are related, and solve for u and y in terms of r.
(d) Now check your answer in part 4c. Suppose y(0) = 0, and r(t) = 1 =: r for all
t 0. Eliminate u from the equations A.5, and determine y(t) for all t. Make a
simple graph. Does the result agree with your answer in part 4c?
Lesson: since the assumption we made in part 4c was actually not valid, the analysis
in part 4c is incorrect. That is why, for a closed-loop steady-state analysis to be based
on the separate components steady-state properties, we must know from other means
that the closed-loop system also has steady-state behavior.
12. Suppose two systems are interconnected, with individual equations given as
S1 : y(t)
= [u(t) + y(t)]
(3.10)
S2 : u(t) = 2 [r(t) y(t)]
(a) Consider first S1 (input u, output y): If u(t) u (a constant), then does y(t)
approach a constant y, dependent only on the value of u?
(b) Next consider S2 (input (r, y), output u): If r(t) r and y(t) y (constants),
then does u(t) approach a constant u, dependent only on the values r, y?
(c) Suppose y(0) = y0 is given, and r(t) =: r for all t 0. Eliminate u from the
equations A.6, and determine y(t) for all t. Also, plugging back in, determine u(t)
for all t. Show that y and u both have limiting values that only depend on the
value r, and determine the simple relationship between r and (y , u).
Lesson: Even though S1 does not have steady-state behavior on its own, in feedback
with S2 , the overall closed-loop system does.
13. Consider a first-order system P , with inputs (d, u) and output y, governed by
x(t)
= ax(t) + b1 d(t) + b2 u(t)
y(t) = cx(t)
(a) Assume P is stable (ie., a < 0). For P itself, what is the steady-state gain from
u to y (assuming d 0)? Call this gain G. What is the steady-state gain from d
to y (assuming u 0)? Call this gain H.
(b) P is controlled by a proportional controller of the form
u(t) = K1 r(t) + K2 [r(t) (y(t) + n(t))]
Here, r is the reference signal (the desired value of y), n is the measurement noise
(so that y + n is the measurement of y), K1 and K2 are gains to be chosen. By
substituting for u, write the dierential equation for x in the form
x(t)
= Ax(t) + B1 r(t) + B2 d(t) + B3 n(t)
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 50

Also, express the output y and control input u as functions of x and the external
inputs (r, d, n) as

y(t) = C1 x(t) + D11 r(t) + D12 d(t) + D13 n(t)


u(t) = C2 x(t) + D21 r(t) + D22 d(t) + D23 n(t)

All of the symbols (A, B1 , . . . , D23 ) will be functions of the lower-case given sym-
bols and the controller gains. Below, we will design K1 and K2 two dierent
ways, and assess the performance of the overall system.
(c) Under what conditions is the closed-loop system is stable? What is the steady-
state gain from r to y (assuming d 0 and n 0)? What is the steady-state
gain from d to y (assuming r 0 and n 0)?
(d) Design a feed-forward controller based on the steady-state gain G. In particular,
pick K1 := G1 , and K2 := 0. Note that we are now considering a feedback control
system that actually had no feedback (K2 = 0). Nevertheless, I refer to the system
as the closed-loop system.
i. For the closed-loop system, compute the steady-state gains from all external
inputs (r, d, n) to the two outputs (y, u).
ii. Comment on the steady-state gain from r y.
iii. What is the sensitivity of the steady-state gain from r y to the parameter
b2 ? Here you should treat K1 as a fixed number.
iv. Comment on the relationship between the open-loop steady-state gain from
d y (ie., H computed above) and the closed-loop computed in part 13(d)i.
v. Comment on the steady-state gain from d to u. Based on ds eventual eect
on u, is the answer in part 13(d)iv surprising?
vi. Comment on the steady-state gain from n to both y and u.
vii. What it the time-constant of the closed-loop system.
viii. In this part we have considered a feedback control system that actually had
no feedback (K2 = 0). So the closed-loop system is in fact an open-loop
system. Summarize the eect of the open-loop control strategy (called feed-
forward, since the control input is actually just a function of the reference
signal r, fed-forward to the process). In this summary, include a compar-
ison of the process time constant, and the closed-loop time constant, as well
as the tracking capabilities (how y follows r), the sensitivity of the tracking
capabilities to parameter changes, and the disturbance rejection properties.
(e) Now design a true feedback control system. Pick K2 so that the closed-loop
steady-state gain from d y is at least 5 times less than the uncontrolled steady-
state gain from d y (which we called H). Constrain your choice of K2 so that
the closed-loop system is stable. Since we are working fairly general, for simplicity,
you may assume a < 0 and b1 > 0, b2 > 0 and c > 0.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 51

i. With K2 chosen, pick K1 so that the closed-loop steady-state gain from r y


is 1.
ii. With K1 and K2 both chosen as above, what is the sensitivity of the steady-
state gain from r y to the parameter b2 ?
iii. What is the time-constant of the closed-loop system?
iv. What is the steady-state gain from d u? How does this compare to the
previous case (feedforward)?
v. With K2 = 0, does the noise n now aect y?
(f) Lets use specific numbers: a = 1, b1 = 1, b2 = 1, c = 1. Summarize all compu-
tations above in a table one table for the feedforward case, and one table for
the true feedback case. Include in the table all steady-state gains, time constant,
and sensitivity of r y to b2 .
(g) Plot the frequency responses from all external inputs to both outputs. Do this in
a 2 3 matrix of plots that I delineate in class. Use Matlab, and the subplot
command. Use a frequency range of 0.01 100. There should be two lines
on each graph.
(h) Indicate on the graph how the true feedback system accomplishes tracking, dis-
turbance rejection, and lower time-constant, but increased sensitivity to noise.
(i) Keeping K1 and K2 fixed, change b2 from 1 to 0.8. Redraw the frequency re-
sponses, now including all 4 lines. Indicate on the graph how the true feedback
system accomplishes good tracking that is more insensitive to process parameter
changes than the feedforward system.
14. Consider a system with input u, and output y governed by the dierential equation

y(t)
+ a1 y(t) = u(t)
+ b1 u(t) (3.11)

This is dierent than what we have covered so far, because the derivative of the input
shows up in the right-hand-side (the overall function forcing y, from the ODE point of
view).
(a) Let q(t) := y(t) u(t). By substitution, find the dierential equation governing
the relationship between u and q.
(b) Assume that the system is at rest (ie., y 0, u 0, and hence q 0 too),
and at some time, say t = 0, the input u changes from 0 to 1 (eg., a unit-step
function input). Solve for q, using the dierential equation found in part 14a
initial condition q(0) = 0.
(c) Since y = q + u, show that the step-response of 6.3 is
( )
b1 b1
y(t) = + 1 ea1 t
a1 a1
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 52

(d) Suppose that a1 > 0. Draw the step response for two cases: b1 = 0.9a1 and
b1 = 1.1a1 . Comment on the step response for 0 < a1 b1 . What happens if
a1 < 0 (even if b1 a1 , but not exactly equal)?
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 53

4 Review of SLODEs
Throughout this section, if y denotes a function (of time, say), then y [k] or y (k) denotes the
kth derivative of the function y,
dk y
y [k] = k
dt
In the case of k = 1 and k = 2, it will be convenient to also use y and y.

1 Linear, Time-Invariant Dierential Equations

Often, in this class, we will analyze a closed-loop feedback control system, and end up with
an equation of the form

y (n) (t) + a1 y (n1) (t) + + an y(t) = v(t) (4.1)

where y is some variable of the plant that is of interest to us, and v is a forcing function,
usually either a reference signal (ydes (t)) or a disturbance (ie., inclination of hill), or a
combination of such signals. One job of the control designer is to analyze the resulting
equation, and determine if the behavior of the closed-loop system is acceptable.
The dierential equation in (4.1) is called a forced, linear, time-invariant dierential equa-
tion. For now, associate the fact that the {ai }ni=1 are constants with the term time-invariant,
and the fact that the left-hand side (which contains all y terms) is a linear combination of y
and its derivatives with the term linear.
The right-hand side function, v, is called the forcing function. For a specific problem, it will
be a given, known function of time.
Sometimes, we are given an initial time t0 and initial conditions for dierential equation,
that is, real numbers
(n1)
y0 , y 0 , y0 , . . . , y0 (4.2)
and we are looking for a solution, namely a function y that satisfies both the dierential
equation (4.1) and the initial condition constraints
(n1)
y(t0 ) = y0 , y(t
0 ) = y 0 , y(t0 ) = y0 , . . . , y (n1) (t0 ) = y0 . (4.3)

For essentially all dierential equations (even those that are not linear, and not time-
invariant), there is a theorem which says that solutions always exist, and are unique:
Theorem (Existence and Uniqueness of Solutions): Given a forcing function v, defined
for t t0 , and initial conditions of the form (4.3). Then, there exists a unique function y
which satisfies the initial conditions and the dierential equation (4.1).
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 54

2 Importance of Linearity

Suppose that yP is a function which satisfies (4.1) so that


(n) (n1)
yP (t) + a1 yP (t) + + an yP (t) = v(t) (4.4)

and yH is a function which, for all t satisfies


(n) (n1)
yH (t) + a1 yH (t) + + an yH (t) = 0 (4.5)

yH is called a homogeneous solution of (4.1), and the dierential equation in (4.5) is called
the homogeneous equation. The function yP is called a particular solution to (4.1), since it
satisfies the equation with the forcing function in place.
The derivative of yP + yH is the sum of the derivatives, so we add the equations satisfied by
yP and yH to get

[yP + yH ](n) (t) + a1 [yP + yH ](n1) (t) + an [yP + yH ] (t) = v(t)

This implies that the function yP +yH also satisfies (4.1). Hence, adding a particular solution
to a homogeneous solution results in a new particular solution.
Conversely, suppose that yP1 and yP2 are two functions, both of which solve (4.1). Consider
the function yd := yP1 yP2 . Easy manipulation shows that this function yd satisfies the
homogeneous equation. It is a trivial relationship that
yP1 = yP2 + (yP1 yP2 )
= yP2 + yd

We have shown that any two particular solutions dier by a homogeneous solution. Hence
all particular solutions to (4.1) can be generated by taking one specific particular solution,
and adding to it every homogeneous solution. In order to get the correct initial conditions,
we simply need to add the right homogeneous solution.
Remark: The main points of this section rely only on linearity, but not time-invariance.

3 Solving Homogeneous Equation

Lets try to solve (4.5). Take a fixed complex number r C, and suppose that the function
yH , defined as
yH (t) = ert
(k)
is a solution to (4.5). Substituting in, using the fact that for any integer k > 0, yH (t) = rk ert ,
gives ( n )
r + a1 rn1 + + an ert = 0
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 55

for all t. Clearly, ert = 0, always, so it can be divided out, leaving

rn + a1 rn1 + + an = 0 (4.6)

Thus, if ert is a solution to the homogeneous equation, it must be that the scalar r satisfies
(4.6).
Conversely, suppose that r is a complex number which satisfies (4.6), then simple substitution
reveals that ert does satisfy the homogeneous equation.{ Moreover, if r is a} repeated root,
say l times, then substitution shows that the functions ert , tert , . . . , tl1 ert all satisfy the
homogeneous dierential equation. This leads to the following nomenclature:
Let r1 , r2 , . . . , rn be the roots of the polynomial equation

n + a1 n1 + + an = 0

This polynomial is called the characteristic polynomial associated with (4.1).


Fact 1 (requires proof ): If the {ri }ni=1 are all distinct from one another , then yH satisfies
(4.5) if and only if there exist complex constants c1 , c2 , . . . , cn such that


n
yH (t) = ci eri t (4.7)
i=1

Fact 2 (requires proof ): If the {ri }ni=1 are not distinct from one another, then group the
roots {r1 , r2 , , rn } as

p , p , . . . , p1 , p2 , p2 , . . . , p2 , , pf , pf , . . . , pf (4.8)
| 1 1{z } | {z } | {z }
l1 l2 lf

Hence, p1 is a root with multiplicity l1 , p2 is a root with multiplicity l2 and so on. Then yH
satisfies (4.5) if and only if there exist complex constants cij (i = 1, . . . f , j = 0, . . . li 1)
such that

f li 1
yH (t) = cij epi t tj (4.9)
i=1 j=0

So, Fact 2 includes Fact 1 as a special case. Both indicate that by solving for the roots of the
characteristic equation, it is easy to pick n linearly independent functions which form a basis
for the set of all homogeneous solutions to the dierential equation. Here, we explicitly have
used the time-invariance (ie., the coecients of the ODE are constants) to generate a basis
(the exponential functions) for all homogeneous solutions. However, the fact that the space
of homogenous solutions is n-dimensional only relies on linearity, and not time-invariance.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 56

Basic idea: Suppose there are m solutions to the homogeneous dierential equation, labeled
y1,H , y2,H , . . . , ym,H , with m > n. Then, look at the n m matrix of these solutions initial
conditions,
(0) (0) (0)
y1,H y2,H ym,H
(1)
y1,H y2,H ym,H
(1) (1)

M :=
.. .. .. ..
. . . .
(n1) (n1) (n1)
y1,H y2,H ym,H
Since m > n, this must have linearly dependent columns, so there is a nonzero m 1 vector
such that M = 0n1 . Define yz := 1 y1,H + 2 y2,H + + m ym,H . Since this is a sum
of homogeneous solutions, it itself is a homogeneous solution. Moreover, yz satisfies
yz(0) (t0 ) = 0, yz(1) (t0 ) = 0, , yz(n1) (t0 ) = 0
Note that the function yI (t) 0 for all t also satisfies the same initial conditions as yz , and
it satisfies the homogeneous dierential equation as well. By uniqueness of solutions, it must
be that yz (t) = yI (t) for all t. Hence, yz is actually the identically zero function. Hence, we
have shown that the set of homogeneous solutions is finite dimensional, and of dimension at
most n. Moreover, by the simple substitutions above, we already know how to construct n
linearly independent solutions to the homogeneous dierential equation, so those must form
a basis for all homogeneous solutions.
The reason that terms like tk ert appear for dierential equations whose characteristic equa-
tion has repeated roots is partially explored in Problem 6.

3.1 Interpretation of complex roots to ODEs with real-coecients

In all cases we consider, the dierential equation has real coecients (the a1 , a2 , . . . , an ).
This means that the characteristic equation has real coecients, but it does not mean that
the roots are necessarily real numbers (eg., even a real quadratic equation may have complex
roots). However, since the coecients are real, then complex roots will come in complex-
conjugate pairs, so if := + j is a root, and and are real numbers, and = 0, then
it will also be true that j is a root of the characteristic equation as well.
Given the roots, we know that all homogeneous solutions are given by equation 4.9, where the
constants vary over all choices of complex numbers. We will almost exclusively be interested
in solutions starting from real initial conditions, with real forcing functions, and hence will
only need to consider real homogeneous solutions. This raises the question of how to interpret
the complex functions et which arise when (a root) is complex.
Suppose 1 C is a complex root. Since the characteristic equation has real coecients,
it follows that that complex conjugate of 1 , 2 = 1 is also a root. Let and be real
numbers such that
1 = + j, 2 = j, = 0
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 57

The terms of the homogeneous solution associated with these roots are
c1 e1 t + c2 e2 t
where c1 and c2 are any complex numbers. We want to study under what conditions (on c1
and c2 ) will this function be purely real. Plugging in gives
c1 et [cos t + j sin t] + c2 et [cos t j sin t]
Regrouping gives
(et [(c1 + c2 ) cos t + j(c1 c2 ) sin t]
Since cos and sin are linearly independent functions, the only conditions for this to be a
purely real function is that c1 + c2 be real, and j(c1 c2 ) be real. This requires that c1 and
c2 be complex-conjugates of one another. In other words, for the function
c1 et [cos t + j sin t] + c2 et [cos t j sin t]
is real-valued, for all t if and only if c1 = c2 .
Let c2 be any complex number, and let c1 := c2 . Then c1 + c2 = 2A, where A is the real part
of c2 . Also, j(c1 c2 ) = 2B, where B is the imaginary part of c2 . Hence, the purely real
homogeneous solutions are of the form
et [2A cos t + 2B sin t]
where A and B are free real constants. Since they are free, it serves no purpose to write 2A
and 2B, and we can simply write that all real homogeneous solutions arising from the two
roots 1 = + j and 2 = j are
et [A cos t + B sin t]
where A and B are any real numbers.
With this is mind, we can rewrite a specialized version of Fact 2, for the case when the
coecients of the ODE are real, and we are interested in writing down a description of all
real homogeneous solutions.
Fact 3: Assume that all coecients a1 , a2 , . . . , an are real numbers. Group the n roots of
the characteristic equation as
p , p , . . . , p1 , , pd , pd , . . . , pd ,
| 1 1{z } | {z }
l1 ld
+ j1 , 1 + j1 , . . . , 1 + j1 , 1 j1 , 1 j1 , . . . , 1 j1 ,
|1 {z } | {z }
h1 h1 (4.10)
..
.
c + jc , c + jc , . . . , c + jc , c jc , 1 jc , . . . , c jc
| {z } | {z }
hc hc
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 58

where each p, and are real, and each = 0. Then yH is a real-valued function which
satisfies (4.5) if and only if there exist real constants cij (i = 1, . . . d, j = 0, . . . li 1), Aks , Bks
(k = 1, . . . c, s = 0, . . . hk 1)such that


d
li 1 k 1
c h
pi t j
yH (t) = cij e t + ek t ts [Aks cos k t + Bks sin k t] (4.11)
i=1 j=0 k=1 s=0

4 General Solution Technique

The general technique (conceptually, at least) for finding particular solutions of (4.1) which
also satisfy the initial conditions is a combination of all of the above ideas. It is very
important conceptually, and somewhat important in actual use.

1. Find any particular solution yP


2. Choose constants cij so that the function


f li 1
yP (t) + cij tj epi t
i=1 j=0

satisfies the initial conditions.

The resulting function is the solution. Note that in step 2, there are n equations, and n
unknowns.

5 Behavior of Homogeneous Solutions as t

In this section, we study the behavior of the class of homogeneous solutions as t . If we


can show that all homogeneous solutions decay to 0 as t , then it must be that for a give
forcing function, all particular solutions, regardless of the initial conditions, approach each
other. This will be useful in many contexts, to quickly understand how a system behaves.
Suppose r is a complex number, r C, and we decompose it into its real and imaginary
parts. Let := Real(r) and := Imag(r).
Hence, both and are real numbers, and
r = + j. We will always use j := 1. The exponential function ert can be expressed as

ert = et [cos t + j sin t]

Note that the real part of r, namely , determines the qualitative behavior of ert as t .
Specifically,
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 59

if < 0, then limt ert = 0


if = 0, then ert does not decay to 0, and does not explode, but rather oscillates,
with |ert | = 1 for all t
if > 0, then limt |ert | =

When all of the roots of the chracteristic polynomial are distinct, all homogeneous solu-
tions are of the form ert where r is a root of the characteristic polynomial. Therefore, we
see that the roots of the characteristic polynomial determine the qualitative nature of the
homogeneous solutions.
If the characteristic polynomial has a root rp of multiplicity lp 1, then according to Eq.
(4.9), the homogeneous solution modes associated the root rp are

erp t , t erp t , , t(lp 1) erp t .

Notice that for any real constants m < , and < 0,

lim tm et = 0 .
t

Therefore, the real part of the repeated root rp , namely p , also determines the qualitative
behavior of the homogeneous solution modes associated with this repeated root as t .
Specifically,

if p < 0, then limt tm erp t = 0 for m = 0, lp 1.


if p = 0, then |erp t | = 1 for all t, but
if p 0, then limt |tm ert | = for m = 1, lp 1

where lp 1 is the multiplicity of the root rp .


We summarize all of these results as follows:

If all of the roots, {ri }ni=1 , of the characteristic polynomial satisfy

Real(ri ) < 0

then every homogeneous solution decays to 0 as t .


If any of the roots, {ri }ni=1 , of the characteristic polynomial satisfy

Real(ri ) 0

then there are homogeneous solutions that do not decay to 0 as t .


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 60

6 Response of stable system to constant input (Steady-State Gain)

Suppose the system (input u, output y) is governed by the SLODE

y [n] (t) + a1 y [n1] (t) + + an1 y [1] (t) + an y(t)


= b0 u[n] (t) + b1 u[n1] (t) + + bn1 u[1] (t) + bn u(t)

Suppose initial conditions for y are given, and that the input u is specified to be a constant,
u(t) u for all t t0 . What is the limiting behavior of y?
If the system is stable, then this is easy to compute. First notice that the constant function
yP (t) abnn u is a particular solution, although it does not satisfy any of the initial conditions.
The actual solution y diers from this particular solution by some homogeneous solution,
yH . Hence for all t,
y(t) = yP (t) + yH (t)
bn
= u + yH (t)
an
Now, take limits, since we know (by the stability assumption) that limt yH (t) = 0, giving

bn
lim y(t) = u
t an
bn
Hence, the steady-state gain of the system is .
an
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 61

7 Example

Consider the dierential equation

y(t) + 4y(t)
+ y(t) = 1 (4.12)

subject to the initial conditions y(0) = y0 , y(0)


= y 0 . The characteristic equation is 2 +
4 + 1 = 0, which has roots at

= 2 3 {3.7, 0.3}

Hence, all homogeneous solutions are of the form

yH (t) = c1 e3.7t + c2 e0.3t

Terms of the form e3.7t take about 0.8 time units to decay, while terms of the form e0.3t
take about 10 time units to decay. In general then (though not always - it depends on the
initial conditions) homogeneous solutions will typically take about 10 time units to decay.
A particular solution to (4.12) is simply yP (t) = 1 for all t 0. Note that this choice of yP
does not satisfy the initial conditions, but it does satisfy the dierential equation.
As we have learned, all solutions to (4.12) are any particular solution plus all homogeneous
solutions. Therefore, the general solution is

y(t) = 1 + c1 e(2 3)t
+ c2 e(2+ 3)t

which has as its derivative



= (2
y(t) 3)c1 e(2 3)t + (2 + 3)c2 e(2+ 3)t

Evaluating these at t = 0, and equating to the given initial conditions yields


y(0) = 1 + c1 + c2
= y(0 ) ( )
y(0)
= 2 3 c1 + 2 + 3 c2
= y 0

In matrix form, we have


[ ][ ] [ ]
1 1 c1 y0 1
=
2 3 2 + 3 c2 y 0

This is easy to invert. recall


[ ]1 [ ]
a b 1 d b
=
c d ad bc c a
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 62

Hence [ ]1 [ ]
1 1 1 2 + 3 1
=
2 3 2 + 3 2 3 2+ 3 1
so that [ ] [ ]1 [ ]
1 c1 1 y0 1
=
2 3 2 + 3
c2 y 0
For the case at hand, lets take y0 := 0, y 0 := 0, hence
[ ] [ ]
c1 1 2 3
=
c2 2 3 2 3
A plot of y(t) is shown in the figure below.
1

0.9

0.8

0.7

0.6
Response, y(t)

0.5

0.4

0.3

0.2

0.1

0
0 5 10 15
Time, t

Note that indeed, as we had guessed, the homogeneous solution (which connects the initial
values at t = 0 to the final behavior at t takes about 10 time units to decay.

8 Stability Conditions for 2nd order dierential equation

Given real numbers a0 , a1 and a2 , with a0 = 0, we wish to determine if the roots of the
equation
a0 2 + a1 + a2 = 0
have negative real parts. This question is important in determining the qualitative nature
(exponential decay versus exponential growth) of the homogeneous solutions to
a0 y(t) + a1 y(t)
+ a2 y(t) = 0
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 63

Since a0 = 0 (so that we actually do have a quadratic, rather than linear equation) divide
out by it, giving
a1 a2
y(t) + y(t)
+ y(t) = 0
a0 a0
a1 a2
Call b1 := ,b
a0 2
:= a0
. The characteristic equation is 2 + b1 + b2 = 0. The roots are

b1 + b21 4b2 b1 b21 4b2
1 = , 2 =
2 2
Consider 4 cases:

1. b1 > 0, b2 > 0. In this case, the term b21 4b2 < b21 , hence either

b21 4b2 is imaginary

b21 4b2 is real, but b21 4b2 < b1 .

In either situation, both Re(1 ) < 0 and Re(2 ) < 0.

2. b1 0: Again, the square-root is either real or imaginary. If it is imaginary,


2 then
b + b 4b
Re(i ) = b2 1 0. If the square-root is real, then then Re(1 ) = 0. In
1 1 2
2
either case, at least one of the roots has a nonnegative real part.

2 0: In this case, the square root is real, and hence both roots are real. However,
3. b
b21 4b2 |b1 |, hence 1 0. so one of the roots has a non-negative real part.

This enumerates all possibilities. We collect these ideas into a theorem.


Theorem: For a second order polynomial equation 2 +b1 +b2 = 0, the roots have negative
real parts if and only if b1 > 0, b2 > 0.
If the leading coecient is not 1, then we have
Theorem (RH2): For a second order polynomial equation b0 2 + b1 + b2 = 0, the roots
have negative real parts if and only if all of the bi are nonzero, and have the same sign
(positive or negative).
WARNING: These theorems are not true for polynomials with order higher than 2. We
will study simple methods to determine if all of the roots have negative real parts later. For
instance;
Theorem (RH3): For a third order polynomial equation 3 + b1 2 + b2 + b3 = 0, all of
the roots have negative real parts if and only if b1 > 0, b3 > 0 and b1 b2 > b3 .
Note that the condition b1 b2 > b3 , coupled with the first two conditions, certainly implies
that b2 > 0. However, the simpler conditions {b1 > 0, b2 > 0, b3 > 0} are only necessary, not
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 64

sucient, as an example illustrates: the roots of 3 + 2 + + 3 are {1.575, 0.2874 j1.35}.


So, use the exact conditions in theorem RH3 to determine the stability of a 3rd order system
by simple examination of its characteristic equation coecients.
Theorem (RH4): For a fourth order polynomial equation 4 +b1 3 +b2 2 +b3 +b4 = 0, all
of the roots have negative real parts if and only if b1 > 0, b4 > 0, b1 b2 > b3 and (b1 b2 b3 )b3 >
b21 b4 .
These theorems are specific examples of the Routh-Hurwitz theorem which is often taught in
undergraduate control courses. The Routh-Hurwitz theorem, proven around 1880, indepen-
dently by Routh and Hurwitz, is interested in the determining if all roots of the polynomial
equation
n + b1 n1 + + bn1 + bn = 0
have negative real-parts. The theorem states that all roots have negative real parts if and
only if n simple inequalities, involving polynomial expressions of the coecients (the bk ) are
satisfied. Note that the theorem does not find the roots - it merely proves, unequivocally, that
the roots all lie in the open, left-half plane if and only if some easy-to-evaluate expressions,
involving the coecients, are negative. There is a pattern by which one can simply derive
what the polynomial inequalities are. The three theorems above (RH2, RH3, and RH4)
give the inequalities for n = 2, n = 3 and n = 4, respectively. As you notice, the conditions
become more complex with increasing order. For systems beyond 4th order, it is not clear how
useful (beyond the theoretical elegance) the formula are, especially in the context of modern
laptop computational power, where high-quality root-finding programs are easily accessible
(eg., Matlab, Mathematica, etc). We encourage the student to memorize the 2nd, 3rd and
4th order conditions and through their use, determine if knowing higher-order versions would
be useful. The interested student can find more information about Routh-Hurwitz on the
web.

9 Important 2nd order example

It is useful to study a general second order dierential equation, and interpret it in a dierent
manner. Start with

y(t) + a1 y(t)
+ a2 y(t) = bv(t) (4.13)

with y(0) = 0, y(0)


= 0 and v(t) = 1 for all t 0. Assume that the homogeneous solutions
are exponentially decaying, which is equivalent to a1 , a2 > 0. Rewrite using new variables
(instead of a1 and a2 ) , n as

+ n2 y(t) = bv(t)
y(t) + 2n y(t)
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 65

where both , n > 0. In order to match up terms here, we must have


2n = a1 , n2 = a2
which can be inverted to give
a1
= , n = a2
2 a2
Note that since a1 , a2 > 0, we also have , n > 0. With these new variables, the homoge-
neous equation is
+ n2 y(t) = 0
y(t) + 2n y(t)
which has a characteristic polynomial
2 + 2n + n2 = 0
The roots are at
= n n 2 1
= n jn 1 2
There are three cases to consider:

> 1: Roots are distinct, and both roots are real, and negative. The general homoge-
neous solution is most easily written in the form
( ) ( )
n +n 2 1 t n n 2 1 t
yH (t) = c1 e + c2 e

= 1, which results in repeated real roots, at = n , so that the general form of


homogeneous solutions are
yH (t) = c1 en t + c2 ten t

0 < < 1: Roots are distinct, and complex (complex-conjugate pair), with negative
real part, and the general homogeneous solution is easily expressable as
[ ] [ ]
n +jn 1 2 t n jn 1 2 t
yH (t) = c1 e + c2 e
This can be rewritten as
[ ]
n t jn 1 2 t jn 1 2 t
yH (t) = e c1 e + c2 e

Recall ej = cos + j sin . Hence


[ ]
n t c1 cos n1 2 t + jc1 sin n 1 2 t
yH (t) = e
+c2 cos n 1 2 t jc2 sin n 1 2 t
which simplifies to
[ ]
n t
yH (t) = e (c1 + c2 ) cos n 1 2t + j(c1 c2 ) sin n 1 2t
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 66

For a general problem, use the initial conditions to determine c1 and c2 . Usually, the initial
conditions, y(0), y(0),
are real numbers, the dierential equation
coecients (a
1 , a2 or , n )
are real, hence the solution must be real. Since cos n 1 t and sin n 1 2 t are
2

linearly independent functions, it will always then work out that

c1 + c2 = purely real
c1 c2 = purely imaginary

In other words, Im(c1 ) = Im(c2 ), and Re(c1 ) = Re(c2 ), which means that c1 is the complex
conjugate of c2 .
Under this condition, call c := c1 . The homogeneous solution is
[ ]
yH (t) = en t 2Re(c) cos n 1 2 t 2Im(c) sin n 1 2 t

Use A := 2Re(c), and B := 2Im(c), and the final form of the real homogeneous solution is
[ ]
yH (t) = en t A cos n 1 2 t + B sin n 1 2 t

A and B are two, free, real parameters for the real homogeneous solutions
when 0 < < 1.
Of course, it is true that n is the real part of the roots, and n 1 is the imaginary
2

part.
The solution is made up of two terms:

1. An exponentially decaying envelope, en t . Note that this decays to zero in approxi-


mately 3n

2. sinosoidal oscillation terms, sin n 1 2 t and cos n 1 2 t. The period of oscil-
lation is 2 2 .
n 1

Comparing these times, we expect alot of oscillations before the homogeneous solution
decays if
2 3
<<
n 1 2 n
Clearly n drops out of this comparison, and the above condition is equivalent to
2
<< 1
3 1 2

This quantity is very small if and only if is very small, in which case there are many
oscillations in the homogeneous solutions, and the system associated with the dierential
equation is called lightly damped. The quantity is called the damping ratio.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 67

If 2
3
<< 1, then homogeneous solutions look like
1 2

Typical Lightly Damped Response

Response

Time

Conversely, if 2
3
>> 1, then then homogeneous solutions look like
1 2
Typical Heavily Damped Response
Response

Time

A moderate value of , say 0.7 gives homogeneous responses that look like the figure
below.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 68

Typical Moderately Damped Response

Response

Time

Another way to look at this is to consider the quotient


Time to decay
N :=
Period of oscillation
If N is 4, one would expect to see 4 periods of oscillation before the homogeneous solution
has significantly decayed (since the time it takes to decay is about 4 periods). By contrast, if
N = 0.5, then one would expect to see about 21 of a period of oscillation before the solution
has decayed. We can compute N , in terms of and n , namely
3
n 3 1 2
N = 2 =
2
2
1

The quantity N is graphed, as a function of . Typical plots of homogeneous solutions are


plotted for 5 cases. The corresponding value of N matches quite nicely with the number of
visible oscillations in the solution.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 69

10

7
N := Period/TTD

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Finally, note that n enters yH very simply,


[ ]
yH (t) = en t A cos n 1 2 t + B sin n 1 2 t

Note, everywhere n or t appear, they appear together in a term n t. Hence, n simply


scales the response yH (t) in t. The larger value of n , the faster the response.
For a constant input v(t) v, it is easy to write down a particular solution to

y(t) + a1 y(t)
+ a2 y(t) = bv(t)

Note that yP (t) = ab2 v satisfies the dierential equation. Hence, the actual solution (which
must also satisfy the initial conditions) is of the form

b [ ]
v + en t A cos n 1 2 t + B sin n 1 2 t
a2
where A and B are chosen suitably to satisfy the initial conditions. So, the homogeneous
solutions connect the initial conditions to the final conditions. In this case,
b
lim y(t) = v, lim y(t)
=0
t a2 t

Shown in Fig. 30 below are plots for b = n2 (so that a2 = b), v = 1, with taking on values
between 0.1 and 10.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 70

Step response of 2nd order system


1.8

1.6

1.4

1.2
Response, y

0.8

0.6 Increasing x
0.4

0.2

0
0 1 2 3 4 5 6 7 8 9 10
Normalized time, w_n t

Figure 30: Step response of a second order system for varying values of damping ratio .
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 71

10 Problems

1. Consider the dierential equation

y(t) + 3y(t)
+ 3y(t) = 0 (4.14)

Let yH,1 (t) := 2et e2t , and yH,2 (t) := et e2t .

(a) Compute yH,1 (0) and y H,1 (0). Plot yH,1 (t) versus t. Show that the function yH,1
satisfies the dierential equation in (4.14).
(b) Compute yH,2 (0) and y H,2 (0). Plot yH,2 (t) versus t. Show that the function yH,2
satisfies the dierential equation in (4.14).
(c) What is the solution to the ODE with initial conditions y(0) = 6, y(0)
= 4?

2. Consider the example equation from Section 7, y(t) + 4y(t) + y(t) = 1, with initial
conditions y(0) = y0 , y(0)
= v0 . Consider all possible combinations of initial conditions
from the lists below:
y0 = {2, 1, 0, 1, 2}
and
v0 = {2, 1, 0, 1, 2}
(Now, do part (a) first!)

(a) Note that without explicitly solving the dierential equation, one can easily com-
pute 4 things: limiting value of y (as t ), time constant of the slowest
homogeneous solution, initial value (given) and initial slope (given). With these
numbers, carefully sketch on graph paper how you think all 25 solutions will look.
(b) In the notes, the solution is derived for general initial conditions. Use Matlab (or
similar) to plot these expressions. Compare to your simplistic approximations in
part 2a.

3. The response (with all appropriate initial conditions set to 0) of the systems listed
below is shown. Match the ODE with the solution graph. Explain your reasoning.

(a) y(t)
+ y(t) = 1
(b) y(t)
+ 5y(t) = 5
(c) y(t) + 2y(t)
+ y(t) = 1
(d) y(t) 2y(t)
y(t) = 1
(e) y(t) 2y(t)
+ 9y(t) = 9
(f) y(t) + 0.4y(t)
+ y(t) = 1
(g) y(t) + 0.12y(t)
+ 0.09y(t) = 0.09
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 72

(h) y(t) + 11y(t)


+ 10y(t) = 10
(i) y(t) + 0.3y(t)
+ 0.09y(t) = 0.09
(j) y(t) + 3y(t)
+ 9y(t) = 9
(k) y(t) + 4.2y(t)
+ 9y(t) = 9
(l) y(t) + 0.2y(t)
+ y(t) = 1
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 73

2 1

1 0.5

0 0
0 20 40 60 80 100 0 2 4 6
1 2

0.5 1

0 0
0 2 4 6 0 10 20 30
1 5

0
0.5
5

0 10
0 0.5 1 1.5 0 0.5 1 1.5 2 2.5
2 1.5

1
1
0.5

0 0
0 20 40 60 0 10 20 30 40
1.5 0

1 0.5

0.5 1

0 1.5
0 1 2 3 0 0.2 0.4 0.6 0.8 1
1 1.5

1
0.5
0.5

0 0
0 2 4 6 0 1 2 3 4

4. Consider the homogeneous dierential equation


y [3] (t) + 9
y (t) + 24y(t)
+ 20y(t) = 0
(a) What is the characteristic polynomial of the ODE?
(b) What are the roots of the characteristic polynomial.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 74

(c) Write the general form of a homogeneous solution. Explain what are the free
parameters.
(d) Show, by direct substitution, that yH (t) = te2t is a solution.
(e) Show, by direct substitution, that yH (t) = t2 e2t is not a solution.
(f) Find the solution which satisfies initial conditions y(0) = 3, y(0)
= 1, y [2] (0) = 0.
(g) Find the solution which satisfies initial conditions y(0) = 3, y(0)
= 1, y [3] (0) = 0.
5. Suppose a < 0, and consider the function teat for t 0.
(a) For what value of t does the maximum occur?
(b) At what value(s) of t is the function equal to 0.05 of its maximum value. For
comparison, recall that for the function eat , the function is equal to 0.05 of the
3
maximum value at about a .
1 k+1 t
6. (a) Suppose C and k 0 is an integer. Show that x(t) := k+1
t e is a
solution to the dierential equation
+ x(t) = tk et
x(t)
(b) Suppose y and z satisfy the dierential equations
z(t)
+ z(t) = y(t), y(t)
+ y(t) = 0
Eliminate y, and find a 2nd-order dierential equation governing z
(c) Suppose q satisfies the dierential equation
+ 2 q(t) = 0
q(t) + 2q(t)
Define r(t) := q(t)
+ q(t). What dierential equation does r satisfy? Hint:
What is r(t)
+ r(t)
7. In section 9, we considered dierential equations of the form
y(t) + a1 y(t)
+ a2 y(t) = bv(t).

If a1 > 0 and a2 > 0, and a1 < 2 a2 , then we chose to write the solution in terms of
the (n , ) parameters, which are derived from a1 and a2 .
If the forcing function v is a constant, v(t) v, we derived that all particular solutions
are of the form
b [ ]
v + en t A cos n 1 2 t + B sin n 1 2 t
a2
where A and B are free parameters.
Suppose the initial conditions are y(0) = y0 and y(0)
= y 0 . Find the correct values for
A and B so that the initial conditions are satisfied. Your answer should be in terms of
the given initial conditions, and system parameters (n , , b).
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 75

8. Suppose that 0 < < 1, and > 0.

(a) What are the roots of the equation

s2 + 2n s + n2 = 0

(b) Let be the complex number



:= n + jn 1 2

(note that this is one of the roots you computed above). Show that || = n ,
regardless of 0 < < 1.
(c) The complex number is plotted in the complex plane, as shown below.
Im
6 C
A
A
A
A Re
-

Express sin in terms of and n .

9. The cascade of two systems is shown below. The relationship between the inputs and
outputs are given. Dierentiate and eliminate the intermediate variable v, obtaining a
dierential equation relationship between u and y.
u v- y S2 : y(t)
+ c1 y(t) = d1 v(t)
- S1 S2 -
S1 : v(t) + a1 v(t)
+ a2 v(t) = b1 u(t)
+ b2 u(t)
Repeat the calculation for the cascade in the reverse order, as shown below.
u v- y S2 : v(t)
+ c1 v(t) = d1 u(t)
- S2 S1 -
S1 : y(t) + a1 y(t)
+ a2 y(t) = b1 v(t)
+ b2 v(t)

10. Compute (by analytic hand calculation) and plot the solutions to the dierential equa-
tions below. Before you explicitly solve each dierential equation, make a table listing

each root of the characteristic equation


the damping ratio , and natural frequency n for each pair (if there is one) of
complex roots.
the final value of y, ie., limt y(t).
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 76

for each case. For the plots, put both cases in part (a) on one plot, and put both cases
for part (b) on another plot.
3 ( ) ( )
(a) i. dtd 3 y(t) + 1 + 10 2 y(t) + 100 + 10 2 y(t) + 100y(t) = 100u(t), subject
to the initial conditions y(0) = y(0)
= y(0) = 0, and u(t) = 1 for all t > 0.
Hint: One of the roots to the characteristic equation is 1. Given that you
can easily solve for the other two.
ii. y(t)
+ y(t) = u(t) subject to the initial conditions y(0) = 0, and u(t) = 1 for
all t > 0.
d3
(b) i. dt3
y(t)
+ 10.6 y (t) + 7y(t)
+ 10y(t) = 10u(t), subject to the initial conditions
y(0) = y(0)
= y(0) = 0, and u(t) = 1 for all t > 0. Hint: One of the roots to
the characteristic equation is 10.
ii. y(t) + 0.6y(t)
+ y(t) = u(t), subject to the initial conditions y(0)
= y(0) = 0,
and u(t) = 1 for all t > 0.

11. We have studied the behavior of the first-order dierential equation

x(t)
= 1 x(t) + 1 u(t)
v(t) = x(t)

which has a time-constant of , and a steady-state gain (to step inputs) of 1. Hence,
if is small, the output v of system follows u quite closely. For slowly-varying
inputs u, the behavior is approximately v(t) u(t).

(a) With that in mind, decompose the dierential equation in (10)(a)(i) into the
cascade of
i. a fast 2nd order system, with steady-state gain equal to 1
ii. slow first order system whose steady-state gain is 1.
Is one of these decomposed systems similar to the system in (10)(a)(ii)? Are the
two plots in (10)(a) consistent with your decomposition?
(b) Do a similar decomposition for (10)(b)(i), and again think/comment about the
response of the 3rd order system in (10)(b)(i) and the 2nd order systems response
in (10)(b)(ii).

12. (a) Suppose is a fixed real number. If p(s) is a nth order polynomial, with roots
1 , 2 , . . . , n , what are the roots of the nth order polynomial g(s) defined by

g(s) := p(s )

(b) Do all of the roots of s3 + 7s2 + 22s + 16 have real parts less than 0?
(c) Do all of the roots of s3 + 7s2 + 22s + 16 real parts less than 1?
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 77

Summary for SLODEs

1 Main Results
SLODEs have the form
y (n) (t) + a1 y (n1) (t) + + an y(t) = bv(t) (4.15)

A key role is played by the roots r1 , r2 , . . . , rn of the polynomial equation


n + a1 n1 + + an = 0
This polynomial is called the characteristic polynomial associated with the dierential
equation.
If the {ri }ni=1 are all distinct from one another, then the homogenous solution yH is

n
yH (t) = ci eri t (4.16)
i=1

If the {ri }ni=1 are not distinct from one another, then the homogenous solution yH is


f li 1
yH (t) = cij epi t tj (4.17)
i=1 j=0

where we have grouped the roots {r1 , r2 , , rn } as


p1 , p1 , . . . , p1 , p2 , p2 , . . . , p2 , , pf , pf , . . . , pf (4.18)
| {z } | {z } | {z }
l1 l2 lf

Hence, p1 is a root with multiplicity l1 , p2 is a root with multiplicity l2 and so on.


If the input u is constant (u(t) u for all t t0 ) and the system is stable, then a
particular solution is

b
yP (t) = u
an
For stable systems limt yH (t) = 0, and therefore since y(t) = yP (t) + yH (t)
b
lim y(t) = u
t an
bn
Hence, the steady-state gain of the system is .
an
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 78

2 General Solution Technique


1. Find any particular solution yP
2. Choose constants cij so that the function

f li 1
yP (t) + cij tj epi t
i=1 j=0

satisfies the initial conditions.

The resulting function is the solution. Note that in step 2, there are n equations, and n
unknowns.

3 Behavior of Homogeneous Solutions as t


If all of the roots, {ri }ni=1 , of the characteristic polynomial satisfy
Real(ri ) < 0
then every homogeneous solution decays to 0 as t (THE SYSTEM IS STA-
BLE)
If any of the roots, {ri }ni=1 , of the characteristic polynomial satisfy
Real(ri ) 0
then there are homogeneous solutions that do not decay to 0 as t (THE
SYSTEM IS UNSTABLE)
For stable systems, the time constant T is
1
T =
mini=1,...,n |Real(ri )|

4 Stability of Polynomials
Theorem (RH2): For a second order polynomial equation b0 2 + b1 + b2 = 0, the
roots have negative real parts if and only if all of the bi are nonzero, and have the same
sign (positive or negative).
Theorem (RH3): For a third order polynomial equation 3 + b1 2 + b2 + b3 = 0, all
of the roots have negative real parts if and only if b1 > 0, b3 > 0 and b1 b2 > b3 .
Theorem (RH4): For a fourth order polynomial equation 4 +b1 3 +b2 2 +b3 +b4 =
0, all of the roots have negative real parts if and only if b1 > 0, b4 > 0, b1 b2 > b3 and
(b1 b2 b3 )b3 > b21 b4 .
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 79

5 2nd order dierential equation


General form is
y(t) + a1 y(t)
+ a2 y(t) = bv(t) (4.19)

For stable systems (a1 > 0, a2 > 0), rewrite using new variables , n as

+ n2 y(t) = bv(t)
y(t) + 2n y(t)

where both , n > 0.

We have
2n = a1 , n2 = a2
which can be inverted to give
a1
= , n = a2
2 a2

Note that since a1 , a2 > 0, we also have , n > 0.

The characteristic polynomial

2 + 2n + n2 = 0

The roots are at


= n n 2 1
= n jn 1 2

6 Solutions of 2nd order dierential equation


> 1: Roots are distinct, and both roots are real, and negative.
( ) ( )
n +n 2 1 t n n 2 1 t
yH (t) = c1 e + c2 e
3
Settling time (Time to decay)=
|n +n 2 1|

= 1: Roots are repeated real at = n ,

yH (t) = c1 en t + c2 ten t
3
Settling time (Time to decay)= n
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 80

0 < < 1: Roots are distinct, and complex (complex-conjugate pair), with negative
real part [ ]

yH (t) = en t A cos n 1 2 t + B sin n 1 2 t
or equivalently
[ ]
n t
yH (t) = e (A + B ) sin(n 1 t + )
2 2 2

where = atan(A/B)
3
Settling time (Time to decay)= n

The period of oscillation = 2 .


n 1 2

The number of oscillations that can be observed (during the settling time) is

Time to decay 3 1 2
N := =
Period of oscillation 2

Everywhere n appears together in a term n t. Hence, n simply scales the


response yH (t) in t. The larger value of n , the faster the response.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 81

5 Derivatives on the inputs: Eect on the forced re-


sponse

1 Introduction

Consider the bicycle diagram shown in Figure 31, where the input to the system is the
stearing angle u = and the output is the roll angle y = . We can obtain the dynamical

Figure 31: Parameters defining the bicycle geometry. The points P1 and P2 are the contact
points of the wheels with the ground, a is the distance from a vertical line through the center
of mass to P1 , b is the wheel base, h is the height of the center of mass, is the steer angle,
and is the roll angle.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 82

equation of the bicycle by summing the tourques acting on the system (due to gravity, and
centrifugal forces). The momentum balance becomes
g aV V2
y y = u + u (5.1)
h bh bh
where V is the velocity of the bicycle. We can notice in (5.1) that the first-order derivative u
of the input u(t) appears in the right-hand side of the dierential equation. Suppose that we
are given initial conditions y0 and y 0 , and are asked to compute the response to a unit-step
input, applied just after the system is released from the initial conditions. Note that the
input is not dierentiable at t = 0, and hence the right-hand side of the dierential equation
is not well defined. How do we get a solution in that case? In order to study this, we first
consider particular solutions to a special class of nonconstant forcing functions.

2 Other Particular Solutions

We have already seen that the dierential equation


y [n] (t) + a1 y [n1] (t) + + an1 y(t)
+ an y(t) = 1
has a particular solution yP (t) = a1n for all t. Recall that all particular solutions can be
generated by adding all homogeneous solutions to any one particular solution.
What about a particular solution to the equation
y [n] (t) + a1 y [n1] (t) + + an1 y(t)
+ an y(t) = 0 + 1 t
where 0 and 1 are some fixed constants. If we dierentiate both sides, we see that a
particular solution is y taking a constant value, and hence we guess that there is a particular
solution of the form
yP (t) = t +
for some proper choice of constants and . Indeed, note that y P = , and all higher order
derivatives are identically zero. Plugging in, and equating gives
an1 + an (t + ) = 0 + 1 t
which must hold for all t. This gives
an1 + an = 0 , an = 1
which can be easily solved, yielding
1 0 an1
= , =
an an
n
This approach is easy to generalize for forcing functions of the form k=0 k tk .
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 83

3 Limits approaching steps

Return to the original problem, which is computing the step-response of

y(t) + a1 y(t)
+ a2 y(t) = b1 u(t)
+ b2 u(t) (5.2)

subject to initial conditions y(0) = Y0 , y(0)


= Y 0 , and the input u(t) = (t).
We begin with a simpler problem, which avoids the dierentiability problems of the unit
step function. For each > 0, define a function as

0 for t < 0
(t) := 1
t for 0 t <
1 for t

Note that this is continuous, and piecewise dierentiable, with derivative



0 for t < 0
1
(t) = for 0 < t <
0 for < t

We want to determine the solution of the dierential equation (5.2) subject to initial con-
ditions y(0) = Y0 , y(0)
= Y 0 , and the input u(t) = (t). Let the solution be denoted by
y (t).
We break the problem into 2 time intervals: (0 ) and ( ).

Over the first interval, (0 ), we explicitly compute the solution in the standard manner,
finding a particular solution, and then adding in the appropriate homogeneous solution
to match up the initial conditions at 0.

Over the second interval, we follow the same procedure (since the qualitative behavior
of the right-hand-side of the dierential equation is dierent in this time interval, we
need to start with a new particular solution), last values (ie., the values at t = ) of
the solution obtained in the first interval as initial conditions.

In order to achieve our original objective (response due to unit-step), after completing the
solution in the first interval, we take the limit as 0 in order to compute the initial
conditions for the second interval.
Reiterating we want to determine properties of the solution at t = , in particular we want
to determine y (), and y (), and then take the limit as 0 (ie., as the input function
becomes more and more like a unit-step). We will denote these values as y(0+ ) and y(0 + );
the values of y and y,
just after the step change occurs. They become the initial conditions
for the solution after the inputs step change has taken place.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 84

During the interval (0, ), the right-hand side of (5.2) is well defined, and is
b2 b1
b1 u(t)
+ b2 u(t) = t+

A particular solution (using the method we derived in Section 2) is yP (t) = t + , where
b2 b1 a 2 a 1 b2
= , =
a2 a22
Let 1 , 2 be the roots of the characteristic polynomial,

2 + a1 + a2 = 0

For now, lets assume that they are distinct (you could rework what we do here for the case
when they are not distinct - it all works out the same). For a later calculation, please check
that a1 = 1 2 , and a2 = 1 2 . Hence, the solution to the dierential equation for t > 0
must be
y (t) = t + + c1 e1 t + c2 e2 t (5.3)
where c1 and c2 are uniquely chosen to satisfy the initial conditions y (0) = Y0 , y (0) = Y 0 .
Dierentiating gives that
y (t) = + c1 1 e1 t + c2 2 e2 t (5.4)
Satisfying the initial conditions at t = 0 gives conditions that the constants c1 and c2 must
satisfy [ ][ ] [ ]
1 1 c1 Y0
=
1 2 c2 Y0
which can be solved as
[ ] [ ][ ]
c1 1 2 1 Y0
=
c2 2 1 1 1 Y 0

In terms of c1 and c2 , the value of y and y at t = are (using equations (5.3 and 5.4))
[ ] [ ][ ] [ ]
y () e 1 e 2 c1 +
= +
y () 1 e1 2 e2 c2

Substituting, gives
[ ] [ ][ ][ ] [ ]
y () 1 e 1 e2 2 1 Y0 +
= +
y () 2 1 1 e1 2 e2 1 1 Y 0

Rearranging gives
[ ] [ ][ ] [ ]
y () 1 2 e(1 1 e2 ) e2 e1 Y0 +
= +
y () 2 1 2 1 e1 e2 2 e2 1 e1 Y 0
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 85

For notational purposes, let


[ ]
1 2 e(1 1 e2 ) e2 e1
M :=
2 1 2 1 e1 e2 2 e2 1 e1

Then, we have [ ] [ ] [ ]
y () Y0 +
= M +
y () Y 0

This is further manipulated into


[ ] [ ] ( [ ]) [ ]
y () Y0 1
= M + M +
y () Y0 0 1

But recall, and depend on , so that should be substituted,


[ ] [ ] ( [ ]) [ b1 a2 a1 b2
]
y () Y0 1 1 a22
= M + M +
y () Y0 0 1 b2
a2

Note that
lim M = I2
0

and using LHospitals rule,


( [ ]) [ ] [ ]
1 1 0 0 0 0
lim M + = =
0 0 1 2 1 2 1 a2 a1

Hence, [ ] [ ] [ ]
y(0+ ) y () Y0
:= lim =
+)
y(0 0,>0 y () Y0 + b1

In summary, suppose the input waveform is such that the right-hand side (ie., forcing func-
tion) of the dierential equation has singularities at certain discrete instants in time. Between
those instants, all terms of the dierential equation are well behaved, and we solve it in the
classical manner. However, at the instants of the singularity, some specific high order deriva-
tive of y experiences a discontinuity in its value, and the discontinuity can be determined
from the dierential equation. Essentially, we get new initial conditions for the dieren-
tial equation just after the singularity in terms of the solution of the ODE just before the
singularity and the ODE itself.
We have seen that the values of y and y at a time just before the input singularity are related
to the values of y and y just after the singularity.
In the next section we learn some tricks that allow us to redo this type of calculation for
general systems (not just second order). Distributions are mathematical constructions that,
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 86

in a rigorous manner, allow us to repeat the rigorous calculation we just did in this section
in a less tedious fashion.
Another point to notice: this calculation shows that the term b1 u(t),
which appears on the
right-hand side of the ODE in equation (5.2) plays a role in the solution. So, both the
left and right sides of an input/output ODE have qualitative and quantitative eects of the
solution. We will formalize this as we proceed...

4 Problems

1. Consider the dierential equation

y(t) + 4y(t)
+ 3y(t) = b1 u(t)
+ 3u(t),

subject to the forcing function u(t) := (t), and initial conditions y(0 ) = 0, y(0
) = 0.

(a) Determine:
the conditions of y (and y)
at t = 0+ ,
the roots of the homogeneous equation (and their values of and n if com-
plex)
the final value, limt y(t).
Some of these will be dependent on the parameter b1 .
(b) Based on your answers, sketch a guess of the solution for 8 cases:

b1 = 6, 3, 0.3, 0.03, 0.03, 0.3, 3, 6.

Sketch them on the same axes.


(c) Determine the exact solution (by hand). Do as much of this symbolically as you
can (in terms of b1 ) so that you only need to the majority of the work once, and
then plug in the values of b1 several times. Use the plot command in MatLab
(or other) to get a clean plot of the solution y(t) from 0+ to some suitable final
time. Plot them on the same graph.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 87

6 Distributions
In this section we learn some tricks that allow us to redo the calculation in the previous
section for general systems (not just second order). Distributions are mathematical con-
structions that, in a rigorous manner, allow us to repeat the rigorous calculation we just did
in section 5 in a less tedious fashion.

1 Introduction

Recall our goal: determine the response of

y [n] (t) + a1 y [n1] (t) + a2 y [n2] (t) + + an y(t) =


(6.1)
b0 u[n] (t) + b1 u[n1] (t) + b2 u[n2] (t) + + bn u(t)

subject to u(t) = (t) (a unit step at t = 0) and initial conditions y(0 ) = y0 , y [1] (0 ) =
[0]

y0 , y [2] (0 ) = y0 , . . . , y [n1] (0 ) = y0 . Here 0 refers to the time just before the unit-
[1] [2] [n1]

step input is applied. So, the system is placed in initial conditions, and released, the release
time being denoted 0 . At that instant, the inputs value is 0, so u(0 ) = 0. An infinitesimal
time later, at 0+ , the input value is changed to +1. The input is actually at unit-step at
t = 0, and the initial conditions are known just before the step-input is applied.
The diculty is that the right-hand side of (6.1) is not classically defined, since u is not
dierentiable. However, we may obtain the solution by considering a sequence of problems,
with smooth approximations to the unit step, and obtain the solution as a limiting process.
Such a procedure goes as follows:

1. Define a n-times dierentiable family of functions that have the property


{
0 for t < 0
(t) =
1 for t >

and which converge to the unit step as 0.

2. Compute solution y (t) to the dierential equation

y [n] (t) + a1 y [n1] (t) + a2 y [n2] (t) + + an y(t) =


b0 u[n] (t) + b1 u[n1] (t) + b2 u[n2] (t) + + bn u(t)
[0]
subject to the forcing function u(t) = (t) and initial conditions y(0) = y0 , y [1] (0) =
[1] [2] [n1]
y0 , y [2] (0) = y0 , . . . , y [n1] (0) = y0 .
[n1]
3. Look at the values of y (), y (), y () . . . , y (). Take the limit as 0, and get
a relationship between the values of y, y, y, . . . , y [n1]
at t = 0 and t = 0+ .
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 88

4. For t > 0, the right hand side of the ODE in (6.1) is well defined (in fact, its a constant,
bn ), and the solution can be determined from finding any particular solution, and
combining with the family of homogeneous solutions to correctly match the conditions
at t = 0+ .

This procedure is tedious, though the following can be proven:

1. It gives the correct answer for the solution of the ODE subject to the unit step input
[k]
2. The final answer for the limits y () as 0 are the same regardless of the form of
, as long as it satisfies the properties given.

Moreover, you can accomplish this in an easier fashion by using generalized functions, called
distributions.
The most common distribution that is not a normal function is the Dirac- function. To
gain intuition about this, consider an -approximation to the unit-step function of the form

0 for t < 0
1
(t) = t for 0 < t <
1 for t 1

The derivative of this is


d 0 for t < 0
1
(t) = for 0 < t <
dt 0 for t 1

Call this function . Note that for all values of > 0,



(t)dt = 1

and that for t < 0 and t > , (t) = 0. Moreover, for any continuous function f

lim f (t) (t)dt = f (0)
0

and for any t = 0, lim0 (t) = 0. Hence, in the limit we can imagine a function whose
value at nonzero t is 0, whose value at t = 0 is undefined, but whose integral is finite, namely
1.
Now, we can start another level smoother. Let be defined as

0 for t<0
t
2
for 0<t<
(t) :=
2t
2 for < t < 2
0 for 2 < t
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 89

Note that independent of we have



(t)dt = 1

and for any t = 0, lim0 (t) = 0. The derivative is well defined, and satisfies

0 for t < 0
d 12 for 0 < t <
=
2 for < t < 2
1
dt
0 for t > 2
Note that for any continuous function f , we have

lim f (t) (t)dt = f (0)
0

and for any dierentiable function f , we have



d
lim f (t) dt = f(0)
0 dt
and
d

lim dt =
0 dt

In the limit, we get an even more singular function, (or [1] ), which has the property that
it is zero for all nonzero t, not well defined for t = 0, and even the integral of the absolute
value is not well defined.
If we start with a smoother (quadratics) version of , then we can dierentiate twice, getting
and , and look at their limiting behavior. Starting still smoother, we can continue the
process, generating a collection of singular functions, [k] , defined formally as

d d [k1]
[0] (t) := (t) := , [k] (t) =
dt dt
As we have seen in the first few, each [k] is more singular than the preceeding one, [k1] .
Hence, there is no manner in which several lower order derivatives of -functions can be
linearly combined to represent a -function of higher order. In other words, the derivatives
of functions are a linearly independent set.

2 Procedure to get step response

Consider our general system dierential equation (6.1), and suppose that u(t) = (t). Then,
the highest order singularity in the right-hand side is associated with the u[n] term, which
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 90

has [n1] . Hence, this is the highest order singularity which must occur on the left-hand
side. If this order singularity occurs in any of the terms y, y, . . . , y [n1] , then additional
dierentiation will yield a higher order singularity in the y [n] term, which is not possible.
Hence, the only term on the left-hand side with [n1] is y [n] . This suggests that y [n] is of the
form
y [n] = e1 [n1] + e2 [n2] + + en + en+1 + fn
where fn is a continuous function, and the constants e1 , e2 , . . . , en+1 need to be determined.
Note that if this is the form of the nth derivative of y, then there are constraints on the
lower order derivatives of y as well. Integrating, we get
y [n] = e1 [n1] + e2 [n2] + + en + en+1 + fn
y [n1]
= e1 [n2] + + en1 + en + fn1
..
.
y [1] = e1 + e2 + f2
y [0] = + e1 + f1
where each of the fi are continuous functions. Plugging into the ODE, and equating the
dierent singularities gives n equations in n unknowns, expressed in matrix form below

1 0 0 0 e1 b0
a1 1 0 0 e2 b1

a2 a1 1 0 e3 = b2 (6.2)
. .. .. . . .. . .
.. . . . . .. ..
an1 an2 a1 1 en bn1

The matrix is always invertible, and the system of equations can be solved, yielding the e
vector. It is easy to see that it can be solved recursively, from e1 through en (and even en+1 )
as
e1 = b0
e2 = b1 a1 e1
e3 = b2 a1 e2 a2 e1
.. ..
. .
ek = bk1 a1 ek1 a2 ek2 ak1 e1

The e vector gives the discontinuity in each derivative of y at t = 0, namely


y(0+ ) = y(0 ) + e1
+ ) = y(0
y(0 ) + e2
y [2] (0+ ) = y [2] (0 ) + e3
.. .. ..
. . .
y (0 ) = y [k] (0 ) + ek+1
[k] +
.. .. ..
. . .
y [n1] (0+ ) = y [n1] (0 ) + en
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 91

Given these new initial conditions at t = 0+ , we can combine the family of all homoge-
neous solutions, with one particular solution (for instance, yP (t) abnn ) to match the initial
conditions at t = 0+ , completing our solution. You can/should write a general MatLab
function M-file to compute all of these quantities for given row vectors

A = [ 1 a1 a2 an1 an ] , B = [ b0 b1 b2 bn1 bn ]
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 92

3 Problems

1. Consider a system with input u, and output y governed by the dierential equation

y(t)
+ a1 y(t) = u(t)
+ b1 u(t) (6.3)

Find the unit-step response with initial conditions y(0 ) = 0. Compare to answer
(should be the same) as that obtained in problem 14 in section 7.

2. Consider
y [3] (t) + 3.8
y (t) + 6.8y(t)
+ 4y(t) = b2 u(t)
+ 3u(t)
subject to the forcing function u(t) := (t), and initial conditions y(0 ) = 0, y(0
) =
0, y(0 ) = 0. Follow the same instructions as in problem 1 in Section 5, handling the
7 cases
b2 = 6, 3, 0.3, 0.03, 0.03, 0.3, 3, 6.
Since this is a higher order problem, you will need to also determine y(0+ ). Hint: One
of the roots of the characteristic equation is 1. Also, if you proceed symbolically, you
end up with the coecients of the homogeneous components being of the form

c = M 1 v(b2 )

where M is a 3 3 matrix made up of the three roots of the characteristic polynomial,


and v is a 3 1 vector that depends on b2 . On paper, leave it as that (dont bother
computing the inverse). Then, for each of the 6 cases, plug in a particular value for
b2 , and let MatLab compute the coecients automatically. Set up your plotting script
file to accept a 3 1 vector of homogeneous coecients. In your solutions, include any
useful M-files that you write.

3. Consider the three dierential equations

y [4] (t) + 5.8y [3] (t) + 14.4


y (t) + 17.6y(t)
+ 8y(t) = u(t)
y [4] (t) + 5.8y [3] (t) + 14.4
y (t) + 17.6y(t)
+ 8y(t) = 2
u(t) + 2u(t)
+ u(t)
[4] [3]
y (t) + 5.8y (t) + 14.4 y (t) + 17.6y(t) u(t) 2u(t)
+ 8y(t) = 2 + u(t)

Suppose that each is subject to the forcing function u(t) := (t), and initial conditions
y(0 ) = 0, y(0
) = 0, y(0 ) = 0, y [3] (0 ) = 0. Compute the roots (hint: one at 1,
one at 2), get final value of y(t), compute new conditions of y (and derivatives) at
0+ , and sketch solutions. Then, derive the exact expression for the solutions, and plot
using MatLab.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 93

Summary: Solution of SLODEs with Derivatives on the


inputs

Introduction
Goal: determine the response of
y [n] (t) + a1 y [n1] (t) + a2 y [n2] (t) + + an y(t) =
(6.4)
b0 u[n] (t) + b1 u[n1] (t) + b2 u[n2] (t) + + bn u(t)

subject to u(t) = (t) (a unit step at t = 0) and initial conditions y(0 ) = y0 , y [1] (0 ) =
[0]

y0 , y [2] (0 ) = y0 , . . . , y [n1] (0 ) = y0 .
[1] [2] [n1]

The time 0 refers to the time just before the unit-step input is applied.
The initial conditions are known just before the step-input is applied, i.e. time 0 .
An infinitesimal time later, at 0+ , the input value is changed to +1.
The diculty is that the right-hand side is not classically defined, since u is not dier-
entiable.
The solution can be obtained by considering a sequence of problems, with smooth
approximations to the unit step, and obtain the solution as a limiting process.

Main Concept for obtaining the solution


For > 0, define a function as

0 for t < 0
(t) := 1
t for 0 t <
1
for t

Note that this is continuous, and piecewise dierentiable, with derivative



0 for t < 0
1
(t) = for 0 < t <
0 for < t

Break the problem into 2 time intervals: (0 ) and ( ).


Over the first interval, (0 ), compute the solution in the standard manner, finding a
particular solution, and then adding in the appropriate homogeneous solution to match
up the initial conditions at 0 .
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 94

Over the second interval follow the same procedure starting from the values at t =
of the solution obtained in the first interval as initial conditions.

Take the limit as 0 to compute the solution y(t) to the original problem.

Note that the solution of the first interval will aect the initial conditions for the
second interval.

As 0 we are only interested in computing the new initial conditions, i.e., the values
of y and its derivatives just after the step change occurs (at time 0+ ).

Distributions
Denote the function (t) defined above as .

Note that for all values of > 0,



(t)dt = 1

and that for t < 0 and t > , (t) = 0.

Also, for any continuous function f



lim f (t) (t)dt = f (0)
0

and for any t = 0, lim0 (t) = 0.

The function
(t) = lim0
is the Dirac- function.

The function is equal to 0 at all times with the exception of t = 0. At t = 0 it is


undefined, but the integral is finite, namely 1.

We proceed similarly and define the first derivative of the function (t), the second
derivative and so on..
d d [k1]
[0] (t) := (t) := , [k] (t) =
dt dt
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 95

The procedure
Consider our general system dierential equation

y [n] (t) + a1 y [n1] (t) + a2 y [n2] (t) + + an y(t) =


(6.5)
b0 u[n] (t) + b1 u[n1] (t) + b2 u[n2] (t) + + bn u(t)

and suppose that u(t) = (t).

By using distribution properties we can prove that y [n] is of the form

y [n] = e1 [n1] + e2 [n2] + + en + en+1 + fn (t)

where fn (t) is a continuous function, and the constants e1 , e2 , . . . , en+1 need to be


determined.

Integrating, we get

y [n] = e1 [n1] + e2 [n2] + + en + en+1 + fn (t)


y [n1]
= e1 [n2]
+ + en1 + en + fn1 (t)
..
.
y [1] = e1 + e2 + f2 (t)
y [0] = + e1 + f0 (t)

where each of the fi (t) are continuous functions.

Since fi (t) are continuous functions, they are continuous at 0.

f0 (0 ) = f0 (0+ ) = y(0 )
f1 (0 ) = f1 (0+ ) = y(0 )
f2 (0 ) = f2 (0 ) = y(0 )
+
.. .. ..
. . .
f[n1] (0 ) = f[n1] (0+ ) = y [n1] (0 )
Therefore the ei give the discontinuity in each derivative of y at t = 0+ :

y(0+ ) = y(0 ) + e1
+ ) = y(0
y(0 ) + e2
y (0 ) = y [2] (0 ) + e3
[2] +
.. .. ..
. . .
y (0 ) = y [k] (0 ) + ek+1
[k] +
.. .. ..
. . .
y [n1] (0+ ) = y [n1] (0 ) + en
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 96

Plugging into the ODE, and equating the dierent , [1] , . . ., [n1] functions gives n
equations in n unknowns, expressed in matrix form below

1 0 0 0 e1 b0
a1 1 0 0 e2 b1

a2 a1 1 0 e3 = b2 (6.6)
. .. .. . . .. . .
.. . . . . .
. .
.
an1 an2 a1 1 en bn1

The matrix is always invertible, and the system of equations can be solved, yielding
the e vector.
It is easy to see that it can be solved recursively, from e1 through en as
e1 = b0
e2 = b1 a1 e1
e3 = b2 a1 e2 a2 e1
.. ..
. .
ek = bk1 a1 ek1 a2 ek2 ak1 e1

Compute the new initial conditions at t = 0+ :


y(0+ ) = y(0 ) + e1
+ ) = y(0
y(0 ) + e2
y [2] (0+ ) = y [2] (0 ) + e3
.. .. ..
. . .
y [k] (0+ ) = y [k] (0 ) + ek+1
.. .. ..
. . .
y [n1] (0+ ) = y [n1] (0 ) + en

Given these new initial conditions at t = 0+ , we can proceed with the solution of

y [n] (t) + a1 y [n1] (t) + a2 y [n2] (t) + + an y(t) = bn u(t) (6.7)


with the initial conditions at 0+ as shown in previous chapters.
Note that in MatLab one can compactly solve the e quantities by using the command
A\b where

1 0 0 0
a1 1 0 0

A= 2 a a 1 0 , B = [ b0 b1 b2 bn1 bn ]
.. . . ..
1
... ..
. . . .
an1 an2 a1 1
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 97

7 Frequency Responses of Linear Systems


In this section, we consider the steady-state response of a linear system due to a sinusoidal
input. The linear system is the standard one,

y [n] (t) + a1 y [n1] (t) + + an1 y [1] (t) + an y(t)


(7.1)
= b0 u[n] (t) + b1 u[n1] (t) + + bn1 u[1] (t) + bn u(t)

with y the dependent variable (output), and u the independent variable (input).
Assume that the system is stable, so that the roots of the characteristic equation are in the
open left-half of the complex plane. This guarantees that all homogeneous solutions decay
exponentially to zero as t .
Suppose that the forcing function u(t) is chosen as a complex exponential, namely is a fixed
real number, and u(t) = ejt . Note that the derivatives are particularly easy to compute,
namely
u[k] (t) = (j)k ejt
It is easy to show that for some complex number H, one particular solution is of the form

yP (t) = Hejt

How? Simply plug it in to the ODE, leaving

H [(j)n + a1 (j)n1 + + an1 (j) + an ] ejt


= [b0 (j)n + b1 (j)n1 + + bn1 (j) + bn ] ejt

For all t, the quantity ejt is never zero, so we can divide out leaving

H [(j)n + a1 (j)n1 + + an1 (j) + an ]


= [b0 (j)n + b1 (j)n1 + + bn1 (j) + bn ]

Now, since the system is stable, the roots of the polynomial

n + a1 n1 + + an1 + an = 0

all have negative real part. Hence, = j, which has 0 real part, is not a root. Therefore,
we can explicitly solve for H as

b0 (j)n + b1 (j)n1 + + bn1 (j) + bn


H= (7.2)
(j)n + a1 (j)n1 + + an1 (j) + an

Moreover, since actual solution diers from this particular solution by some homogeneous
solution, we must have
y(t) = yP (t) + yH (t)
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 98

In the limit, the homogeneous solution decays, regardless of the initial conditions, and we
have
lim y(t) yP (t) = 0
t

Since yP is periodic, and y tends towards it asymptotically (the homogeneous solutions are
decaying), we call this specific particular solution the steady-state behavior of y, and denote
it yss .
The explanation we have given was valid at an arbitrary value of the forcing frequency, .
The expression for H in (7.2) is still valid. Hence, we often write H() to indicate the
dependence of H on the forcing frequency.
b0 (j)n + b1 (j)n1 + + bn1 (j) + bn
H() := (7.3)
(j)n + a1 (j)n1 + + an1 (j) + an
This function is called the frequency response of the linear system in (7.1). Sometimes
it is referred to as the frequency response from u to y, written as Huy (). For stable
systems, we have proven for fixed value u and fixed

u(t) := uejt yss (t) = H()


uejt

Note that H() = G(s)|s=j where G(s) is the transfer function of the SLODE (7.1). There-
fore
u(t) := uejt yss (t) = G(j) uejt

1 Complex and Real Particular Solutions

What is the meaning of a complex solution to the dierential equation (7.1)? Suppose that
functions u and y are complex, and solve the ODE. Denote the real part of the function u as
uR , and the imaginary part as uI (similar for y). Then uR and uI are real-valued functions,
and for all t u(t) = uR (t) + juI (t). Dierentiating this k times gives
[k] [k]
u[k] (t) = uR (t) + juI (t)

Hence, if y and u satisfy the ODE, we have


[ ] [ ]
[n] [n] [n1] [n1]
yR (t) + jyI (t) + a1 yR (t) + jyI (t) + + an [yR (t) + jyI (t)] =
[ ] [ ]
[n] [n] [n1] [n1]
= b0 uR (t) + juI (t) + b1 uR (t) + juI (t) + + bn [uR (t) + juI (t)]

But the real and imaginary parts must be equal individually, so exploiting the fact that the
coecients ai and bj are real numbers, we get
[n] [n1] [1]
yR (t) + a1 yR (t) + + an1 yR (t) + an yR (t)
[n] [n1] [1]
= b0 uR (t) + b1 uR (t) + + bn1 uR (t) + bn uR (t)
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 99

and
[n] [n1] [1]
yI (t) + a1 yI (t) + + an1 yI (t) + an yI (t)
[n] [n1] [1]
= b0 uI (t) + b1 uI (t) + + bn1 uI (t) + bn uI (t)
Hence, if (u, y) are functions which satisfy the ODE, then both (uR , yR ) and (uI , yI ) also
satisfy the ODE.

2 Response due to real sinusoidal inputs

Suppose that H C is not equal to zero. Recall that H is the real number (unique to
within an additive factor of 2) which has the properties

ReH ImH
cos H = , sin H =
|H| |H|

Then, ( )
Re Hej = Re [(HR + jHI ) (cos + j sin )]
= [ HI sin
HR cos ]
= |H| H R
|H|
cos HI
|H|
sin
= |H| [cos H cos sin H sin ]
( ) = |H| cos ( + H)
Im Hej = Im [(HR + jHI ) (cos + j sin )]
= HR sin
[ + HI cos ]
= |H| H R
|H|
sin + HI
|H|
cos
= |H| [cos H sin + sin H cos ]
= |H| sin ( + H)
Now consider the dierential equation/frequency response case. Let H() denote the fre-
quency response function. If the input u(t) = cos t = Re (ejt ), then the steady-state
output y will satisfy
y(t) = |H()| cos (t + H())
A similar calculation holds for sin, and these are summarized below.

Input Steady-State Output


1 H(0) = abnn
cos(t) |H()| cos (t + H())
sin(t) |H()| sin (t + H())
A cos(t + ) A |H()| cos (t + + H())
A sin(t + ) A |H()| sin (t + + H())

or by using the transfer function G(s)


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 100

Input Steady-State Output


1 G(0) = abnn
cos(t) |G(j)| cos (t + G(j))
sin(t) |G(j)| sin (t + G(j))
A cos(t + ) A |G(j)| cos (t + + G(j))
A sin(t + ) A |G(j)| sin (t + + G(j))

3 Problems
1. Write a Matlab function which has three input arguments, A, B and . A and B are
row vectors, of the form of the form

A = [a0 a1 a2 an ] , B = [b0 b1 b2 bn ]

where a0 = 0. These represent the input/output system

a0 y [n] (t) + a1 y [n1] (t) + + an1 y [1] (t) + an y(t)


= b0 u[n] (t) + b1 u[n1] (t) + + bn1 u[1] (t) + bn u(t)
with y the dependent variable (output), and u the independent variable (input). is a
1-by-N vector of real frequencies. The function should return one argument, H, which
will be the same dimension as , but in general will be complex. The value of H(i)
should be the frequency-response function of the system above at frequency = (i).
2. Using the Matlab function from above, draw the Bode plot of the frequency response
function for the 3rd order system in problem 10(a)(i) in Section 10. On the same graph,
plot the frequency response function for the 1st order system in problem 10(a)(ii).
Comment on the similarities and dierences (eg., in what frequency ranges are they
appreciably dierent?; in the frequency ranges where they are dierent, what is the
magnitude of the response function as compared to the largest value of the response
magnitude?
3. Using the Matlab function from above, draw the Bode plot of the frequency response
function for the 3rd order system in problem 10(b)(i) in Section 10. On the same graph,
plot the frequency response function for the 2nd order system in problem 10(b)(ii).
Comment on the similarities and dierences (eg., in what frequency ranges are they
appreciably dierent?; in the frequency ranges where they are dierent, what is the
magnitude of the response function as compared to the largest value of the response
magnitude?
4. Suppose the ODE for a system is

+ n2 y(t) = n2 u(t)
y(t) + 2n y(t)

where u is the input, and y is the output. Assume that > 0 and n > 0.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 101

(a) Derive the frequency response function of the system. Let denote frequency,
and denote the frequency response function as H().
(b) What are |H()| and |H()|2 . Is |H()| (or |H()|2 ) ever equal to 0?
(c) Work with |H()|2 . By dividing numerator and denominator by n4 , derive
1
|H()|2 = [ ( )2 ]2 ( )2
1
n
+ 4 2
n

What is |H()| approximately equal to for for << n ? What is log |H()|
approximately equal to for for << n ?
(d) Work with |H()|2 . By dividing numerator and denominator by 4 , derive
( )4
n

|H()| = [( )
2
]2 ( )2
2

n
1 + 4 2 n

( )2
Using this, show that for >> n , |H()| n . As a function of log , what
is log |H()| approximately equal to for for >> n ? Specifically, show that for
>> n ,
log |H()| 2 log n 2 log
(e) What is H() for << n ?
(f) What is H() for >> n ?
(g) What are |H()| and H() for = n ?
d
(h) For a general function F () that is never 0, show that |F ()| = 0 at exactly
d
d
the same values of as when |F ()|2 = 0.
d
d
(i) Find the frequencies (real numbers) where |H()| = 0.
d
(j) Show that if < 12 , then the maximum of |H()| occurs at a non-zero frequency.

Denote the critical frequency by crit , and show namely crit = n 1 2 2 .
(k) Assuming that < 1 . Show that
2

1
|H(crit )| =
2 1 2

(l) Assuming that < 1 .


2
Define := H(crit ). What is tan ?
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 102

(m) On graph paper, carefully sketch in all of the derived properties for four cases,
= 0.2, 0.5, 0.7, 0.9 and (in all cases) n = 1. Your plots should have the axes
log |H()| versus log , and |H()| versus log . In this problem, you have
derived a few key features of the plots, but not the entire shape of the plot. Your
sketches should only include the facts that you have derived in this problem,
namely parts 4c-4l.
(n) Using Matlab, generate the complete magnitude and angle plots for the two cases
above. Plot them for the range [0.001 1000]. Verify that the actual plots
have all of the features that you derived and sketched in the previous part.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 103

8 Bode Plots

1 Problems
1. Graph paper, suitable for Bode plots, is provided at at BSPACE. In each problem label
all axis appropriately.

(a) Suppose H(s) = 1s , which is the transfer function of an integrator. For all > 0,
it is easy to see that
1
|H(j)| = , H(j) =
2
Obviously log |H(j)| = log . Using these facts, draw a Bode plot of H for
varying from 0.001 to 1000.
(b) On the graph paper provided, sketch the Bode plot of
s+z
C(s) =
s
for 3 values of z = 0.02, 0.07, 0.2. Use the straight-line rules developed in class.
Note that |C(j)| >> 1 for << z, and that C(j) 1 for >> z.
(c) On the graph paper provided, sketch the Bode plot of
1
F (s) =
s + 1
for 3 values of = 0.02, 0.07, 0.2. Use the straight-line rules developed in class.
Note that |F (j)| << 1 for >> 1 , and that F (j) 1 for << 1 .
(d) On the graph paper provided, sketch the Bode plot of C(s)F (s) as described
above, with z = 0.2 and = 0.2.

2. We have talked about sensor noise extensively, but have not done much with regard
to simulations (numerical solutions to the ODEs). In this problem, we learn how the
command lsim can be used to compute the response of a system (described by its
transfer function) to any specified input.

Described a system by specifying its transfer function, for example


>> G = tf(1,[0.1 1]); % time constant 0.1
>> H = tf(1,[1.0 1]); % time constant 1.0
Create an evenly-space vector of times, TVEC, using (for example) linspace. Make
the vector a column vector (the command lsim is forgiving, and a row-vector
works as well).
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 104

>> TVEC = linspace(0,10,100);


Create a column vector of signal values, UVAL, which are the corresponding values
of the forcing function at the times specified in TVEC. In this example, we will
make a random input, using RANDN. This signal is typical of what we refer to as
noise. It is a random function of time.
>> UVALS = randn(100,1);
>> plot(TVEC,UVALS); % the constructed input-signal
Call LSIM, and plot the results.
>> Yg = lsim(G,UVALS,TVEC);
>> Yh = lsim(H,UVALS,TVEC);
>> plot(TVEC,Yg,r,TVEC,Yh,g);

Note that the fast system (G, with time-constant 0.1) responds to the input signal
more than the slow system (H,with time-constant 1.0). This is consistent with Bode
magnitude plots of G and H, which shows that G responds more to high-frequency
signals than does H (and both respond equally to low-frequency signals).

3. This problem builds on the ideas from problems 1 and 2. Consider the feedback
architecture of Section A with a two simplifications: Let S = 1, and assume the
disturbance d enters directly (no H), but enters at the input to the plant G. The
plant model is
1
G(s) =
s
There are two controllers to consider
s + 0.2
C1 (s) = 1, C2 (s) =
s
and two filters to consider
1
F1 (s) = 1, F2 (s) =
0.2s + 1
We will consider two closed-loop systems: System #1 with (G, C1 , F1 ) and System #2
with (G, C2 , F2 ). For ease of notation, these are referred to as S1 and S2 .

(a) Using Matlab, draw the Bode (magnitude and phase) plot of the transfer function
from R Y for both S1 and S2 . Put both lines on the same axes. Use the
command bode.
(b) Using Matlab, draw the Bode (magnitude only) plot of the transfer function from
D Y for both S1 and S2 . Put both lines on the same axes. Use the command
bodemag.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 105

(c) Using Matlab, draw the Bode (magnitude only) plot of the transfer function from
N Y for both S1 and S2 . Put both lines on the same axes. Use the command
bodemag.
(d) Using Matlab, draw the time-response of y due to a unit-step in r for both S1 and
S2 . Put both lines on the same axes. You can use the command step.
(e) Using Matlab, draw the time-response of y due to a unit-step in d for both S1
and S2 . Put both lines on the same axes. You can use the command step.
(f) Using Matlab, draw the time-response of y due to a random-input in n for both S1
and S2 . Put both lines on the same axes, using a dierent color for the dierent
systems outputs. You can use the command lsim. Create the random input
using the method in problem 2, using 200 by 1 randomly generated vector on
the time interval [0 10]. Use a for-loop, and hold on, and repeat this simulation
5 times, placing all plots on the same axes.
(g) Carefully explain, in each case (r y, d y, n y) how the relationship
between the Bode plots is consistent with the relationship of the time-response
plots. The r y is somewhat dicult to draw distinctions as both the Bode plots
and time-responses look quite similar (this is somewhat the point), although the
eect that d and n have on y are dierent in the two cases.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 106

9 Transfer functions
Associated with the linear system (input u, output y) governed by the ODE

y [n] (t) + a1 y [n1] (t) + + an1 y [1] (t) + an y(t)


(9.1)
= b0 u[n] (t) + b1 u[n1] (t) + + bn1 u[1] (t) + bn u(t)

we write in transfer function form


b0 sn + b1 sn1 + + bn1 s + bn
Y = n U (9.2)
s + a1 sn1 + + an1 s + an

The expression in (9.2) is interpreted to be equivalent to the ODE in (9.1), just a dierent
way of writing the coecients. The notation in (9.2) is suggestive of multiplication, and we
will see that such an interpretation is indeed useful. The function

b0 sn + b1 sn1 + + bn1 s + bn
G(s) :=
sn + a1 sn1 + + an1 s + an

is called the transfer function from u to y, and is sometimes denoted Guy (s) to indicate
this. At this point, the expression in equation (9.2),

Y = Guy (s)U

is nothing more than a new notation for the dierential equation in (9.1). The dif-
ferential equation itself has a well-defined meaning, and we understand what each term/symbol
(derivative, multiplication, sum) represents, and the meaning of the equality sign, =. By
contrast, in the transfer function expression, (9.2), there is no specific meaning to the individ-
ual terms, or the equality symbol. The expression, as a whole, simply means the dierential
equation to which it is associated.
Nevertheless, in this section, we will see that, in fact, we can assign proper equality, and
make algebraic substitutions and manipulations of transfer function expressions, which will
aid our manipulation of linear dierential equations. But all of that requires proof, and that
is the purpose of this section.

1 Linear Dierential Operators (LDOs)

Note that in the expression (9.2), the symbol s plays the role of dtd , and higher powers of s
k
mean higher order derivatives, ie., sk means dtd k . If z is a function of time, let the notation
[ ]
dn dn1 d dn z dn1 z dz
b0 n + b1 n1 + + bn1 + bn (z) := b0 n + b1 n1 + + bn1 + bn z
dt dt dt dt dt dt
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 107

We will call this type of operation a linear dierential operation, or LDO. For the purposes
of this section, we will denote these by capital letters, say
[ n n1
]
L := dtd n + a1 dtd n1 + + an1 dtd + an
[ n ]
dn1
R := b0 dtn + b1 dtn1 + + bn1 dt + bn
d d

Using this shorthand notation, we can write the original ODE in (9.5) as

L(y) = R(u)

With each LDO, we naturally associate a polynomial. Specifically, if


[ n ]
d dn1 d
L := + a1 n1 + + an1 + an
dtn dt dt

then pL (s) is defined as

pL (s) := sn + a1 sn1 + + an1 s + an

Similarly, with each polynomial, we associate an LDO if

q(s) := sm + b1 sm1 + + bm1 s + bm

then Lq is defined as
[ ]
dm dm1 d
Lq := m
+ b1 m1 + + bm1 + bm
dt dt dt

Therefore, if a linear system is governed by an ODE of the form L(y) = R(u), then the
transfer function description is simply

pR (s)
Y = U
pL (s)

Similarly, if the transfer function description of a system is

n(s)
V = W
d(s)

then the ODE description is Ld (v) = Ln (w).


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 108

2 Algebra of Linear dierential operations

Note that two successive linear dierential operations can be done in either order. For
example let [ 2 ]
d d
L1 := +5 +6
dt2 dt
and [ ]
d3 d2 d
L2 := 2 2 +3 4
dt3 dt dt
Then, on a dierentiable signal z, simple calculations gives
[ 2 ] ([ 3 ] ]
d2
L1 (L2 (z)) = dtd 2 + 5 dtd + 6 d
2 + 3 d
4 (z)
[ 2 ] ( dt
3 dt2 dt
)
= dtd 2 + 5 dtd + 6 z [3] 2 z + 3z 4z
= z [5] 2z [4] + 3z [3] 4z [2]
5z [4] 10z [3] + 15z [2] 20z [1]
6z [3] 12z [2] + 18z [1] 24z
= z [5] + 3z [4] z [3] z [2] 2z [1] 24z

which is the same as


[ ] ([ ]
]
d3 2 d2
L2 (L1 (z)) = 2 dtd 2 + 3 dtd 4 + 5 dtd
+ 6 (z)
[ dt3
]( dt2
)
d3 d2
= dt3
2 dt2 + 3 dtd 4 z [2] + 5z + 6z
[5]
= z + 5z [4] + 6z [3]
2z [4] 10z [3] 12z [2]
z [3] + 15z [2] + 18z [1]
4z [2] 20z [1] 24z
= z [5] + 3z [4] z [3] z [2] 2z [1] 24z

This equality is easily associated with the fact that multiplication of polynomials is a com-
mutative operation, specifically

(s2 + 5s + 6) (s3 2s2 + 3s 4) = (s3 2s2 + 3s 4) (s2 + 5s + 6)


= s5 + 3s4 s3 s2 2s + 24

We will use the notation [L1 L2 ] to denote this composition of LDOs. The linear dierential
operator L1 L2 is defined as operating on an arbitrary signal z by

[L1 L2 ] (z) := L1 (L2 (z))

Similarly, if L1 and L2 are LDOs, then the sum L1 + L2 is an LDO defined by its operation
on a signal z as [L1 + L2 ] (z) := L1 (z) + L2 (z).
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 109

It is clear that the following manipulations are always true for every dierentiable signal z,

L (z1 + z2 ) = L (z1 ) + L (z2 )

and
[L1 L2 ] (z) = [L2 L1 ] (z)
In terms of LDOs and their associated polynomials, we have the relationships
p[L1 +L2 ] (s) = pL1 (s) + pL2 (s)
p[L1 L2 ] (s) = pL1 (s)pL2 (s)

In the next several subsections, we derive the LDO representation of an interconnection from
the LDO representation of the subsystems.

3 Feedback Connection

The most important interconnection we know of is the basic feedback loop. It is also the
easiest interconnection for which we derive the dierential equation governing the intercon-
nection from the dierential equation governing the components.
Consider the simple unity-feedback system shown below in Figure 32

r + d u-
- -y
S
6

Figure 32: Unity-Feedback interconnection

Assume that system S is described by the LDO L(y) = N (u). The feedback interconnection
yields u(t) = r(t) y(t). Eliminate u by substitution, yielding an LDO relationship between
r and y
L(y) = N (r y) = N (r) N (y)
This is rearranged to the closed-loop LDO

(L + D)(y) = N (r).

Thats a pretty simple derivation. Based on the ODE description of the closed-loop, we can
immediately write the closed-loop transfer function,
pN (s)
Y = R
p[L+N ] (s)
pN (s)
= R.
pL (s) + pN (s)
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 110

Additional manipulation leads to further interpretation. Let G(s) denote the transfer func-
tion of S, so G = ppNL (s)
(s)
. Starting with the transfer function expression we just derived, we
can formally manipulate to an easily recognizable expression. Specifically

pN (s)
Y = R
pL (s) + pN (s)
pN (s)
pL (s)
= R
1 + ppNL (s)
(s)

G(s)
= R
1 + G(s)

This can be interpreted rather easily. Based on the original system interconnection, redraw,
replacing signals with their capital letter equivalents, and replacing the system S with its
transfer function G. This is shown below.

r + d u-
- -y + d U-
- -Y
S R G
6 6

The diagram on the right is interpreted as a diagram of the equations U = R Y , and


Y = GU . Note that manipulating these as though they are arithmetic expressions gives

Y = G(R Y ) after substituting for U


(1 + G)Y = GR moving GY over to left hand side
G
Y = 1+G R solving for Y.

This is is precisely what we want!

4 More General Feedback Connection

Consider the more general single-loop feedback system shown below. For diversity, well use
a positive-feedback convention here.

r +d -
- -
y
S1
+6
v q
S2 

Assume that system S1 is described by the LDO L1 (y) = N1 (u), and S2 is governed by
L2 (v) = N2 (q). Note that by definition then, the transfer function descriptions of S1 and S2
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 111

are
pN1 pN2
Y = U, V = Q
pL1 pL2
|{z} |{z}
:=G1 :=G2

The interconnection equations are u = r+v, and q = y. In order to eliminate v (for example),
first substitute for u and q, leaving
L1 (y) = N1 (r + v) governing equation forS1
L2 (v) = N2 (y) governing equation forS2

Now apply L2 to first equation, and N1 to second equation, yielding (after using the
notation for composing linear dierential operators),
L2 L1 (y) = L2 N1 (r) + L2 N1 (v)
N1 L2 (v) = N1 N2 (y)
The expressions involving v cancel, leaving

[L2 L1 N1 N2 ] (y) = L2 N1 (r)

In transfer function terms, this is


pL2 N1
Y = R
pL2 L1 N1 N2
which is easily rewritten as
pL2 pN1
Y = R
pL2 pL1 pN1 pN2
But, again, this can be formally manipulated into a recognizable expression involving the the
individual transfer functions of S1 and S2 . Divide top and bottom of the transfer function
by pL1 pL2 , to give
pL2 pN1
pL2 pL1
Y = p p R
1 pNL1 pNL 2
2 1

G1
= R
1 G2 G1

Again, this can be interpreted rather easily. Based on the original system interconnection,
redraw, replacing signals with their capital letter equivalents, and replacing the systems Si
with their transfer functions Gi . This is shown below.

r +d -
- -
y R +d -
- Y
-
S1 G1
+6 +6
v q V Q
S2  G2 
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 112

The diagram on the right is interpreted as a diagram of the equations U = R G2 Y , and


Y = G1 U . Note that manipulating these as though they are arithmetic expressions gives
Y = G1 (R G2 Y ) after substituting for U
(1 G1 G2 )Y = G1 R moving G1 G2 Y over to left hand side
G1
Y = 1G 2 G1
R solving for Y.

This is is precisely what we want!

5 Cascade (or Series) Connection

Suppose that we have two linear systems, as shown below,

u y v-
- S1 - S2

with S1 governed by

y [n] (t) + a1 y [n1] (t) + + an y(t) = b0 u[n] (t) + b1 u[n1] (t) + + bn u(t)

and S2 governed by

v [m] (t) + c1 v [m1] (t) + + cm v(t) = d0 y [m] (t) + d1 y [m1] (t) + + dm y(t)

Let G1 (s) denote the transfer function of S1 , and G2 (s) denote the transfer function of S2 .
Define the dierential operations
[ n ]
d dn1 d
L1 := + a1 n1 + + an1 + an
dtn dt dt
[ ]
dn dn1 d
R1 := b0 n + b1 n1 + + bn1 + bn
dt dt dt
and [ ]
dm dm1 d
L2 := + c1 m1 + + cm1 + cm
dtm dt dt
[ m m1
]
d d d
R2 := d0 m + d1 m1 + + dm1 + dm
dt dt dt
Hence, the governing equation for system S1 is L1 (y) = R1 (u), while the governing equation
for system S2 is L2 (v) = R2 (y). Moreover, in terms of transfer functions, we have
pR1 (s) pR2 (s)
G1 (s) = , G2 (s) =
pL1 (s) pL2 (s)
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 113

Now, apply the dierential operation R2 to the first system, leaving

R2 (L1 (y)) = R2 (R1 (u))

Apply the dierential operation L1 to system 2, leaving

L1 (L2 (v)) = L1 (R2 (y))

But, in the last section, we saw that two linear dierential operations can be applied in any
order, hence L1 (R2 (y)) = R2 (L1 (y)). This means that the governing dierential equation
for the cascaded system is
L1 (L2 (v)) = R2 (R1 (u))
which can be rearranged into
L2 (L1 (v)) = R2 (R1 (u))
or, in dierent notation
[L2 L1 ] (v) = [R2 R1 ] (u)

In transfer function form, this means


p[R2 R1 ] (s)
V = U
p[L2 L1 ] (s)

pR2 (s)pR1 (s)


= U
pL2 (s)pL1 (s)

= G2 (s)G1 (s)U

Again, this has a nice interpretation. Redraw the interconnection, replacing the signals with
the capital letter equivalents, and the systems by their transfer functions.

u y v- U Y- V-
- S1 - S2 - G1 G2

The diagram on the right depicts the equations Y = G1 U , and V = G2 Y . Treating these as
arithmetic equalities allows substitution for Y , which yields V = G2 G1 U , as desired.
Example: Suppose S1 is governed by

y(t) + 3y(t) u(t)


+ y(t) = 3u(t)

and S2 is governed by
v(t) 6v(t)
+ 2v(t) = y(t)
+ 4y(t)
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 114

Then for S1 we have


[ 2 ] [ ]
d d d 3s 1
L1 = +3 +1 , R1 = 3 1 , G1 (s) =
dt2 dt dt s2 + 3s + 1

while for S2 we have


[ 2 ] [ ]
d d d s+4
L2 = 6 +2 , R2 = +4 , G2 (s) =
dt2 dt dt s2 6s + 2

The product of the transfer functions is easily calculated as

3s2 + 11s 4
G(s) := G2 (s)G1 (s) =
s4 3s3 15s2 + 2
so that the dierential equation governing u and v is

v [4] (t) 3v [3] (t) 15v [2] (t) + 2v(t) = 3u[2] (t) + 11u[1] (t) 4u(t)

which can also be verified again, by direct manipulation of the ODEs.

6 Parallel Connection

Suppose that we have two linear systems, as shown below,

- S1 y1
+- y
d?
u
+
6
- S2
y2

System S1 is governed by
[n] [n1]
y1 (t) + a1 y1 (t) + + an y1 (t) = b0 u[n] (t) + b1 u[n1] (t) + + bn u(t)

and denoted as L1 (y1 ) = R1 (u). Likewise, system S2 is governed by


[m] [m1]
y2 (t) + c1 y2 (t) + + cm y2 (t) = d0 u[m] (t) + d1 u[m1] (t) + + dm u(t)

and denoted L2 (y2 ) = R2 (u).


Apply the dierential operation L2 to the governing equation for S1 , yielding

L2 (L1 (y1 )) = L2 (R1 (u)) (9.3)


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 115

Similarly, apply the dierential operation L1 to the governing equation for S2 , yielding and
L1 (L2 (y2 )) = L1 (R2 (u))
But the linear dierential operations can be carried out is either order, hence we also have
L2 (L1 (y2 )) = L1 (L2 (y2 )) (9.4)
Add the expressions in (9.3) and (9.4), to get
L2 (L1 (y)) = L2 (L1 (y1 + y2 ))
= L2 (L1 (y1 )) + L2 (L1 (y2 ))
= L2 (R1 (u)) + L1 (R2 (u))
= [L2 R1 ] (u) + [L1 R2 ] (u)
= [L2 R1 + L1 R2 ] (u)
In transfer function form this is
p[L2 R1 +L1 R2 ] (s)
Y = U
p[L2 L1 ] (s)

p[L2 R1 ] (s) + p[L1 R2 ] (s)


= U
pL2 (s)pL1 (s)

pL2 (s)pR1 (s) + pL1 (s)pR2 (s)


= U
pL2 (s)pL1 (s)
[ ]
pR1 (s) pR2 (s)
= + U
pL1 (s) pL2 (s)

= [G1 (s) + G2 (s)] U


So, the transfer function of the parallel connection is the sum of the individual transfer
functions.
This is extremely important! The transfer function of an interconnection of systems
is simply the algebraic gain of the closed-loop systems, treating individual subsystems as
complex gains, with their gain taking on the value of the transfer function.

7 General Connection

The following steps are used for a general interconnection of systems, each governed by a
linear dierential equation relating their inputs and outputs.

Redraw the block diagram of the interconnection. Change signals (lower-case) to upper
case, and replace each system with its transfer function.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 116

Write down the equations, in transfer function form, that are implied by the diagram.

Manipulate the equations as though they are arithmetic expressions. Addition and
multiplication commute, and the distributive laws hold.

8 Systems with multiple inputs

Associated with the multi-input, single-output linear ODE

L(y) = R1 (u) + R2 (w) + R3 (v) (9.5)

we write
pR1 (s) pR (s) pR (s)
Y = U+ 2 W+ 3 V (9.6)
pL (s) pL (s) pL (s)
This may be manipulated algebraically.

9 Poles and Zeros of Transfer Functions

Consider to Linear Dierential operators, L and R, and the input/output system described
by L(y) = R(u). Associated with L and R are polynomials, pL (s) and pR (s), and the transfer
function of the system is G := ppRL (s)
(s)
.
As we already know, the roots of pL (s) = 0 give us complete information regarding the form
of homogeneous solutions to the dierential equation L(y) = 0. These roots, which are roots
of the denominator of the transfer function G are called the poles of the transfer function.
The zeros of the transfer function are defined as the roots of the numerator, in other words,
roots of pR (s). Obviously, these roots yield complete information regarding homogeneous
solutions of the dierential equation R(u) = 0. In sections 5 and 6, we saw the importance
of the right-hand-side of the dierential equation on the forced response. Later we will learn
how to interpret this in terms of the number and location of the transfer function zeros.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 117

10 Remarks/Summary
Transfer function represent the SLODE when the initial conditions are set to zero.

Consider the SLODE


y [n] (t) + a1 y [n1] (t) + + an1 y [1] (t) + an y(t)
(9.7)
= b0 u[n] (t) + b1 u[n1] (t) + + bn1 u[1] (t) + bn u(t)

and the associated transfer function


b0 sn + b1 sn1 + + bn1 s + bn
G(s) = (9.8)
sn + a1 sn1 + + an1 s + an

We have proven that for stable system with constant input u(t) = uss , the output at
steady-state is yss = abnn uss . Therefore

yss = G(0)uss

The roots of the denominator of the transfer function G(s) (sn + a1 sn1 + + an1 s + an )
are called the poles of the transfer function. The roots of the denominator of the trans-
fer function G(s) (b0 sn + b1 sn1 + + bn1 s + bn ) are called the poles of the transfer
function.

The zeros aect the discontinuity of the initial conditions.

The poles are the roots of the characteristic equation. (if there is no zero-pole cance-
lation)

G(s) representation useful for computing SLODE of complex systems.

11 Problems
1. Consider the feedback interconnection shown below. The signals r and w represent a
reference and disturbance input.

r +e 6
- u
- -
y
S1
6
v
?
e+
 w
S2 
q +

Assume that system S1 is described by the LDO L1 (y) = N1 (u), and S2 is governed
by L2 (v) = N2 (q).
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 118

(a) Find the dierential equation relating r and w to y. The ODE will involve
sums/dierences/compositions of the Linear Dierential Operators L1 , N1 , L2 , N2 .
(b) Find the dierential equation relating r and w to u. The ODE will involve
sums/dierences/compositions of the Linear Dierential Operators L1 , N1 , L2 , N2 .

Note that the characteristic equation is the same, whether the equations are written
as (r, w) forcing y, or (r, w) forcing u.

2. Find the transfer function from u to y for the systems governed by the dierential
equations

(a) y(t)
= 1

[u(t) y(t)]
(b) y(t)
+ a1 y(t) = b0 u(t)
+ b1 u(t)
(c) y(t)
= u(t) (explain connection to Simulink icon for integrator...)
+ n2 y(t) = n2 u(t)
(d) y(t) + 2n y(t)

3. Consider the interconnection below. The transfer functions of systems S1 and S2 are
3 s+2
G1 (s) = , G2 (s) =
s+6 s+1
Determine the dierential equation governing the relationship between u and y.

u y
- S1 - S2 -

4. (a) F, G, K and H are transfer functions of systems. A block diagram of an inter-


connection is shown below. The input r and output y are labeled with their
corresponding capital letters. Find the transfer function from r to y.
R - +d -
- - H Y
-
F G
+6

K 

(b) For a single-loop feedback system, a rule for determining the closed-loop transfer
function from an specific input to a specific output is
forward path gain
1 feedback path gain
Explain how part 4a above is a proof of this fact.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 119

5. (a) F, G, K and H are transfer functions of systems. A block diagram of an inter-


connection is shown below. The input r and output y are labeled with their
corresponding capital letters. Find the transfer function from r to y.
R - +d -
- - H Y
-
F G
6

K 

(b) For a single-loop feedback system, with negative feedback, a rule for determining
the closed-loop transfer function from an specific input to a specific output is
forward path gain
1 + feedback path gain
Explain how part 5a above is a proof of this fact.
6. G and K are transfer functions of systems. A block diagram of an interconnection is
shown below. The input r and output y are labeled with their corresponding capital let-
ters. Find the transfer function from r to y, and express it in terms of NG , DG , NK , DK ,
the numerators and denominators of the transfer functions G and K.
+d -
R - Y
-
G
+6

K 

7. A feedback connection of 4 systems is shown below. Let the capital letters also denote
the transfer functions of each of the systems.

F 

r -d - +?
+- y
E d - H -
6

G 

(a) Break this apart as shown below.


d
r -d - +?
+- x
E d -
6

G 
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 120

What is the transfer function from r and d to x? Call your answers G1 and G2 .
(b) Now, draw the overall system as
r - G1 +- d - -y
+6 H

- G2

F 

In terms of G1 , G2 and F and H, what is the transfer function from r to y?


Substitute for G1 and G2 , and get the transfer function from r to y in terms of
the original subsystems.
(c) In terms of numerators and denominators of the individual transfer functions
NG (s)
(G(s) = D G (s)
, for example), what is the characteristic equation of the closed-
loop system?

8. (a) Suppose that the transfer function of a controller, relating reference signal r and
measurement y to control signal u is

U = C(s) [R Y ]

Suppose that the plant has transfer function relating control signal u and distur-
bance d to output y as

Y = G3 (s) [G1 (s)U + G2 (s)D]

Draw a simple diagram, and determine the closed-loop transfer functions relating
r to y and d to y.
(b) Carry out the calculations for
KI E 1
C(s) = KP + , G1 (s) = , G2 (s) = G, G3 (s) =
s s + 1 ms +
Directly from this closed-loop transfer function calculation, determine the dier-
ential equation for the closed-loop system, relating r and d to y.
(c) Given the transfer functions for the plant and controller in (8b),
i. Determine the dierential equation for the controller, which relates r and y
to u.
ii. Determine the dierential equation for the plant, which relates d and u to y.
iii. Combining these dierential equations, eliminate u and determine the closed-
loop dierential equation relating r and d to y.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 121

9. Find the transfer function from e to u for the PI controller equations


z(t)
= e(t)
u(t) = KP e(t) + KI z(t)

10. Suppose that the transfer function of a controller, relating reference signal r and mea-
surement ym to control signal u is

U = C(s) [R YM ]

Suppose that the plant has transfer function relating control signal u and disturbance
d to output y as
Y = [G1 (s)U + G2 (s)D]
Suppose the measurement ym is related to the actual y with additional noise (n), and
a filter (with transfer function F )

YM = F (s) [Y + N ]

(a) Draw a block diagram


(b) In one calculation, determine the 3 closed-loop transfer functions relating inputs
r, d and n to the output y.
(c) In one calculation, determine the 3 closed-loop transfer functions relating inputs
r, d and n to the control signal u.
11. A first order system has a transfer function

G(s) =
s + 1
(a) What is the dierential equation relating the input and output?
(b) Under what conditions is the system stable?
(c) If the system is stable, what is the time-constant of the system?
12. Assume G1 , G2 and H are transfer functions of linear systems.
(a) Compute the transfer function from R to Y in the figure below.

R-
+ j - G Y
-
1
6
+
- G2 ?
- j

H 
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 122

(b) Suppose that the transfer functions are given in terms of numerator and denomi-
nator pairs, so
N1 N2 NH
G1 = , G2 = ,H =
D1 D2 DH
where all of the N and D are polynomials. Assume each denominator is of higher
order than its associated numerator. Carefully express the transfer function from
R to Y in terms of the individual numerators and denominators.
(c) What is the characteristic equation of the closed-loop system? Be sure that its
order is the sum of the individual orders of the the 3 subsystems.

13. Read about the command tf in Matlab. Use the HTML help (available from the
menubar, under Help, as well as the command-line (via >> help tf).

14. Read about the command step in Matlab. Use the HTML help (available from the
menubar, under Help, as well as the command-line (via >> help step).

15. Execute the following commands

>> sys1 = tf(1,[1 3.8 6.8 4])


>> sys2 = tf([3 1],[1 3.8 6.8 4])
>> sys3 = tf([-3 1],[1 3.8 6.8 4])
>> step(sys1,sys2,sys3)

Relate these to problem 2 in Section 3.

16. Execute the following commands

>> sys1 = tf(1,[1 5.8 14.4 17.6 8])


>> sys2 = tf([2 2 1],[1 5.8 14.4 17.6 8])
>> sys3 = tf([2 -2 1],[1 5.8 14.4 17.6 8])
>> step(sys1,sys2,sys3)

Relate these to problem 3 in Section 3.

17. Execute the commands

>> sys1.den
>> class(sys1.den)
>> sys1.den{1}
>> class(sys1.den{1})
>> size(sys1.den{1})
>> roots(sys1.den{1})
>> pole(sys1)
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 123

Explain what is being referenced and displayed. Recall that the poles of a transfer
function are the roots of the associated characteristic polynomial.

18. Manipulating transfer function objects in Matlab.

(a) Transfer functions are multiplied (which represents a series connection of the
systems, as described in Section 5) with the usual * operator.
(b) Transfer functions are added (which represents a parallel connection of the sys-
tems, as described in Section 6) with the usual + operator.
(c) Feedback connections (as described in Section 4 are done the the feedback com-
mand. The default
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 124

10 Simple Cruise-Control
The car model that will consider in this chapter is made up of:

An accurate positioning motor, with power amplifier (well see how to make these later
in the course) that accepts a low-power (almost no current) voltage signal, and moves
the accelerator pedal in a manner proportional to the voltage signal.

The engine, which produces a torque that is related to the position of the accelerator
pedal (current and past values).

The drivetrain of the car, which transmits this torque to the ground through the driven
wheels. We will assume that the car is also subjected to air and rolling resistance.

A vehicle, which gets accelerated due to the forces (road/tire interface, aerodynamic)
which act on it.

Changes in the slope of the highway, which act as a disturbance force on the car. We
do not assume that the car has a sensor which can measure this slope.

A speedometer, which converts the speed (in miles/hour, say), into a voltage signal
for feedback purposes. We will assume for now that we get 1 volt for every mile/hour.
Hence, the variables vmeas and v are related by

vmeas (t)|volts = v(t)|miles/hour .

A diagram for the system is shown in Fig. 33.

1 Dynamic Model

There are 3 forces acting on the car

Feng (t), the static friction force at wheel/road interface, due to the torque applied to
the driveshaft from engine.

Fdrag , Aerodynamic drag forces, which depend on the speed of the car.

dF (t) disturbance force, for instance the gravitational force due to inclination in the
road, or additional aerodynamic forces due to wind gusts. For now well take dF =
0.01mgw = Hw, with H = 0.01mg, where w is the percent inclination.

We will model the engine and aero forces as follows:


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 125

road

incline

Controlled Plant
d
v - v
des u pedal f car &
controller engine
desired actuator + air resistance actual
speed speed
control
input

speedometer
measured
speed

Figure 33: Cruise Control System

1. There is a DC motor which controls the throttle position. We assume that the engine
force is related to the voltage signal to the DC motor by a constant of proportionality,
E, hence
Feng (t) = Eu(t)
where u(t) is the voltage applied to the DC motor.

2. For simplicity, we assume that the aerodynamic force is proportional to the speed of
the car, hence
Fdrag (t) = v(t)
where is a positive constant.

Hence, the dierential equation relating u, dF (or w) and v is simply

mv(t)
= v(t) + Eu(t) + dF (t)
(10.1)
= v(t) + Eu(t) + Hw(t)

Eq. (10.1) is a first order, Linear, Time Invariant (LTI) Ordinary Dierential Equation
(ODE).

2 Control of the First Order Car Model

We can now return to analyzing both the open-loop and closed-loop response of the cruise
control system, when the car is modeled by the first order ODE in (10.1). Suppose that u(t)
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 126

is constant, at u, and w(t) is constant, w.


The steady-state velocity of the car is just
E H
v = u + w

E H
which is of the simple form (with P :=
, D :=
).

2.1 Open-Loop Control System

In the absence of a disturbance force (w(t) 0), the steady-state speed of the car due to a
constant input voltage u(t) u is
E
v := lim v(t) = u
t
Hence, a feasible Open-Loop control system would invert this relationship, namely

u(t) = vdes (t)
E
Here, we let Kol := E is the open-loop controller gain. Note that this gain must be imple-
mented in the control circuitry, and hence must be computed using values of E and that
are believed accurate.
The equations which govern the open-loop car are now
EKol H
=
v(t) v(t) + vdes (t) + w(t) . (10.2)
m m m

2.2 Closed-Loop Control System

We now consider a closed-loop control system. The feedback controller will be a circuit,
which combines the desired speed voltage (which is also in the same units 1 volt for every
mile/hour) and the actual speed voltage to produce a control voltage, which commands the
throttle positioning DC motor system. For simplicity, take the control law to be a constant
gain control law,
u(t) = Kf f vdes (t) Kf b v(t) (10.3)
The block diagram of the control system is shown in Fig. 34
Plugging this control law into the car model (10.1) gives
E H
v(t)
= v(t) + [Kf f vdes (t) Kf b v(t)] + w(t)
m m m
+ EKf b EKf f H
= v(t) + vdes (t) + w(t) . (10.4)
m m m
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 127

w
H Vehicle
controller

v + +
d + v
des u f 1
K ff E
m dt
desired - control + - actual
speed input speed


K fb
m

Figure 34: Cruise Closed-Loop Control System

2.3 Open/Closed Loop Comparison

Equations (10.2) and (10.4) respectively govern the behavior of the car under open-loop and
closed-loop control. We will compare the performance, using the subcript []ol to refer to
open-loop control, and []cl to refer to closed-loop control.
First notice that both are sysems are governed by first-order linear ODEs with constant
coecients.
First, the time constants are dierent,
m m
Tol = , Tcl = .
+ EKf b

For positive Kf b , the response of the closed-loop system is always faster than that of the
open-loop system.
Now assume that both the desired velocity and the incline disturbance are both constants,
respectively given by vdes , dF . The resulting steady-state speeds (in open and closed-loop)
are
1 EKf f 1
vol = vdes + dF , vcl = vdes + dF
+ EKf b + EKf b
As in the earlier steady state analysis, by selecting Kf b suciently large, and setting

EKf f
1
+ EKf b

we can achieve better disturbance rejection and tracking with closed-loop control than with
open-loop control.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 128

Do a numerical simulation to study the responses of both the open-loop and closed-loop
control system. For the closed-loop system, take Kf b := 8, Kf f := 9.5.
Assume the following numerical values for the parameters: m = 1000, = 60, E = 40 and
H = 98, and assume the following conditions: v(0) = 25.
{
25 if 0 < t < 10
vdes (t) =
30 if t 10

{
0 if t < 80
w(t) =
5 if t 80

The time response of the two control systems is shown below


Velocity (perfect car): Open and ClosedLoop Control
30

29

28

27
Car Velocity

26

25

24

23

22
0 20 40 60 80 100 120 140
Time (seconds)

The control signal u(t) is shown in the figure below


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 129

Control response (perfect car): Open and ClosedLoop Control


85

80

75

70
Control Response (u)

65

60

55

50

45

40

35
0 20 40 60 80 100 120 140
Time (seconds)

3 Integral Control

The car is governed by


= v(t) + Eu(t) + Hw(t)
mv(t)
For a given constant value of vdes , w,
the ideal steady-state input u is
H
u := vdes w
E
This is the only possible value for the steady-state value of u which gives a steady-state
velocity exactly equal to the desired velocity. Note that the correct control depends on
both vdes and w.

However, with our current closed-loop control law, if the car has speed v(t) = vdes , then the
control eort is
u(t) = (Kf f Kf b ) vdes
With the proportional control, the car stops accelerating when the force from the controller
signal balances the force from air resistance and the incline.
The commanded force from the controller, with vdes fixed, is a linear (actually linear+oset,
called ane) function of v. Hence, it is easy to see that for dierent values of w, the car
will cease accelerating (ie. steady-state) for values of v which are dierent from vdes . The
problem is that the instantaneous throttle position is simply a function of the instantaneous
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 130

desired speed and actual speed. There is no mechanism for the throttle to be opened further
if this error in speed does not eventually decrease.
A new strategy should incorporate a term that corresponds to if the speed is below the
desired speed, increase the throttle. A mathematical version of this statement is given
below:
u I (t) = KI [vdes (t) v(t)]
Note that by this strategy, at any time t, for which vdes (t) > v(t), the control law is, at that
instant, increasing the throttle angle. Likewise, at any time t, for which vdes (t) < v(t), the
control law is, at that instant, decreasing the throttle angle. Finally, at any time t, for which
vdes (t) = v(t), the control law is, at that instant, not changing the throttle angle.
Integrating from t = 0 to t gives
t
uI (t) = uI (0) + Ki [vdes () v()] d
0

which shows that the control action, u(t), is a running integral of the error between the
desired value and the actual value. This is called integral control action. As you would
expect, integral control can be used to reduce the steady-state error due to hills.
A block diagram of the closed-loop system, using integral control is shown in Fig. 35.]]

w vehicle
H
controller
vdes + z u + + + v
1
dt KI E dt
- m -
a
m

Figure 35: Cruise Control System with Integral Control

The equation for the car is as before


1
v(t)
= [v(t) + EuI (t) + Hw(t)]
m
The equations for the controller are

z(t)
= vdes (t) v(t)
uI (t) = KI z(t)
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 131

The variable z is called the integrator in the control system, since it is a running integral
of the error vdes v. Recall from circuit theory that an integrating circuit can be built with
a single op-amp and capacitor (we will review this standard circuitry later).
To understand the closed-loop behavior, we need to eliminate uI and z from the equations.
This is done as follows - dierentiate the car equation model, yielding
1
v(t) = [v(t)
+ E u(t)
+ H w(t)]
(10.5)
m
Now u appears, but this is known from the controller equations. In fact

u I (t) = KI z(t)

= KI [vdes (t) v(t)]

Substitute this into (10.5) to yield


1
v(t) = [EKI (vdes (t) v(t)) v(t)
+ H w(t)]

m
which can be manipulated into the form
EKI EKI H
v(t) + v(t)
+ v(t) = vdes (t) w(t)
(10.6)
m m m m
In this final equation, w does not explicitly enter, only w does. Hence, if w(t) approaches
a constant limit, say w, then w 0, and the particular final value of w (ie., w) has
no eect on the limiting value of v(t).
This is the amazing thing about integral control it eliminates the steady-state error due
to steady disturbances.
But, lets go further, and try this out for a realistic car model, with m = 1000kg, E = 40,
= 60, H = 98. The simulation is carried under the following conditions

The initial speed of car is v(t0 ) = 25 m/s.

Initially, the desired speed is vdes (t) = 25m/s.

Initially, the hill inclination is w(t) = 0.

The initial condition on control system integrator is z(t0 ) = 25


EKI

vdes (t) = 30m/s for t 10s.

w(t) = 3 for t 160s.


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 132

Hence, at t = t0 , the value of u(t) is just right to maintain speed at 25m/s, if there is no hill
(check that at t = t0 , the equations for v and z give v(t
0 ) = 0, z(t
0 ) = 0).
The trajectories for vdes (t) and w(t) for t > t0 are shown below.
Velocity Response with Integral Control
32

31

30

29
Car Velocity

28
Increasing KI
27

26

25

24
0 50 100 150 200 250 300
Time (seconds)

Four dierent plots of v(t) are shown, for KI taking on values from 0.03 to 0.24. Although its
not pretty, at steady-state, the value of v(t) is equal to vdes , regardless of the hill. However,
the response is generally unacceptable - either too oscillatory, or too sluggish. Moreover
notice that these type of responses, which include overshoots and oscillations, are not possible
with 1st order systems and are due to the fact that the close loop system is now a second
order dierential equation.

3.1 Cruise Control with Integral Action and Velocity Feedback

Notice that the feedback control system in Eq. (10.3) in Section 2.2 was of the form

u(t) = Kf f vdes (t) Kf b v(t) .

We can replace the feedforward term Kf f vdes (t) by the integral action and keep the feedback
term Kf b v(t). The resulting controller

u(t) = uI (t) Kf b v(t) (10.7)


uI (t) = KI z(t)
z(t)
= vdes (t) v(t)
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 133

consists of an integral action and velocity feedback, and its block diagram is shown in Fig.
36.

w
H vehicle
controller
vdes + z uI + u + + + v
1
dt KI E dt
- - m -
a
K fb m

Figure 36: Cruise Control System with Integral Action and Velocity Feedback

Inserting the control law (10.7) into the dierentiated vehicle dynamics in (10.5) , and
performing a similar set of manipulations to eliminate uI (t) as described above, results in
the following close loop velocity dynamics
( )
EKf b EKI EKI H
v(t) + + v(t)
+ v(t) = vdes (t) w(t)
. (10.8)
m m m m m

Notice that only the coecient that multiplies v(t) has changed when we compare Eq.
(10.8) with the close loop dynamics with I-action alone in (10.6) . This coecient can now
be changed by changing the feedback gain Kf b but it could not be changed in Eq. (10.6) .
Moreover, as in Eq. (10.6) , only w enters explicitly in (10.8) . Hence, if w(t) approaches a
then w 0, and the particular final value of w (ie., w)
constant limit, say w, has no eect
on the limiting value of v(t).
In order to compare the eect of adding the additional velocity feedback action on the cruise
controller with integral action, we repeat the simulations done above with a realistic car
model, with m = 1000kg, E = 40, = 60, H = 98. The simulation are again carried under
the following conditions

The initial speed of car is v(t0 ) = 25 m/s.

Initially, the desired speed is vdes (t) = 25m/s.

Initially, the hill inclination is w(t) = 0.

The initial condition on control system integrator is z(t0 ) = 25


EKI

vdes (t) = 30m/s for t 10s.


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 134

w(t) = 3 for t 160s.


KI = 0.24 and Kf b = 4 or
KI = 0.24 and Kf b = 0.

32
KI = 0.24,
31 K =0
fb
30
Car Velocity

29
K = 0.24,
I
28 K = 0.24, K =0
I
fb
K =4
fb
27

26

25
0 50 100 150 200 250 300
Time (seconds)

Figure 37: Close Loop Response of a Cruise Control System with Integral Action and Velocity
Feedback

Notice that setting the feedback term Kf b = 4 eliminates the oscillations in the response of
the close loop system. In order to fully understand how the values of the control gains KI
and Kf b aect the response of the close loop system, we need to study dierential equations
more carefully.

4 Understanding the Integral Controller By Using Second Order


SLODE

As we saw in section 3, the integral controller was eective at reducing the steady-state
error due to constant slope hills, but the transient response was simply either to slow, or too
oscillatory. Based on our work in section 9, we should be able to explain this undesirable
behavior in terms of n and .
For generality, the analysis will be carried out for a proportional-integral (PI) controller,
which has the form
z(t)
= vdes (t) v(t)
(10.9)
u(t) = KP [vdes (t) v(t)] + KI z(t)
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 135

The behavior of the closed-loop system with just the I-controller can be investigated simply
by setting KP 0.
Recall that the car is governed by
E H
=
v(t) v(t) + u(t) + w(t) (10.10)
m m m
The dierential equation governing the closed-loop system is obtained eliminating z and u
from the equations (10.9) and (10.10). This is obtained by dierentiating equation (10.10)
and substituting from (10.9) for u.
This yields
+ EKP EKI EKI EKP H
v(t) + v(t)
+ v(t) = vdes (t) + v des (t) + w(t)
(10.11)
m m m m m
This is a second order system, and the characteristic equation is
+ EKP EKI
2 + + = 0.
m m
Since this is second order polynomial, we know from section 8 that the conditions for stability
are
+ EKP EKI
> 0, > 0.
m m
In this application, all of the physical variables (m, E, ) are already positive, hence the
conditions for stability are

KI > 0, and KP >
E
The roots of the characteristic equation can be expressed as functions of KP and KI . We
can also express the natural frequency (n ) and damping ratio () in terms of KP and KI
as well. This is easily done, yielding

EKI + EKP
n = , =
m 2 mEKI
Note that

n increases with increasing KI , but is unaected by KP . Roughly, we expect that


increasing KI will increase the speed of response of the system, while KP will not
have a dominant eect on the speed of response.

Th damping ratio, , decreases with increasing KI , but increases with increasing KP .

Of course, if KP = 0 (as in the integral control situation in section 3), then the observations
simplify:
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 136

n increases with increasing KI

the damping ratio, , decreases with increasing KI

This is exactly consistent with our time-domain simulations from section 3.


The roots of the characteristic equation are at

( + EKP ) ( + EKP )2 4EKI m
1,2 = (10.12)
2m
This is simple enough to study how the roots depend on the values of KP and KI .


{ }
1. Fix KP > E
. At KI = 0, the roots are real, at +EK
m
P
, 0 . As KI increases, the
2
two roots remain real, but move toward each other. When KI = (+EK 4Em
P)
, the roots
(+EKP )
are equal, with value 2m
. As KI increases further, the term inside the square
root is negative, so that the real part of the roots remains fixed at (+EK
2m
P)
, while the
imaginary part simply increases with increasing KI . This is sketched in Fig. 38 with
(+EKP )
2m
= 10.

Root Locus

2.5

1.5

1
Imaginary Axis

0.5

0.5

1.5

2.5
10 9 8 7 6 5 4 3 2 1 0
Real Axis

(+EKP )
Figure 38: Roots of Eq. (10.12) for KI [0, ) when 2m
= 10.

2. Fix KI > 0. As KP increases from , the roots are complex, and move in circles with
E

radius EK I
. When KP satisfies ( + EKP )2 = 4EKI , the roots are equal, and real
m

(at EKm
I
). As KP continues to increase, the roots split apart, one going o to ,
and the other root heading
to 0 (from the left, always remaining negative). This is
EKI
sketched in Fig. 39 with m
= 4.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 137

Root Locus

Imaginary Axis
0

4
6 5 4 3 2 1 0
Real Axis


Figure 39: Roots of Eq. (10.12) for KP [
E
, ) when EKI
m
= 4.

Finally, if desired values for n and are given, it is straightforward to solve for the appro-
priate KP and KI ,
mn2 2n m
KI = , KP =
E E
These might be referred to as design equations, since they determine the necessary con-
troller parameters in order to achieve a certain goal (prespecified n and in the closed-loop
system).
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 138

5 Problems
1. Consider the car model, equation (10.1). The model parameters m, , E are positive,
while G is negative. Suppose that for physical reasons, it is known that

u(t) umax

where umax is some fixed, upper bound on the available control action. For the questions
below, assume that w 0 we are on a flat road.

(a) In terms of the parameters, what is the maximum acceleration achievable by the
car? Note: this will be a function of the current velocity.
(b) Starting from v(0) = 0, what is the minimum time, Tmin , for the car to reach a
speed v. Your answer should be Tmin as a function of v, and will depend on the
model parameters.
(c) Take the parameters = 60, E = 40, m = 1000, where all are SI units. Also
suppose that umax = 90. Recompute your answer in part (a), and plot Tmin ( v)
versus v for v in the interval [0, 30 meters/second]. Are the answers reasonable,
and similar to cars that we drive?
(d) Qualitatively, explain how would things change if Fdrag had the form

Fdrag (t) = 1 v(t) 2 v 2 (t)

2. The closed-loop cruise control system equations are given in equation (10.4). Modify
the equations of the controller to include a measurement noise term, so

u(t) = Kf f vdes (t) Kf b v(t) + n(t)


| {z }
vmeasured

Here, n represents the measurement noise. The car parameters are given in Section
2.3.

(a) Define outputs of interest y1 := v and y2 := u (the actual speed and throttle).
Find A, B1 , B2 , C1 , . . . , D23 so that the equations governing the closed-loop system
are
v(t)
= Av(t) + B1 vdes (t) + B2 w(t) + B3 n(t)
(v =)y1 (t) = C1 v(t) + D11 vdes (t) + D12 w(t) + D13 n(t)
(u =)y2 (t) = C2 v(t) + D21 vdes (t) + D22 w(t) + D23 n(t)
Your answer for the coecients will be in terms of the car parameters, and the
feedback gains. Assume that m, E and are positive.
(b) Under what conditions is the closed-loop system stable?
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 139

(c) What is the steady-state ( = 0) gain from vdes to v? Your answer should be in
terms of the car parameters, and Kf f and Kf b .
(d) What is the steady-state ( = 0) gain from w to v? Your answer should be in
terms of the car parameters, and Kf f and Kf b .
(e) What is the steady-state ( = 0) gain from n to v? Your answer should be in
terms of the car parameters, and Kf f and Kf b .
(f) If Kf b is given, what is the correct value of Kf f so that the steady-state gain
( = 0) from from vdes to v is exactly 1? Under that constraint, what are the
values of the steady-state gain from w to v and n to v? What is the motivation
for picking Kf b large? What is a drawback for picking Kf b large?
(g) Consider three cases, Kf b = 2, 4, 8. For each case, compute the appropriate value
of Kf f based on steady-state gain considerations in part 2f above.
(h) Using Matlab (subplot, loglog, abs, semilogx, angle) make a 2-by-3 plot of
the frequency response functions (ie., the sinusoidal steady-state gain) from the
inputs (vdes , w and n) to the outputs (v and u). The plots should be layed out as
shown below.

|Gvdes v |
|Gwv | |Gnv |
Gvdes v

|Gvdes u | |Gwu | |Gnu |

For magnitude plots, use loglog. For angle plots, use semilogx. Each axes
should have 3 plots (associated with Kf b = 2, 4, 8 and the corresponding values
for Kf f .
(i) Using Simulink, compute and plot the responses v and u for the system subjected
to the inputs vdes and w given on page 38/39. Use n(t) = 0 for all t. Do this for
the 3 dierent gain combinations. Plot the two outputs of interest in a 2-by-1
array of subplots, with y1 in the top subplot, and y2 in the bottom. Both axes
should have 3 graphs in them.
(j) Certain aspects of the frequency-response curves are unaected by the specific
(Kf b , Kf f ) values (eg., the graphs are the same regardless of the value, the graphs
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 140

converge together in certain frequency ranges, etc). Mark these situations on your
graphs, and in each case, explain why this is happening. Compare/connect to the
time-response plots if possible/necessary.
(k) Certain aspects of the frequency-response curves are significantly aected by the
specific (Kf b , Kf f ) values (eg., the graphs have dierent magnitudes at low fre-
quency, the graphs bend down (or up) at dierent frequencies, etc). Mark these
situations on your graphs, and in each case, explain why this is happening. Com-
pare/connect to the time-response plots if possible/necessary.
(l) At high frequency, the sinusoidal steady-state gain from vdes to u is not zero. This
is easily observed in the frequency response plots. Where does this show up in
the time response plots? Can you quantitatively connect the two plots?
(m) Notice how the frequency-response from vdes to v is nearly 1 (as a complex num-
ber) over a frequency range beginning at 0 and extending to some mid-frequency
value. Beyond that value, the frequency response plot fades unremarkably to 0.
Moreover, as we increase Kf b the range of frequencies over which the frequency-
response from vdes to v is nearly 1 is extended. Where does this show up in the
time response plots? Can you quantitatively connect the two plots?
(n) Notice that as Kf b increases, the magnitude of the frequency response from w
to v decreases (less eect at high frequency though, and no eect at infinite
frequency). Where does this show up in the time response plots? Can you
quantitatively connect the two plots?
(o) Using Simulink, compute and plot the responses v and u for the system subjected
to the inputs vdes and w given on page 36. From the Sources library, use the
Band-Limited White Noise block. Set the noise power to about 0.033, and the
sample time to 0.1 seconds. Set the Seed field to clock*[0;0;0;0;0;1]. This
means that every time you simulate, Matlab will call the clock function, which
returns a 1-by-6 array (year,month,day,hour,minute,second) and then pick o
the seconds value. This is used as the seed in the random number generator,
ensuring that you get a dierent noise trajectory each time you simulate. Do
this for the 3 dierent gain combinations. Plot the two outputs of interest in a
2-by-1 array of subplots, with y1 in the top subplot, and y2 in the bottom. Both
axes should have 3 graphs in them. Comment on the eec that measurement
noise has on the outputs, and how the increased feedback gain aects this.
(p) In doing the simulation, we chose (nearly) a constant for w, but a quickly, ran-
domly varying signal for n? Why? What is the interpretation of these two signals?
(q) Look at the frequency response plots governing the eect that n has on v and u.
Are these consistent with what you see in part 2o?

One aspect to understanding the performance of closed-loop systems is getting com-


fortable with the relations between frequency responses and time responses.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 141

3. Let yp (t) be a particular solution for the following first order ODE

y(t)
+ ay(t) = b u(t) (10.13)

and assume that a > 0 and b > 0 are real constants.

(a) Assume that the input u(t) is expressed as

u(t) = uR (t) + j uI (t),

where j 2 = 1 and uR (t) and uI (t) are real functions of time.

If a particular solution yp (t) for the above input is expressed as

yp (t) = ypR (t) + j ypI (t),

write down the dierential equations that ypR (t) and ypI (t) respectively satisfy.

(b) Assume that

u(t) = ejt ,

where > 0 is a real constant.

i. A particular solution yp (t) for this input can be written as

yp (t) = G() u(t) . (10.14)

Determine an expression for the complex number G() in terms of the pa-
rameters a, b and .

(continues on the next page)


ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 142

ii. The particular solution yp (t) in Eq. (10.14) can also be written as

yp (t) = M () e(jt+()) .

where M () 0 and () are real. Obtain expressions for M () and ()


in terms of the parameters a, b and .

(c) Assume that


( )
u(t) = cos(t) = Real ejt . (10.15)

where > 0 is a real constant.

i. A particular solution yp (t) for this input can be written as

yp (t) = Y () cos (t + ()) . (10.16)

Determine expressions for Y () and () in terms of a, b and .

ii. Fig. 40 shows the response of the ODE in Eq. (10.13) when the input u(t)
is given by Eq. (10.15) and y(0) = 0. A steady state response is achieved
for t 1.

Determine the values of the parameters , a and b.

4. Consider the cruise-control problem, with parameters E = 40, m = 1000, = 60. Using
a PI controller, choose KP and KI so that the roots of the closed-loop characteristic
equation are in the complex plane, with

n = 0.6, = 1.05

Plot these two roots in the complex plane. For the remainder of this problem, this is
referred to as the ideal case, and those are the ideal roots.
In the notes, we assumed that the relationship between the adjustable voltage u(t)
and the force exerted on the car by the tires is instantaneous (also called static or
non-dynamic), namely
Fengine (t) = Eu(t)
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 143

0.8 u
0.6 y
input u and output y

0.4

0.2

0.2

0.4

0.6

0.8

1
0 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1 1.125 1.25 1.375 1.5 1.625 1.75 1.875 2
Time

Figure 40: Response y(t) for a cosine input function.

Recall that this force is generated in 2 steps first a DC motor must reposition the
throttle, and then the engine must actually produce this force. A slightly more realistic
model for this force generation is

q(t)
= 1 (u(t) q(t))
Fengine (t) = Eq(t)

Note that this has the following properties:

1st order system between u Fengine , with q acting as an internal state variable.
The time constant is , hence the smaller is, the faster the response is.
For a constant input u(t) u, the steady state response is limt Fengine (t) = E u.

NOTE: Although this is a dynamic relationship between u and Fengine , the steady-state
behavior is identical to the original non-dynamic model in the notes.

(a) Draw a block diagram of the closed-loop system, with the full 2nd order model
for the car. Overall, your block diagram should have 3 integrator blocks 1 in
the controller, 1 in the new engine model, and 1 in the car (simply representing
that velocity is the integral of acceleration).
(b) Write down dierential equations for v,
w and z.
Write the equation in the forms

v(t)
= f1 (v(t), q(t), z(t), vdes (t), w(t), parameters)
q(t)
= f2 (v(t), q(t), z(t), vdes (t), w(t), parameters)
z(t)
= f3 (v(t), q(t), z(t), vdes (t), w(t), parameters)
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 144

(c) Define a vector


[ ]
v(t)
x(t) := q(t)
z(t)
Write the equations in the form
[ ]
vdes (t)
x(t)
= Ax(t) + B
w(t)

where A R33 and B R32 are matrices whose entries depend only on the
parameters (E, m, , G, ), and the controller gains (KP , KI ).
(d) Let v be a positive number. Suppose that at some instant t, v(t) = v, q(t) =
v v
E
, z(t) = EK I
, and vdes (t) = v. Using the equations and assuming that w(t) = 0,
show that v(t) = q(t)
= z(t)
= 0. Hence, if vdes remains at this value and w
remains 0, then all of the variables v, q and z remain constant in time. This gives
some idea as to how the initial condition on z is set in the cruise control circuitry
as the cruise control system is turned on while driving.
(e) Now, back to the problem. Dierentiate the v(t)
equation twice, and substitute as
necessary to get a dierential equation for the closed-loop system only involving
v, vdes , w and their derivatives (and the parameters, or course). What is the
characteristic equation of the closed-loop system?
(f) Make a table of the roots of the characteristic equation (there will be three roots)
for several values of , {0.01, 0.033, 0.1, 0.33, 1, 3.3, 10}. Remember, is the time
constant of the dynamic engine model.
(g) Compare the actual roots obtained in part 4f, to the 2 roots obtained at the
beginning of the problem, which are calculated using the non-dynamic engine
model, and to 1
, which is the root of the characteristic equation associated only
with the dynamic engine model. You should note the following pattern:
When the engine speed-of-response is much faster than the ideal closed-loop
response, then the two systems (ideal car/PI controller and fast, but not ideal,
engine) which are in a feedback loop together do not really interact - the
roots of the closed-loop system are pretty much the individual roots. However,
when the engine speed-of-response becomes comparable to the desired response
of the ideal closed-loop system, then interaction takes place, and performance
degradation results. This shows that in some cases, you can neglect very fast
subsystems in your systems, and replace them by their steady-state behavior when
doing the control design. However, the objectives of your simplified control design
(ie., the roots of the characteristic equation) should be significantly slower than
the neglected systems roots in order for the approximation to be accurate.
(h) Using the gains KP and KI calculated for the original ideal system (with non-
dynamic engine model), and Simulink, compute and plot some time responses.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 145

The initial condition should be v(0) = 25, with q(0) and z(0) as derived earlier.
The input signals should be

25 for 0 t 10
30 for 10 t 40
vdes (t) =
35 for 40 t 80
32 for 80 t

and
0 for 0 t 30
3 for 30 t 60
w(t) =
3 for 60 t 90
0 for 90 t
Do these for the values of described above (hence you should get 7 dierent
simulations). On each response plot, also plot the response of the idealized closed-
loop system (without the 1st order engine model), and make a small plot (in a
complex plane) the roots (3 of them) of the closed-loop characteristic equation.

5. Use Simulink to reproduce the plots at the end of section 2.6, concerning the response
of the car using integral control.

6. In this problem, we consider a simple model for the roll axis of an airplane, and start
working on a control system which keeps the plane at a desired roll-angle. A diagram
of the system is shown below.
# 


"!


Take IC = 4.5e5, c = 3.3e5, with also measured in degrees. The dierential equation
model for the roll axis is a simplistic balance of angular momentum for the rigid body
+ c(t)
IC (t) = Ma (t) + Md (t)

where Md (t) is a disturbance moment, caused by external wind and turbulence, and
Ma (t) is the moment generated by the ailerons. A model for the moment exerted by
the ailerons is
Ma (t) = E(t)
where E = 1.4e5 and (t) is the deflection (in degrees) of the ailerons from their
nominal position.
ME 132, Spring 2015, UC Berkeley, F. Borrelli and R. Horowitz 146

(a) Fill in the boxes, signs on summing junctions, and label the signals so that the
block diagram below depicts the cause/eect dynamic relationship between , Md
and .
airplane

- -?
e- - - -
6



(b) (writing a state-space model:) Define x1 (t) := (t), x2 (t) := (t). Find 2 2
matrices A and B (depending only on the parameters E, IC , and c) such that the
airplane model is governed by
[ ] [ ] [ ]
x 1 (t) x1 (t) (t)
=A +B
x 2 (t) x2 (t) Md (t)

Hint: The equation governing x 1 is very simple...


(c) Assume that we have a small powerful motor which will move the ailerons to
any commanded position. Suppose that to control the roll axis, we implement a
proportional control law,

(t) = KP [des (t) (t)]

Write down the closed-loop dierential equation governing the relationship be-
tween (and its derivatives), des and Md (you must eliminate ). What is the
characteristic equation of this closed-loop dierential equation.
(d) Draw a block diagram of the closed-loop system, clearly delineating the plant
(airplane) from the control system.
(e) Design the roll-axis proportional controller gain, KP , to place the roots of the
closed-loop characteristic equation in the complex plane with damping ratio of
= 0.9.
(f) What is n of the roots? Plot a step response (for 10 seconds) of the closed-loop
system for all initial conditions equal to zero (steady, level flight), with Md (t) 0,
des (t) = 10. Also plot the aileron deflection (t) during the manuever.
(g) On an airplane, there are rate gyros which directly measure the roll rate, (t).
Draw a block diagram of the closed-loop system with the control law

(t) = KP (des (t) (t)) KD (t)

(h) What is the characteristic equation of the closed-loop system?


ME 132, Spring 2015, UC Berkeley, F. Borrelli 147

(i) For what values of control gains KP and KD is the closed-loop system stable?
(j) Using both the proportional and the rate feedback, what control do you have
on the roots of the closed-loop characteristic equation?
(k) Choose the gains KP and KD so that the roots of the closed-loop characteristic
equation have = 0.9, n = 1.0.
(l) Plot a step response (for 10 seconds) of the closed-loop system for all initial
conditions equal to zero (steady, level flight), with Md (t) 0, des (t) = 10, and
another response with des (t) 0,
{
0 0<t<2
Md (t) = 5e6 2 < t <= 6
0 t>6

Also plot the aileron deflection (t) during the manuevers.


(m) Plot the magnitude of the acceleration vector of a passenger sitting 2 meters from
the center of the airplane during the large disturbance in the previous part?
(n) How do you expect the real parameter E, which models the relationship between
aileron deflection to moment, would vary with airspeed? Keeping the control gains
KP and KD fixed, recalculate the roots of the closed-loop characteristic equation
for four dierent cases E = 1.0e5, 1.2e5, 1.6e5, 1.8e5. Also, recalculate and plot
the time responses of part 6l. How sensitive is the closed-loop system to these
(upwards of 40%) changes in E?
(o) This problem treats the airplane as a rigid body. If you have ever been in rough
weather on a large passenger jet and looked out the window, you know that this
is not true. What are some of the aspects that this problem has neglected.

7. Consider the block diagram on page 3 of the powerpoint slides from the February 23
lecture.

(a) The control strategy sets u based on the values of vdes , vmeas (= v + n), and its
internal variable z. Write u as a linear combination of these variables.
(b) Dierentiate this expression to get an expression for u involving only vdes , v, n
and their first derivatives.
(c) Dierentiate the governing equation for the car, and substitute for u.
This should
give you dierential equation governing v in the closed-loop system (it should
match with the bottom equation on page 3 of the powerpoint slides).
ME 132, Dynamic Systems and Feedback
Additional Class Notes

Andrew Packard, Roberto Horowitz, Kameshwar Poolla, Francesco Borrelli

Spring 2015

Instructor:

Prof. F. Borrelli and R. Horowitz

Department of Mechanical Engineering


University of California
Berkeley CA, 94720-1740

copyright 1995-2010 A. Packard, Horowitz, Poolla, Borrelli


ME 132, Spring 2015, UC Berkeley, F. Borrelli 149

A Arithmetic of Feedback Loops


Many important guiding principles of feedback control systems can be derived from the
arithmetic relations, along with their sensitivities, that are implied by the figure below.

Process to be controlled
d - H
Controller

r - g - C - G - ?
g -y
e u
6
?
S
 ?
g
yf F ym n
Sensor
Filter

The analysis in this section is oversimplified, and at a detail-oriented level, not realistic.
Nevertheless, the results we derive will reappear throughout the course (in more precise
forms) as we introduce additional realism and complexity into the analysis.
In this diagram,

lines represent variables, and

rectangular block represent operations that act on variables to produce a transformed


variable.

Here, r, d and n are independent variables. The variables e, u, y, ym , yf are dependent, being
generated (caused) by specific values of (r, d, n). The blocks with upper-case letters repre-
sent multiplication operations, namely that the input variable is transformed into the output
variable via multiplication by the number represented by the upper case letter in the block.
For instance, the block labeled Filter indicates that the variables ym and yf are related by
yf = F ym . Each circle represents a summing junction, where variables are added (or sub-
tracted) to yield an output variable. Addition is always implied, with subtraction explicitly
denoted by a negative sign () next to the variables path. For example, the variables r, e
and yf are related by e = r yf .
ME 132, Spring 2015, UC Berkeley, F. Borrelli 150

Each summing junction and/or block can be represented by an equation which relates the
inputs and outputs. Writing these (combining some steps) gives

e = r yf generate the regulation error


u = Ce control strategy
y = Gu + Hd process behavior (A.1)
ym = Sy + n sensor behavior
yf = F y m filtering the measurement

Each block (or group of blocks) has a dierent interpretation.

Process: The process-to-be-controlled has two types of input variables: a freely manipu-
lated control input variable u, and an unknown disturbance input variable d. These
inputs aect the output variable y. As users of the process, we would like to regulate y
to a desired value. The relationship between (u, d) and y is y = Gu + Hd. G is usually
considered known, but with some modest potential error. Since d is unknown, and G
is slightly uncertain, the relationship between u and y is not perfectly known.

Controller: The controller automatically determines the control input u, based on the
dierence between the desired value of y, which is the reference input r, and the
filtered measurement of the actual value of y.

Sensor: Measured variable is the noisy output of another system, called the sensor. Like the
process, the sensor is also subjected to external disturbances. Because these corrupt
the output of the sensor, which is supposed to represent the process output variable,
the disturbance to the sensor is often called noise.

Filter: Electrical/Mechanical/Computational element to separate (as best as possible) the


noise n from the signal ym .

The goal (unattainable) of feedback (the S, F and C) is: for all reasonable (r, d, n), make
y r, independent of d and n, and this behavior should be resilent to modest/small changes
in G (once C is fixed).
Note that there is a cycle in the cause/eect relationships - specifically, starting at yf we
have
r, yf cause e
e causes u
u, d cause y
y, n cause ym
ym causes yf
This is called a feedback loop, and can be beneficial and/or detrimental. For instance,
ME 132, Spring 2015, UC Berkeley, F. Borrelli 151

Note that d (and u) also aects y, and through the the feedback loop, ultimately aects
u, which in turn again aects y. So, although u explicitly only depends on e, through
the feedback loop the control action, u, may in actuality compensate for disturbances
d.

However, through the feedback loop, y is aected by the imperfection to which it is


measured, n.

Eliminating the intermediate variables (such as e, yf and ym ) yields the explicit dependence
of y on r, d, n. This is called the closed-loop relationship.
GC H GCF
y = r + d + n (A.2)
1
| + GCF
{z S} 1
| + GCF
{z S} 1
| + GCF
{z S}
(ry)CL (dy)CL (ny)CL

Note that y is a linear function of the independent variables (r, d, n), but a nonlinear function
of the various component behaviors (the G, H, F , C, etc). Each term which multiplies one
of the external variables is called a closed-loop gain, and the notation for a closed-loop gain
is given.
Now, in more mathematical terms, the goals are:

1. Make the magnitude of (d y)CL significantly smaller than the uncontrolled eect
that d has on y, which is H.

2. Make the magnitude of (n y)CL small, relative to S1 .

3. Make (r y)CL gain approximately equal to 1

4. Generally, behavior should be insensitive to G.

Implications

Goal 1 implies
H

1 + GCF S << |H| ,
which is equivalent to
1

1 + GCF S << 1
This, in turn, is equivalent to |GCF S| >> 1.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 152

Goal 2 implies that any noise injected at the sensor output should be significantly
attenuated at the process output y (with proper accounting for unit changes by S).
This requires
GCF 1

1 + GCF S << |S| .
This is equivalent to requiring
|GCF S| << 1.

So, Goals 1 and 2 are in direct conflict. Depending on which is followed, Goal 3 is accom-
plished in dierent manners. By itself, goal 3 requires
GC
1.
1 + GCF S

If Goal 1 is satisfied, then |GCF S| is large (relative to 1), so


GC GC 1
= .
1 + GCF S GCF S FS
Therefore, the requirement of Goals 1 and 3 are
1
1, |GC| >> 1. (A.3)
FS

On the other hand, if Goal 2 is satisfied, then |GCF S| is small (relative to 1), so
GC
GC
1 + GCF S
Therefore, the requirement of Goals 2 and 3 are
|F S| << 1, GC 1 (A.4)
The requirements in (A.3) and (A.4) are completely dierent. Equation (A.3) represents a
feedback strategy, and equation (A.4) an open-loop, calibration strategy.
Since goal 1 is in opposition to Goal 2, and both cannot be achieved, it is important to
introduce an additional goal, which can be achieved in both cases.

5. Ensure that (d y)CL is not much larger than the open-loop d y gain. For example,
requiring that |(d y)CL | is less than 3 times the open-loop d y gain constrains
GCF S to satisfy |1 + GCF S| > 31 . Note that if |GCF S| >> 1 or |GCF S| << 1, this
condition holds. However, if |GCF S| 1, then it is possible that GCF S 1, which
would violate this goal.

We will revisit this type of goal/constraint many times in later sections.


ME 132, Spring 2015, UC Berkeley, F. Borrelli 153

1 Tradeos

Several of the implications are at odds with each other. Let T (G, C, S, F ) denote the factor
that relates r to y
GC
T (G, C, S, F ) =
1 + GCF S
Recall that G represents the process behavior, how control action u influences the regulated
output y, and that S represents the sensor, which is a transducer (physical device) that
converts the variable y into a measurable quantity ym . Typically both G and S are complex
systems, subject to the environment, and they may age/change slowly with time.
Use T to denote T (G, C, F, S) for short, and consider two sensitivities: sensitivity of T to
G, and sensitivity of T to S. Recall that for any variable X, the sensitivity of T to X is
defined as
T X
SXT
:=
X T
It is unitless.
Simple calculation gives
1 GCF S
SGT = , SST =
1 + GCF S 1 + GCF S
Note that (always!)
SGT = 1 + SST
Hence, if one of the sensitivity measures is very small, then the other sensitivity
measure
T
SG = 0.01), then T
will be approximately 1. So, if T is very insensitive to G (for example
will be nearly 1-to-1 sensitive to S, since the relation shows that SST 1.
Note that while it is impossible for both sensitivity measures to be small (relative to 1), it
is possible for both sensitivity measures to be large. Generally this would represent a bad
design.

2 Signal-to-Noise ratio

Suppose r = 0, so the desired value of y is zero. Consider the eect of d and n on y. If no


control is used C = 0, then y = Hd. For notational purposes, call that yno control . Conversely,
if control is used, then
H GCF
ywith control = d n
1 + GCF S 1 + GCF S

We want to compare the size of the disturbance d to the size of the noise n. However,
they are in dierent units. By redrawing the block diagram, it is clear that Hd should be
compared to S1 n.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 154

Lets look at the ratio of


ywith control

yno control
as compared to the signal-to-noise ratio,
Hd
SN R := n
S

Dividing out gives n


ywith control 1 GCF S S
yno control
= 1+GCF S
+ 1+GCF S Hd
1 GCF S 1
= 1+GCF S
+ 1+GCF S SN R

The desired value of this ratio is 0, since we want y = 0. What are the limits (as related to
the noise-to-signal ratio)?
If Noise-to-Signal ratio is large, the quotient can be made only so small, namely about 1, by
choosing F C 0 (no feedback).
If Noise-to-Signal ratio is small, then by using high-gain (|GCF S| >> 1), the quotient made
about equal to the Noise-to-Signal.

3 Whats missing?

The most important thing missing from the analysis above is that the relationships are not
in fact constant multiplications, and the special nature of the types of signals. Nevertheless,
many, if not all, of the ideas presented here will be applicable even in the more general
setting.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 155

4 Problems
1. (a) For complex numbers A and B, it is a fact that |A + B| |A| + |B|. This is
called the triangle inequality. Draw a picture (in the complex plane) to illustrate
this in a few examples.
(b) Using the triangle inequality, show that for any complex numbers A and B,

|A B| |A| |B|

What is the simple reason that

|A B| |B| |A|

is also true?

2. Suppose L is a complex number, and 0 < < 1.

(a) Show that


1 1

1 + L |L|

1

(b) Show that


1 1
|L| + 1
1 + L

(c) If is very small compared to 1, then


1 1 1
1 +1

Combine the first two parts of this problem into the following quasi-theorem:
If L is a complex number, and 0 < << 1, then

1 1

1 + L |L|

3. Suppose L is a complex number, and 0 < < 1.

(a) Show that


L

1 + L |L|
1
(b) Show that
L
|L|
1+ 1 + L
ME 132, Spring 2015, UC Berkeley, F. Borrelli 156

(c) If is very small compared to 1, then




1+ 1
Combine the first two parts of this problem into the following quasi-theorem:
If L is a complex number, and 0 < << 1, then

L

1 + L |L|

4. Suppose two systems are interconnected, with individual equations given as

= [u(t) y(t)]
S1 : y(t)
(A.5)
S2 : u(t) = 2 [y(t) r(t)]

(a) Consider first S1 (input u, output y): Show that for any initial condition y0 , if
u(t) u (a constant), then y(t) approaches a constant y, that only depends on
the value of u. What is the steady-state gain of S1 ?
(b) Next consider S2 (input (r, y), output u): Show that if r(t) r and y(t) y
(constants), then u(t) approaches a constant u, that only depends on the values
(
r, y).
(c) Now, assume that the closed-loop system also has the steady-state behavior
that is, if r(t) r, then both u(t) and y(t) will approach limiting values, u and
y, only dependent on r. Draw a block-diagram showing how the limiting values
are related, and solve for u and y in terms of r.
(d) Now check your answer in part 4c. Suppose y(0) = 0, and r(t) = 1 =: r for all
t 0. Eliminate u from the equations A.5, and determine y(t) for all t. Make a
simple graph. Does the result agree with your answer in part 4c?

Lesson: since the assumption we made in part 4c was actually not valid, the analysis
in part 4c is incorrect. That is why, for a closed-loop steady-state analysis to be based
on the separate components steady-state properties, we must know from other means
that the closed-loop system also has steady-state behavior.

5. Suppose two systems are interconnected, with individual equations given as

S1 : y(t)
= [u(t) + y(t)]
(A.6)
S2 : u(t) = 2 [r(t) y(t)]

(a) Consider first S1 (input u, output y): If u(t) u (a constant), then does y(t)
approach a constant y, dependent only on the value of u?
(b) Next consider S2 (input (r, y), output u): If r(t) r and y(t) y (constants),
then does u(t) approach a constant u, dependent only on the values r, y?
ME 132, Spring 2015, UC Berkeley, F. Borrelli 157

(c) Suppose y(0) = y0 is given, and r(t) =: r for all t 0. Eliminate u from the
equations A.6, and determine y(t) for all t. Also, plugging back in, determine u(t)
for all t. Show that y and u both have limiting values that only depend on the
value r, and determine the simple relationship between r and (y , u).

Lesson: Even though S1 does not have steady-state behavior on its own, in feedback
with S2 , the overall closed-loop system does.

6. Consider a problem associated with the general block diagram of the section, involving
C, G, H, S and F . Assume that each component has the steady-state, sinusoidal gain
(SStG) property (see end of Section ?? where the SStG property is defined). Also
assume the the overall interconnection has the SStG property as well (remember: as
illustrated in problem 4, the SStG property of an interconnection does not necessarily
follow from the SStG property of the individual systems, since the interconnection may
itself be unstable).
Below are the frequency-response functions of each component.
40 98 j18.5 + 6.25
G() = , H() = , C() =
j1000 + 60 j1000 + 60 j
1
F () = , S() = 1
j0.01 + 1
Plot the following:
1 GCF S
(a) On a single axes, plot 1+GCF S
,
1+GCF S
. These should be log10 -frequency versus
log10 magnitude.
(b) On the plot above, mark the range of frequencies where Goal 1 (disturbance rejec-
tion) is being achieved. Also mark the range of frequencies where Goal 2 (noise
insensitivity) is being achieved. In lecture, we defined these as being some par-
ticular gain being significantly less than 1. For the purposes of your markings,
lets agree on a convention that 0.2 will be the limit for significantly less than
1.
(c) Directly below the first plot, make a second plot, using the same frequency-range,
showing |GCF S|. This plot relates to the first set of plots through problems 2
and 3. Please make the connection between this plot and the plots in part 6a.
(d) Directly below the existing plots, make a plot reflecting Goal 3 (recall Goal 3 is
reference input tracking, which is that the contribution of r to y is about 1). In
other words, in the absence of d and n, y should behave like r. Plot

GC
1
1 + GCF S
Mark the range of frequencies where this is less than 0.2.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 158

(e) Directly below the existing plots, make a plot of the important quantities reflecting
both Goal 1 and Goal 3. Specifically, plot |GC| and |1 F S|. Explain how these
plots are consistent with the plots of Goal 1 and Goal 3, looking at the plots in
part 6a and 6d.
(f) Is there a range of frequencies where Goal 2 and Goal 3 are obtained? We can also
check the separate conditions that would have to hold. Directly below the existing
plots, make a plot of the important quantities reflecting both Goal 2 and Goal 3.
Specifically, plot |1 GC| and |F S|. Explain how these plots are consistent with
the plots of Goal 2 and Goal 3.
(g) Each axes has only a few (1 or 2) plots on them. Create a 2nd copy of the plots,
and then, using dashed lines, add additional lines to the plots for 2 modifications
to F , listed below.
1 1
F () = , and F () =
j0.001 + 1 j0.1 + 1
Roughly, in the frequency ranges where F was already small, we have changed its
magnitude. How does this change manifest itself in Goal 1 and Goal 2.
(h) Create a 3rd copy of the original plots, and then, using dashed lines, add additional
lines to the plots for 2 modifications to C, listed below.
j18.5 + 2 j18.5 + 0.625
C() = , and C() =
j j
Roughly, in the frequency ranges where C was large, we have changed its magni-
tude. How does this change manifest itself in Goal 1 and Goal 2.

7. Use elementary algebra to derive (A.2) from equation (A.1).

8. We have seen many advantages of feedback, particularly the ability to reduce the
eect of external disturbances and to reduce the sensitivity of the of the overall system
to changes in the plant itself. Feedback also has a linearizing eect, which is used
beneficially in the design of amplifiers and actuators. In this problem, we study a
non-dynamic analysis of this property.
Suppose that you can build a high-power amplifier, whose input/output characteristic
is y = (u), as graphed below.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 159

1
(u)

4
5 4 3 2 1 0 1 2 3 4 5
u

The slope of varies from approximately 0.3 to 1.6.


Now, because of power considerations, assume that you can build a low-power amplifier
that is much more linear, in fact, assume that its input/output relationship is u = Ke,
where K is a constant. Consider the closed-loop system shown below.

+ ge-
r - u- y
K () -
6

(a) Write down the relationship between y and r. Because we dont have an exact
formula for , you cannot solve for y in terms of r - instead, you can only write
down the relationship, which implicitly determines how r aects y. Make sure
your equation only involves , r, y and K. It should not involve u or e.
(b) Take K = 5. On graph paper, make a graph of (u) versus u (as above). Also on
the graph, for many dierent values of r, plot
1
r u versus u
K
Each one of these graphs (straight lines) should intersect the (u)-versus-u graph
at one point. Explain why the intersection point gives the value y(r) (for the
specific r). On a separate graph, graph this function y(r) versus r.
(c) Using the relationship you derived in part 8a, and treating it as an implicit de-
scription of the dependence that y has on r, dierentiate it with respect to r to
get y (r).
(d) What should be K be chosen as so that the slope of the closed-loop behavior
between y and r varies at most between 0.9 and 1.1.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 160

B Saturation and Antiwindup Strategies


Often times, the allowable values of the control input u(t) are limited. For instance, there
may be constant absolute upper and lower bounds, u, u such that
u u(t) u
must hold for all t. As examples,

the ailerons on an airplane wing may only deflect about 30 before they reach structural
stops
In a car (the cruise-control example) there is a maximum throttle opening

Other types of constraints are possible: in the airplane example, the ailerons (along with
other movable surfaces) have maximum rates of movement. On a fighter plane, for instance,
there may be a physical limit on the ailerons of 250 /sec.
This can lead to performance, which is worse than the situation with no limits, for two
reasons:

1. Ultimate response-times of the system are usually longer, since the actual inputs are
generally smaller. This is a simple fact-of-life, and must be accepted.
2. The control strategy does not take this possibility into account, and has poor behavior
if there is any time interval where the input becomes saturated. This is potentially
much worse than the first reason, and must be remedied.

In all of these dierent cases, the control action (ie., u(t)) is limited, or constrained. Explicitly
designing the control law to respect these limiting constraints is a very dicult mathematical
problem. Often times, the constraints are dealt with using special tricks, and intuition, often
on a problem-by-problem basis.

1 Saturation

We will consider a special case of the general problem. In the ideal situation, there are no
limits on the control action, and the block diagram of the closed-loop system appears as
usual, as below
e(t) u(t)
+
- i - - - y(t)
r(t) C P
6
ME 132, Spring 2015, UC Berkeley, F. Borrelli 161

The nonideal, or real, scenario is that there is a saturating element in between the controller
and the plant, which limits the control action, regardless of the control systems output.

+
- i
e(t) - udes (t) -
u(t)- -
r(t) C P y(t)
6

The behavior of the saturating element is simply

Umax if udes (t) Umax


u(t) = udes (t) if Umin < udes (t) < Umax
Umin if udes (t) Umin

Note that one manner to think about this situation is that the controller asks for a desired
control input, though the actuator can only deliver inputs that satisfy certain problem-
dependent constraints.
Our goal is to learn how to implement the controller with extra logic so that when u is
in bounds, the performance is the ideal performance, and for scenarios where u reaches
its limits, the presence of the saturating element should not wreak too much havoc on the
performance of the closed-loop system.
First, to see that this may cause problems, consider the cruise-control problem, from Section
4, with PI control. The simulations are performed for several values of Umin and Umax . For
simplicity, we take Umin := Umax (so the saturating element is symmetric, which may or
may not be realistic in a car example...). The details of the simulations are:

parameters are E = 40, = 60, G = 98, m = 1000,

KP and KI are chosen so that the closed-loop poles are characterized by ( = 0.7, n =
0.6).

Initial conditions are v(0) = 25, z(0) = v(0)


EKI
. This choice for z(0) ensures that when
the simluation starts, with vdes (0) = 25 (which is the current speed), the value of z
is the correct value so that speed of the car remains at 25 (until vdes changes, or a
disturbance acts).

Several values of Umax , namely {, 110, 100, 90, 80, 70, 60}

Step change of vdes , from 25 to 30 at t = 10

Step change of d, from 0 to 2.5 at t = 40


ME 132, Spring 2015, UC Berkeley, F. Borrelli 162

Velocity
33

32

31

30

29

28

27

26

25
0 10 20 30 40 50 60

Actual Control
140

120

100

80

60

40

20
0 10 20 30 40 50 60

Controller Integrator
20

18

16

14

12

10

4
0 10 20 30 40 50 60
ME 132, Spring 2015, UC Berkeley, F. Borrelli 163

Note that as Umax decreases, the closed-loop performance degrades quite ungracefully. Even
though the maximum acceleration is limited, and the slope is decreased, the overshoot ac-
tually gets worse!.
The problem is that once the controller output u(t) exceeds Umax , it is of no use for the
variable z to keep increasing, since increases its value, which causes increases in u(t) =
KP [vdes (t) v(t)] + KI z(t) occur with no benefit the maximum force, that associated with
Umax is already being applied. In fact, not only is there no benefit to increasing the variable z
in this scenario, there is actually a significant drawback. Once z is increased beyond a useful
value, decreasing it has no immediate eect, since the value of KP [vdes (t) v(t)] + KI z(t)
is still well above the threshold Umax . So, the control circuitry wastes valuable time getting
z back down to a useful level, at which changes in it actually lead to changes in the true
applied force.
In this case, the accepted terminology is that the integral controller wound up, causing
unnecessary overshoot and oscillations.
In order to avoid integral wind-up, we need some additional circuitry or software in the
control logic which essentially turns o the controller integrator in certain situations.

2 Anti-Windup PI control action

For a general PI controller, let r(t) denote the reference signal, which is the desired value of
the plant output, and let y(t) denote the actual plant output. The PI controller equations
are
z(t)
= r(t) y(t)
(B.1)
udes (t) = KP [r(t) y(t)] + KI z(t)
The saturating element maps the desired control input into the actual control input,

Umax if udes (t) Umax


u(t) = udes (t) if Umin < udes (t) < Umax
Umin if udes (t) Umin

Suppose (for clarity) that KI > 0. You need to rearrange some inequalities if KI < 0. One
viable strategy is

If u is in-bounds, run as usual

If u is at Umax , and r y > 0, running as usual would increase z, increasing udes , at


no benefit, only screwing up the ability to come o (since decreasing z would initially
then have no benefit). So, stop integrator.

If u is at Umax , and r y < 0, continue integrating.


ME 132, Spring 2015, UC Berkeley, F. Borrelli 164

If u is at Umin , and r y > 0, run as usual

If u is at Umin , and r y < 0, stop integrator.

Mathematically, this is

udes (t) := KP [r(t) y(t)] + KI z(t)


if udes (t) Umax and r(t) y(t) z(t)
=0
elseif udes (t) Umax and r(t) y(t) = r(t) y(t)
z(t) (B.2)
if udes (t) Umin and r(t) y(t) z(t)
=0
elseif udes (t) Umin and r(t) y(t) = r(t) y(t)
z(t)

Doing so yields much better performance. The plots are shown on the next page.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 165

Velocity
31

30

29

28

27

26

25
0 10 20 30 40 50 60

Actual Control
140

120

100

80

60

40

20
0 10 20 30 40 50 60

Controller Integrator
8.5

7.5

6.5

5.5

4.5

4
0 10 20 30 40 50 60
ME 132, Spring 2015, UC Berkeley, F. Borrelli 166

3 Alternate architecture for AntiWindup Logic

Shown below is an alternate architecture, that uses traditional feedback to approximately


prevent windup.

-
-
- f - KP - f- - KI -?
f - SAT - G
KP
6
6

? ?
KAW  f

uact,meas
f 1
?
f


If we look at the inner-loop, where the antiwindup loop is, we see



? udes
- e - - KI -e -
6 KP

? uact
KAW  e

Note that the response from uact to udes is a first-order system, with steady-state gain equal
to 1, and time constant equal to KIKKPAW . So, this logic attempts to keep the value of the
output of the integrator (using feedback to the integrators input) such that the desired value
of u stays close to the actual value of u, implicitly preventing integrator windup.
This will be demonstrated in class with a Simulink model, and you will carry this out in lab
next week.

4 Problems
1. In simple mathematical models for actuators (like the motor/aileron control surface on
an airplane), often we would like to capture the fact that the output of the actuator
(the angular position of the flap) cannot move faster than a certain limit, but otherwise
responds like a first-order system.

(a) A block diagram of a model for this behavior is shown below. Assume that > 0.
The saturation block has the static (nondynamic) relationship shown in its block
- the output is the input for small inputs, but beyond a certain range, the output
is limited.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 167

r + v y y
-g - 1 - sat () - -
6

if v >
sat (v) = v if v
if v <

There are actually three (3) dierent regimes in which this model behaves dier-
ently. For each of the cases below, explain what y(t)
is in each regime:
i. What is y(t)
when r(t) < y(t) < r(t) +
ii. What is y(t)
when y(t) < r(t)
iii. What is y(t)
when r(t) + < y(t)
(b) Starting from zero (0) initial conditions, determine the steady-state value of y due
to a step input r(t) = r, where r is some fixed real number. Think carefully how
y will transition from its initial condition of y(0) = 0 to its final value.
(c) An input signal r(t) is shown below. On the same graph, draw the resulting
output y(t), starting from initial condition y(0) = 0. Do this using your results
in part (1a), for the following cases
i. = 0.5, = 0.4.
ii. = 0.5, = 0.7.
iii. = 0.5, = 1.0.
iv. = 0.5, = 1.4.
v. = 0.5, = 5.0.
Two sets of axes are given for your convenience. As you are thinking out roughly
how things look, use the top axes to sketch your ideas. As you finalize your
answer, please make your final (neat) graphs on the bottom axes.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 168

2.5

1.5

0.5

0
0 1 2 3 4 5 6 7 8 9 10

2.5

1.5

0.5

0
0 1 2 3 4 5 6 7 8 9 10
ME 132, Spring 2015, UC Berkeley, F. Borrelli 169

C Robustness Margins
Three common measures of insensitivity of a closed-loop system to variations are

the time-delay margin,

the gain margin, and

the percentage variation margin.

All are easily computed, and provide a quantitative measure of the insensitivity of the closed-
loop system to specific types of variations. The nominal closed-loop system is shown below.

e(t) u(t)
+
- i - - - y(t)
r(t) C P
6

We assume that both P and C are governed by linear, ordinary dierential equations, and
that the nominal closed-loop system is stable.
The perturbed closed-loop system is shown below, with both a gain variation in the plant,
a time-delay in the feedback measurement, and a change in process from P to P .
e(t) u(t)
+
- i - - - - y(t)
r(t) C P
6

delay, T 
f (t) = y(t T )

Note that if T = 0, = 1 and P = P , then the perturbed system is simply the nominal
closed-loop system.
The time-delay margin is characterized by the minimum time delay T > 0 such that the
closed-loop system becomes unstable, with set equal to its nominal value, = 1, and
P = P .
( )
The gain margin is characterized by the largest interval , , containing 1, such that the
( )
closed-loop system is stable for all , , with T set to its nominal value, T = 0, and
P = P
ME 132, Spring 2015, UC Berkeley, F. Borrelli 170

The percentage variation margin is a frequency-dependent bound (), such that the closed-
loop system is stable for all P which satisfy satisfies

P (j) P (j)

< () for all .
P (j)
assuming = 1, T = 0.
Two viewpoints can be taken regarding the interpretation of these margins:

1. We are explicitly concerned about the destabilizing eects of time-delays, gain changes
and percentage changes in frequency responses, and these margins give exact answers
with respect to those variations.
2. While not being explicitly concerned with time-delays and/or gain changes and/or
percentage changes in frequency response functions, we are cognizant of the fact that
the model dierential equation we use for the plant is not entirely accurate. In that
vein, we would like some easily computable information concerning the sensitivity (or
insensitivity) of the stability of the closed-loop system to unmodeled variations. We
use the computed margins as indications of the potential for instability brought on by
variations in the plants behavior.

In any case, the goal of this section is to learn how to compute such margins and do examples
to gain understanding. Initially, we will focus on the gain margin and time-delay margin,
and return to the percentage variation margin at the end of the section.
Since linear, single-input, single-output systems commute, we can redraw the diagram, pre-
serving both the stability characteristics, and the relationship from r to y as
e(t) v(t) L
+
- i - - - - y(t)
r(t) C P
6

delay, T 
f (t) = y(t T )

By convention, if P denotes the nominal plant, then P (s) will denote the transfer function
of the nominal plant. Similar convention for controller and in fact, any dynamical system. A
capital letter denotes the system itself while the hatted capital letter denotes the systems
transfer function.
For certain computational purposes, we denote the cascade of C and P as the system L. In

terms of transfer functions, we have L(s) = P (s)C(s)
is of the
(see section 9). Assume L
form
b1 sn1 + + bn1 s + bn
L(s) = n
s + a1 sn1 + + an1 s + an
ME 132, Spring 2015, UC Berkeley, F. Borrelli 171

This is equivalent to the dierential equation relating v to y as

y [n] (t) + a1 y [n1] (t) + + an1 y [1] (t) + an y(t) = b1 v [n1] (t) + + bn1 v [1] (t) + bn v(t)

Under both types of perturbations, we get that

v(t) = [r(t) y(t T )]


[ ]
Note that for any k, v [k] (t) = r[k] (t) y [k] (t T ) . Plugging in and rearranging gives the
closed-loop delay-dierential equation

y [n] (t) + a1[y [n1] (t) + + an1 y [1] (t) + an y(t) ]


+ [b1 y [n1] (t T ) + + bn1 y [1] (t T )]+ bn y(t T ) (C.1)
= b1 r[n1] (t) + + bn1 r[1] (t) + bn r(t)

It is from this equation that we begin our analysis, though most of our computations will

ultimately involve the transfer function L(s) evaluated along the imaginary axis s = j.

1 Gain Margin

The setup for the gain margin problem is shown in Figure C, with T = 0. Here, a plant
and controller are in closed-loop along with a gain at the plant input. We assume( that)
the closed-loop system is stable for = 1, and we wish to know the largest interval ,
( )
such that closed-loop stability is maintained for all , . Since the closed-loop system
is stable for = 1, it is clear that < 1 < .
With the time-delay T = 0, the dierential equation (C.1) becomes an ordinary dierential
equation,

y [n] (t) + (a[1 + b1 ) y [n1] (t) + + (an1 + bn1]) y [1] (t) + (an + bn ) y(t)
= b1 r[n1] (t) + + bn1 r[1] (t) + bn r(t)

Clearly, the closed-loop characteristic polynomial is a function of , namely

p () = n + (a1 + b1 )n1 + (a2 + b2 )n2 + + (an1 + bn1 ) + (an + bn )

It is a fact from mathematics that the roots of the characteristic polynomial are continuous
functions of the parameter , hence as varies, the roots vary continuously. Therefore,
the only way for a root of p to move (as changes) from the left-half plane
into the right-half plane is to cross the imaginary axis, either at 0, or at some
j, with > 0 (since complex roots come in conjugate pairs, if they cross the
imaginary axis, one will cross positively, and one negatively - we can focus on
one or the other, and for no specific reason, we look at the positive crossing).
ME 132, Spring 2015, UC Berkeley, F. Borrelli 172

Hence, in assessing the gain margin, we are looking for values and , with close to 1,
and 0 such that = j is a root of p . Plugging in gives

(j)n + (a1 + b1 )(j)n1 + (a2 + b2 )(j)n2 + + (an1 + bn1 )(j) + (an + bn ) = 0

Rearranging gives

[(j)n + a1 (j)n1 + a2 (j)n2 + + an1 (j) + an ]


. (C.2)
+ [b1 (j)n1 + b2 (j)n2 + + bn1 (j) + bn ] = 0

This is two equations (since it relates complex quantities) in two real unknowns ( and ).
We need to find all solutions, and then isolate the solutions whose coordinate is closest to
1.
First, we can look for solutions to (C.2) by looking for imaginary-axis roots (ie., real ) to
p=0 (j) = 0, namely

(j)n + a1 (j)n1 + a2 (j)n2 + + an1 (j) + an = 0.

If there are roots, then coupled with = 0, we have found some solutions to equation (C.2).
There likely are others, with = 0, which are described below.
We can also look for solutions to (C.2) with (j)n + a1 (j)n1 + a2 (j)n2 + + an1 (j) +
an = 0, so that after dividing, we manipulate equation (C.2) into

b1 (j)n1 + b2 (j)n2 + + bn1 (j) + bn


1 =
(j) + a1 (j)n1 + a2 (j)n2 + + an1 (j) + an
n

But, this is recognized as



1 = L(s)
s=j


This can be solved graphically, finding values of for which L(s) is a real number (and
s=j
then taking a negative reciprocal to find the associated value).
Summarizing, a simple method to determine all solutions to equation (C.2) is

1. Let i denote all (if any) of the real solutions to

(j)n + a1 (j)n1 + a2 (j)n2 + + an1 (j) + an = 0.

If there are any, then the pairs (i , 0) are solutions to equation C.2.

2. Next, plot (in the complex plane, or on separate magnitude/phase plots) the value of

L(j) as ranges from 0 to . By assumption, this plot will not pass through the
1 point in the complex plane (can you explain why this is the case?).
ME 132, Spring 2015, UC Berkeley, F. Borrelli 173

3. Mark all of the locations, {1 , 2 , . . . , k }, where L(j)


is a real number. The fre-
quencies k are called the phase-crossover frequencies. Sometimes, the terminology
phase-crossover frequencies only refers to frequencies where where L(j) is a negative
real number.
4. At each phase crossover point, k , determine the associated value of by computing
1
k :=

L(s)
s=jk

5. Make a list of all of the values obtained in the calculations above (step 1 and 4).
For all solutions with k < 1, find the one closest to 1. Label this . Similarly, for all
solutions with k > 1, find the one closest to 1. Label this . In the event that there
are no solutions less than 1, then = . Similarly, if there are no solutions greater
than 1, then = .

Graphically, we can determine the quantity easily. Find the smallest number > 1 such
that if the plot of L(j) were scaled by this number, it would intersect the 1 point. That
is . This is easily done by computing the closest intersection of the curve L(j) (as
varies) with the real axis, to the right of 1, but less than 0. If the intersection occurs at
the location , then scaling the plot of L by 1 will cause the intersection. By choosing

the closest intersection, is close to 1, and hence := 1 is the desired value. Note: It

is possible that there are no intersections of the curve L(j) of the real axis to the right of
1 but less than 0. In that case, the closed-loop system is stable for all values of in the
interval [1, ), hence we define := .

If the plot of L(j) as varies intersects the negative real axis to the left of 1, then > 0,
and it is easy to determine. Simply find the largest positive number < 1 such that if the plot

of L(j) were scaled by , it would intersect the 1 point. This is easily done by computing

the closest intersection of the curve L(j) (as varies) with the real axis, to the left of 1.
If the intersection occurs at the location , then scaling the plot of L by 1 will cause the

intersection. By choosing the closest intersection, is close to 1, and hence := 1 is the
desired value.

In the above computations, each intersection of the curve L(j) (as varies) with the
negative real axis is associated with two numbers:

1. The location (in the complex plane) of the intersection, of which the negative reciprocal
determines the gain that would cause instability.
2. The value of at which the intersection takes place, which determines the crossing
point (on the imaginary axis) where the closed-loop root migrates from the left-half
plane into the right-half plane, and hence determines the frequency of oscillations just
at the onset of instability due to the gain change.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 174

2 Time-Delay Margin

The homogeneous equation, with = 1, but T > 0 of equation (C.1) is


y [n] (t) + a1 y [n1] (t) + + an1 y [1] (t) + an y(t)
(C.3)
+ b1 y [n1] (t T ) + + bn1 y [1] (t T ) + bn y(t T ) = 0
Recall that we assume that for T = 0, the system is stable, and hence all homogeneous
solutions decay exponentially to 0 as t . It is a fact (advanced) that as T increases
the system may eventually become unstable, and if it does, then at the critical
value of T for which stability is violated, sinusoidal solutions to the homoge-
neous equation exist. In other words, the system goes unstable by first exhibiting purely
sinusoidal homogeneous solutions. The frequency of this sinusoidal solution is not known
a-priori, and needs to be determined, along with the critical value of the time-delay.
The delay terms may cause a non-decaying homogeneous solution to exist. We pose the
question: what is the minimum T and corresponding frequency such that a sinusoidal
solution to (C.3) of the form yH (t) = ejt exists? If such a solution exists, then by plugging
it into (C.3), and canceling the common ejt term, which is never 0, we get a necessary
algebraic condition
(j)n + a1 (j)
[
n1
+ + an1 j + an ]
jT
e b1 (j)n1 + + bn1 j + bn = 0
Rearranging gives
b1 (j)n1 + b2 (j)n2 + + bn1 (j) + bn
1 = ejT
(j) + a1 (j)n1 + a2 (j)n2 + + an1 (j) + an
n

But, this is recognized as



1 = ejT L(s)
s=j

This is two equations (since it relates complex quantities) in two real unknowns (T and ).
We want to solve for solutions with T close to 0 (recall that 0 was the nominal value of T ,
and we assumed that the closed-loop system was stable for that). Since T is real,
it follows

jT

that e = 1. This gives conditions on the possible values of , namely L(j) = 1.
Once these values of are known, the corresponding values of T can be determined, and
the smallest such T becomes the time-delay margin.
In order to understand the graphical solution techniques described, recall that for any com-
plex number , and any real number , we have
ej = +
Hence, at any value of , we have
ejT L(j)
= T + L(j)

ME 132, Spring 2015, UC Berkeley, F. Borrelli 175

Also, (1) = .
Hence, a simple method to determine solutions is:


1. Plot (in the complex plane, or on separate magnitude/phase plots) the quantity L(j)
as varies from 0 to .


2. Identify all of the frequencies i > 0 where L(ji ) = 1. These are called the gain-
crossover frequencies.


3. At each gain-crossover frequency i , (which necessarily has L(j i = 1), determine
)
the value of T > 0 such that eji T L(j
i ) = 1. Recall that multiplication of any
ji T
complex number by e simply rotates the complex number i T radians in the
clockwise (negative) direction. Hence, each T can be determined by calculating the

angle from L(j) to 1, measured in a clockwise direction, and dividing this angle
by . On a phase plot, determine the net angle change in the negative direction
(downward) to get to the closest odd-multiple of (or 180 ).
4. Repeat this calculation for each gain-crossover frequency, and choose the smallest of
all of the T s obtained.

3 Percentage Variation Margin

Suppose that P and C are the transfer functions of a plant and controller, respectively.
Assume that the closed-loop system, shown below, is stable.

u2

e1 y1 ? e2 y2
u1 - k - C - k - P -
6

Hence all of the closed-loop transfer functions (from ui to ej and from ui to yk ) have poles
in the open-left-half plane.
Suppose that due to uncertainty, the actual plant transfer function is
Pactual = P (1 + (s))
ME 132, Spring 2015, UC Berkeley, F. Borrelli 176

where is an unknown, stable system, representing the uncertainty in P . In block-diagram


form, Pactual looks like

-
? -
-e -
P

With this model, it follows that


Pactual P
=
P
so in some sense, represents a relative uncertainty.
In this case, the closed-loop system is actually of the form

-
-e - C -?
e -?
e - P -
6

P C
Note that is eectively in positive feedback with the transfer function 1+P C
. In other
words, the perturbed closed-loop system can be thought of as the feedback interconnection
P C PC
of two stable systems, namely and 1+P C
. Since the nominal closed-loop is stable, 1+P C
is
stable, and hence the addition of the stable transfer function can only lead to instability
if the loop introduced by that introduces is unstable.

? P C
6 1+P C

-e - C -?
e -?
e - P -
6

Therefore, stability of the perturbed closed-loop can be assessed by studying the stability of
ME 132, Spring 2015, UC Berkeley, F. Borrelli 177

-e - -
6

 P C  ?
e
1+P C

where only limited information about is available. For this type of analysis, we

3.1 The Small-Gain Theorem

This section presents an important theorem from system theory, called the Small Gain
Theorem. We introduce it in its simplest form, and then derive a test for establishing
stability in the presence of uncertain components.

Small Gain Theorem: Suppose G is a stable system. Let G(s) be its transfer function. If


max G(j) <1 (C.4)
R

then the unity feedback connection of G, shown below, is stable.

+d -
-
u -y
r G
+6

Derivation: Let the transfer function of G be

N (s) b0 sn + b1 sn1 + + bn1 s + bn


G(s) = = n
D(s) s + a1 sn1 + + an1 s + an

where the N and D are polynomials. By assumption of stability of G, we know that the
roots of D(s) = 0 are all in the left-half plane. Also, setting s = j, and taking very large,
the assumption in equation (C.4) implies that |b0 | < 1.
The characteristic polynominal of the feedback connection is

p(s) = N (s) D(s)

We want to verify that the roots of p(s) = 0 all have negative real-parts.
For 0 1, consider the polynomial

p (s) = N (s) D(s)


= ( b0 1)sn + ( b1 a1 )sn1 + + ( bn an )
ME 132, Spring 2015, UC Berkeley, F. Borrelli 178

For every value of in between 0 and 1, this is an nth order polynomial, and it has n roots.
Note that at = 0 and = 1, we have two extremes.

p0 = D(s), p1 (s) = p(s)

We ultimately want to conclude that p1 has no roots in the RHP.

We know that the roots of p0 all have negative real parts.

We know that the roots of p are continuous functions of .

Note: If we show that for every in between 0 and 1, the polynomial p has no roots on
the imaginary axes (ie., no roots with zero real-parts), then it must be that p0 and p1 have
the same number of roots in the left-half-plane (since as varied from 0 to 1, no roots cross
the imaginary axes).
So, pick any in between 0 and 1, and any . By assumption

N (j)

| G(j)| = |G(j)| < 1
D(j)

Hence N (j) D(j) = 0. This shows that for every in between 0 and 1, the polynomial
p has no roots on the imaginary axes, completing the proof.
Small Gain Theorem #2: Suppose G and H are both stable systems. If


max G(j) H(j) <1
R

then the feedback connection of G and H, shown below, is stable.

-e - G -
6

 ?
H  e

Derivation: The cascade of G and H is itself a stable system, and the frequency response
function of the cascade is the product of the individual frequency responses.
Corollary: Suppose G and H are both stable systems. If


max G(j) max H(j) <1
R R

then the feedback connection of G and H is stable.


ME 132, Spring 2015, UC Berkeley, F. Borrelli 179

3.2 Necessary and Sucient Version

Theorem NS1: Suppose G is a given, stable system. Given any > 0, if




max G(j) > ,
R

then there is a stable system H such that


1

max H(j) <
R
such that the feedback connection of G and H is unstable.
Theorem NS2: Suppose G is a given, stable system. Assume G(j) = 0 for all R.
R with
For any frequency > 0, there exists a stable system H such that

1. for all R, =

1
|H (j)| <
G(j)
2. at
,
1
|H (j
)| =
)
G(j
3. The feedback connection of G and H is unstable.

There are two independent facts about transfer functions that are used to prove these theo-
rems
Fact 1: Given a positive > 0, and a complex number , with Imag () = 0, there is a
> 0 such that by proper choice of sign

s
|| =
s + s=j

Remark: In other words, given any positive frequency > 0, and any complex number
, there is a stable, first-order system, (s) that has a flat frequency-response magnitude
(across all frequency) and satisfies (j
) = .
s
The proof is as follows (details provided in class): For a positive , the plot of as s
s+
takes on values of j, with ranging from 0 to +, traverses a circular arc in the complex
plane, from 1 (at = 0) to 1 (as +) clockwise, centered at 0, and in the top-half of
s
the complex plane. Similarly, the plot of as s takes on values of j, with ranging
s+
from 0 to +, traverses from 1 (at = 0) to 1 (as +) clockwise, in the bottom-half
plane. Therefore, the choice of + or sign depends on the imaginary part of . Here is a
constructive procedure for the case Imag() > 0 (verify that this is indeed correct).
ME 132, Spring 2015, UC Berkeley, F. Borrelli 180

1. Write as = || ej for a real number .



1cos
2. Pick :=
1+cos

If Imag() < 0, use above procedure with replacing . Then, add the () sign to the
transfer function.
Fact 2: For any
> 0 and any 0 < < 1, define the transfer function
2
s
I(s) :=
s2 + 2 2
s +
Then

1. for all R, =

1
|I(j)| <
G(j)
2. at
,
I(j
) = 1
3. I is stable.

The proof of this is just simple verification of the claims.


Now, returning Theorem NS1. Suppose G is a given, stable system, > 0, and


max G(j) > ,
R


> 0 so that G(j
Pick ) > . Next, construct H using the construction above, with
1
:= . It follows that
G(j )

1 1
max H(j) = <
R
G(j )
( )
H(s)

and 1 + G(s) = 0, implying that 1
1+GH
has a pole at s = j
.
s=j

Alternatively, for Theorem NS2, since G(j) is never 0, it follows that you can write
nL (s)nR (s)
G(s) =
d(s)
where the roots of nL (s) = 0 are in the open left-half plane, and the roots of nR (s) = 0 are
in the open right-half plane. Define
d(s)
(s) :=
nL (s)nR (s)
There are two relevant facts about the polynomial nR (s), which are:
ME 132, Spring 2015, UC Berkeley, F. Borrelli 181

1. since the roots of nR (s) = 0 are in the open right-half plane, it follows that the roots
of nR (s) = 0 are in the open left-half plane;

2. since the coecients of nR (s) are real, it follows that nR (j) is the complex conjugate
of nR (j) and consequently the magnitudes are the same.

Therefore is stable, and for all


1
|(j)| =
|G(j)|
Now pick > 0, and the proper choice of so that

s 1
(s) =
s+ s=j
G(j
)

Finally with any 0 < < 1, define H as


2
s s
H(s) := () (s)
s2 + 2
s + 2
s+
It is easy to verify that H has all of the properties claimed in Theorem NS2.

3.3 Application to Percentage Variation Margin

Recall that the stability of the perturbed closed-loop can be assessed by studying the stability
of

-e - -
6

 P C  ?
e
1+P C

P C
We can now apply the various small-gain theorems, with 1+P C
playing the role of G, and
playing the role of H.
The first small gain theorem implies that if is stable, and satisfies

1 1 + P C(j)
|(j)| < P C(j) =
P C(j)
1+P C(j)

for all , then stability is assured.


By contrast, Theorem NS2 implies that for any
, there exists a stable such that
ME 132, Spring 2015, UC Berkeley, F. Borrelli 182

1. for all R, =

1 + P C(j)
|(j)| <
P C(j)
2. at
,
1 + P C(j)
)| =
|(j
P C(j)
P C
3. The feedback connection of 1+P C
and is unstable, with a closed-loop pole at s = j
.

Hence, the function


1 + P C(j)

MP V () :=
P C(j)
is a robustness margin, representing how much relative uncertainty, frequency-by-frequency,
that can tolerated in the plant without loss of stability in the closed-loop system.

4 Summary

We have introduced 3 margins. Each measure, in dierent senses, how close the loop gain, L,
gets to the (-1) point. The gain margin measures the distance along the real axis; the time-
delay margin measures the distance along a circular arc (the unit circle) and normalizes by
frequency; while the Percentage-Variation margin quantifies the distance in a more absolute
manner. All 3 margins are easy to compute, knowing the loop-gain, and should be computed
and compared when understanding tradeos between multiple competing control system
designs.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 183

5 Examples

5.1 Generic

Consider a system with


4
L(s) =
(0.5s + 1)3


The plots of L(j) , L(j), and L(j)
as varies are shown below. We will do calculations
in class.
Loop Gain Nyquist Plot
1
10 1

0.5

0
10
0.5

1.5
1
10

2.5

2
10 3
0 1
10 10 1 0.5 0 0.5 1 1.5 2 2.5 3 3.5 4

Loop Phase
0

50

100

150

200

250
0 1
10 10
ME 132, Spring 2015, UC Berkeley, F. Borrelli 184

5.2 Missile

A missile is controlled by deflecting its fins. The transfer function of a the Yaw axis of a
tail-fin controlled missile is
0.5(s2 2500)
P (s) =
(s 3)(s2 + 50s + 1000)

A PI controller, with transfer function

10(s + 3)
C(s) =
s
is used. This results in a stable closed-loop system, with closed-loop roots at

8.1 j14.84, 18.8, 6.97


are shown below, along with some time responses.
Plots of the L
ME 132, Spring 2015, UC Berkeley, F. Borrelli 185

2
10
Log Magnitude

1
10

0
10

0 1 2
10 10 10
Frequency (radians/sec)

220

200
Phase (degrees)

180

160

140

120

100

80
0 1 2
10 10 10
Frequency (radians/sec)
ME 132, Spring 2015, UC Berkeley, F. Borrelli 186

Nyquist Plot
2

1.5

0.5

0.5

1.5

2
5 4 3 2 1 0 1

OpenLoop Missile Step Response


0.5

0.4

0.3
Gs

0.2

0.1

0.1
0 0.05 0.1 0.15 0.2 0.25 0.3
Time: seconds
ME 132, Spring 2015, UC Berkeley, F. Borrelli 187

Missile Acceleration Response


2

1.5
Yaw Acceleration: Gs

0.5

0.5
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time: Seconds

Fin Deflection
12

10

4
Degrees

8
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time: Seconds
ME 132, Spring 2015, UC Berkeley, F. Borrelli 188

5.3 Application to percentage variation margin

Take the missile example from Section 17,

0.5(s2 2500) 10(s + 3)


P (s) = , C(s) =
(s 3)(s2 + 50s + 1000) s

We will also try


1
Pperturbed (s) = P (s)
s + 1
Note this is the same as [ ]
1 s
P (s) = P (s) 1 +
s + 1 s + 1
Hence, the percentage variation in going from P to Pperturbed is

Pperturbed P s
=
P s + 1
Lets plot the magnitude of this versus the percentage-variation margin for dierent values
of .
ME 132, Spring 2015, UC Berkeley, F. Borrelli 189

3
10

2
10

1
10

0
10

1
10

2
10

3
10
0 1 2 3
10 10 10 10

220

200

180

160

140

120

100

80
0 1 2 3
ME 132, Spring 2015, UC Berkeley, F. Borrelli 190

3
10

2
10

1
10

0
10

1
10

2
10

3
10

4
10

5
10
0 1 2 3
10 10 10 10

Step Response
2

1.5

1
Amplitude

0.5

0 0.5 1 1.5
Time (sec)
ME 132, Spring 2015, UC Berkeley, F. Borrelli 191

3
10

2
10

1
10

0
10

1
10

2
10

3
10
0 1 2 3
10 10 10 10

Step Response
2

1.5

1
Amplitude

0.5

0 0.5 1 1.5
Time (sec)
ME 132, Spring 2015, UC Berkeley, F. Borrelli 192

6 Problems
1. Consider the multiloop interconnection of 4 systems shown below.

F 

r -d - +?
+- y
E d -d - H -
6 6
? ?
p z
G 
q

(a) What is the transfer function from q to z? Denote the transfer function as Gqz
(b) What is the transfer function from q to p? Denote the transfer function as Gqp
(c) Verify that 1 + Gqp = Gqz .

2. Suppose C(s) = 4s and P (s) = 2 in a standard Controller/Plant feedback architecture,


with negative feedback.

(a) Is the closed-loop system stable?


(b) What is the closed-loop transfer function from r to y.
(c) What is the steady-state gain from r y?
(d) What is the time-constant of the closed-loop system.
(e) What is the time-delay margin? Denote it by Td . At what frequency will the
self-sustaining (ie., unstable) oscillations occur?
1
(f) Verify your answers with Simulink, using time delays of 0, T , 3T , 5T , 7T ,
10 d 10 d 10 d 10 d
9
T , 9.9 T .
10 d 10 d

3. Suppose C(s) = Ks and P (s) = in a standard Controller/Plant feedback architecture,


with negative feedback. Assume both and K are positive.

(a) Is the closed-loop system stable?


(b) What is the closed-loop transfer function from r to y.
(c) What is the steady-state gain from r y?
(d) What is the time-constant of the closed-loop system.
(e) What is the time-delay margin?
(f) What is the ratio of the time-constant of the closed-loop system to the time-delay
margin? Note that this ratio is not a function of and/or K.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 193

4. The transfer functions of several controller/process (C/P ) pairs are listed below. Let
L(s) := P (s)C(s) denote the loop transfer function. For each pair, consider the closed-
loop system

e(t) u(t)
+
- i - - - y(t)
r(t) C P
6

determine the closed-loop characteristic polynomial;


compute the roots of the closed-loop characteristic polynomial, and verify that
the closed-loop system is stable;
for the gain-margin problem, find all of the phase-crossover frequencies, and the
value of L at those frequencies;
determine the gain-margin of the closed-loop system;
for the time-delay-margin problem, find all of the gain-crossover frequencies, and
the value of L at those frequencies;
determine the time-delay-margin of the closed-loop system;
determine and plot (as a function of frequency) the percentage-variation margin,
considering changes in P . For cases (a) and (b) below, plot this margin on the
same plot for comparison purposes later.

The systems are:


2.4s+1 1
(a) C(s) = s
, P (s) = s1
0.4s+1 1
(b) C(s) = s
, P (s) = s+1
10(s+3) 0.5(s2 2500)
(c) C(s) = s
, P (s) = (s3)(s2 +50s+1000)

5. In problem 4 above, the first two cases have identical closed-loop characteristic polyno-
mials, and hence identical closed-loop roots. Nevertheless, they have dierent stability
margins. In one case, the plant P is unstable, and in the other case it is stable. Check
which case has better stability margins in each of the dierent measures. Make a con-
clusion (at least in the case) that all other things being equal, it is harder to reliably
control an unstable plant than it is a stable one. This is a similar conclusion to what
we reached in problem 9 of Section 7.

6. Find Le for determining time-delay and/or gain margins at the locations marked by
1, 2 and 3.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 194

d - C -d 1 - A - G - G -
1 1 2
6 6

C2  2

7. A closed-loop feedback system consisting of plant P and controller C is shown below.

e(t) u(t)
+
- i - - - y(t)
r(t) C P
6

It is known that the nominal closed-loop system is stable. In the presence of gain-
variations in P and time-delay in the feedback path, the closed-loop system changes
to
e(t) u(t)
+
- i - - - - y(t)
r(t) C P
6

delay, T 
f (t) = y(t T )

In this particular system, there is both an upper and lower gain margin - that is, for
no time-delay, if the gain is decreased from 1, the closed-loop system becomes
unstable at some (still positive) value of ; and, if the gain is increased from 1, the
closed-loop system becomes unstable at some value of > 1. Let l and u denote
these two values, so 0 < l < 1 < u .
For each fixed value of satisfying l < < u the closed-loop system is stable.
For each such fixed , compute the minimum time-delay that would cause instability.
Specifically, do this for several (say 8-10) values satisfying l < < u , and plot
below.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 195

Min TimeDelay

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2 2.1 2.2 2.3 2.4 2.5
GAMMA

The data on the next two pages are the magnitude and phase of the product P (j)C(j).

They are given in both linear and log spacing, depending on which is easier for you to
read. Use these graphs to compute the time-delay margin at many fixed values of
satisfying l < < u .
2
10 4

3.75

3.5

3.25

3
1
10 2.75

2.5
Magnitude
Magnitude

2.25

1.75
0
10 1.5

1.25

0.75

0.5
1
10
1 0 1 2
10 10 10 10 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Frequency, RAD/SEC Frequency, RAD/SEC
ME 132, Spring 2015, UC Berkeley, F. Borrelli 196

220 210

210 207.5

205
200
202.5
190
200
180 197.5

170 195
Phase (DEGREES)

Phase (DEGREES)
192.5
160
190
150
187.5
140
185

130 182.5

120 180

177.5
110
175
100
172.5

1 0 1 2 170
10 10 10 10 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Frequency, RAD/SEC Frequency, RAD/SEC

8. An unstable plant, P , with dierential equation relating its input u and output y,

y(t) 16y(t)
+ 15y(t) = u(t)
+ 5u(t)

is given.

(a) Calculate the range of the parameter KP for which the closed-loop system is
stable.
+ e e-
r - u- -
y
KP P
6

(b) If KP = 30, what is the steady state error, ess , due to a unit-step reference input?

(c) A integral controller will reduce the steady-state error to 0, assuming that the
closed-loop system is stable. Using any method you like, show that the closed-
loop system shown below, is unstable for all values of KI .

+ e e-
r - - KI u- -
y
6 P

(d) Find a PI controller, that results in a stable closed-loop system.


ME 132, Spring 2015, UC Berkeley, F. Borrelli 197

(e) Consider the system with just Proportional-control, along with a time-delay, T ,
in the feedback path. We wish to determine the maximum allowable delay before
instability occurs. Find the equation (quadratic in 2 ) that must satisfy for
there to exist homogeneous solutions yH (t) = ejt for some . The equation
should involve , KP , and the parameters in the plant, but not the time delay, T .
+ e e-
r - u- y
-
KP P
6

 delay, T 

(f) For two cases of proportional control: KP = 20 and KP = 30; determine in each
case the time delay T that will just cause instability and the frequency of the
oscillations as instability is reached.
9. Let L be the transfer function of a system. Consider the diagram below.
q
z6 6 p
d -?
d - L
6

Let N denote the transfer function from q to z. Let S denote the transfer function
from q to p. Derive N and S in terms of L.
10. In the diagram below,

d - PI - d 1- - -
6 6

KD 2

derive S, N and L at each marked location. In each case, verify (after the derivation)
that
N 1S
L= =
1+N S

D Nonlinear Systems
ME 132, Spring 2015, UC Berkeley, F. Borrelli 198

1 Input-output Dierential Equation Models

So far, we have focused our study on linear time invariant (LTI) systems. But, a great
many models of physical processes that we may be interested in controlling are not linear.
Fortunately, the study of LTI systems is a vital tool in learning how to control even nonlinear
systems. Essentially, feedback control algorithms make small adjustments to the inputs based
on measured outputs. For small deviations of the input about some nominal input trajectory,
the output of a nonlinear system looks like a small deviation around some nominal output.
The eects of the small input deviations on the output is well approximated by a linear
(possibly time-varying) system.
Many nonlinear systems are modeled by nonlinear dierential equations that relate the inputs
u to the outputs y like:
+ 7 cos(y) = 4u2 + uy
y + 3yy
When we have many inputs and many outputs, we will still have dierential equations but
there will be more of them. We will have one dierential equation for each output.
We cannot use transfer function methods for nonlinear systems. Transfer functions make
sense only of linear time-invariant dierential equations.

2 State-space Realizations

We can rewrite nth nonlinear dierential equation models as a set of n coupled first-order
dierential equations. For example, consider the dierential equation model

+ 7 cos(y) = 4u2 + uy
y + 3yy

Define the states by


x1 = y, x2 = y
We can then re-write this dierential equation model as

x 1 = y = x2
x 2 = y = 3yy
7 cos(y) + 4u2 + uy = 3x1 x2 7x1 + 4u2 + ux1
y = x1

We cannot write these equations in matrix form as we did for LTI dierential equations. But
note the form of these equations:

x 1 = f1 (x1 , x2 , u) = x2
x 2 = f2 (x1 , x2 , u) = 3x1 x2 7x1 + 4u2 + ux1
y = h(x1 , x2 , u) = x1
ME 132, Spring 2015, UC Berkeley, F. Borrelli 199

More generally, for a m input, p output nonlinear dierential equation model, we would get
equations like
x 1 = f1 (x1 , , xn , u1 , , um )
.. ..
. .
x n = fn (x1 , , xn , u1 , , um )
y1 = h1 (x1 , , xn , u1 , , um )
.. ..
. .
yp = hp (x1 , , xn , u1 , , um )

Here each of the possibly nonlinear functions f1 , , fn and h1 , , hp are scalar-valued.


These equations are quite a mess to write down. By introducing the notation:
x = (x1 , , xn ), u = (u1 , , um ), y = (y1 , , yp )
we can write these equation more compactly in standard state-space form as
x = f (x, u)
y = h(x, u)
Note that in this form, the nonlinear functions f and h are vector-valued. This means that
there are actually many scalar functions contained in the symbols f and h.

3 Example: Magnetically Suspended Ball

We will study a magnetically suspended ball in homework and in lectures. This consists of
a ball of mass m suspended by an electromagnet as shown below. Let y be the position
of the ball, measured down from the base of the electromagnet. If a current u is injected
into the coils of the electromagnet, it will produce a magnetic field which in turn exerts an
upward force on the ball given by Fup = cu2 /y 2 . Note that the force decreases as the 1/y 2
because the eect of the magnet weakens when the ball is further away, and that the force
is proportional to u2 which is representative of the power supplied to the magnet.
Let us assume that we can measure the position y of the ball. This can be arranged optically
using light-emitting diodes with photocells.
We can then write a simple model for the motion of the ball from Newtons second law as
cu2
y = mg
m (D.1)
y2
Note that this is a single-input, single-output nonlinear model. The input and output of this
model are
ME 132, Spring 2015, UC Berkeley, F. Borrelli 200

u the current injected into the magnet coils


y the position of the ball

In the context of numerical exercises, use the following constants:

m 0.15 Kg mass of ball


c 0.01 Kg-m3 /Coul2 magnetic coupling constant

We can convert this nonlinear input-output dierential equation model to state-space by


defining the states:
x1 = y, x2 = y
We get the state-space equations:

x 1 = f1 (x1 , x2 , u) = x2
( )2
cu2 u
x 2 = f2 (x1 , x2 , u) = g = 10
mx21 3.87x1
y = h(x1 , x2 , u) = x1

4 Equilibrium Points

Consider the general time-invariant nonlinear realization

x = f (x, u), y = h(x, u) (D.2)

An equilibrium point of (D.2) is a pair (xeq , ueq ) such that if we start with initial condition
x(0) = xeq and apply the constant input u(t) = ueq , t 0, then the state trajectory remains
at the equilibrium point, i.e.

x(0) = xeq , u(t) = ueq = x(t) = xeq

Fup y

mg

Figure 41: Magnetically suspended ball.


ME 132, Spring 2015, UC Berkeley, F. Borrelli 201

Notice that the output function h(x, u) plays no role in finding equilibrium points. Also, we
should stress that xeq and ueq are constants and not functions of time.
The following result tells us how to find equilibrium points.

Theorem 1 (xeq , ueq ) is an equilibrium point of (#) if and only if f (xeq , ueq ) = 0

Proof: (not rigorous) If we initialize the dierential equations x = f (x, u) at x(0) = xeq
and apply the constant inputs u(t) = ueq , we see that
x = f (xeq , ueq ) = 0
This means that x(t) does not change with time. So it stays at x(t) = xeq .
For a nonlinear system, there can be many equilibrium points. To find all the equilibrium
points of a nonlinear system, we simple set
f (xeq , ueq ) = 0
and solve for xeq , ueq .
If we start the system at xeq and apply the constant input ueq , then x(t) stays at the
equilibrium value xeq . Corresponding to this equilibrium point, y(t) stays at its equilibrium
value
y eq = h(xeq , ueq )

Example 2 Returning to the magnetically suspended ball example, we calculate the equi-
librium points:
f (xeq , ueq ) = 0 = f1 (xeq eq eq
1 , x2 , u ) = 0 and f2 (xeq eq eq
1 , x2 , u ) = 0
( )2
ueq
= x2 = 0 and 10
eq
=0
3.87xeq
1
= xeq
2 = 0, xeq
1 = 0.082u
eq

The equilibrium points are:


xeq eq eq
1 = 0.082, x2 = 0, u =

The resulting value of output is


y eq = h(xeq , ueq ) = xeq
1 = 0.082

Note that here we have many equilibrium points. in this case, we have parameterized these
equilibrium points by the free variable ueq = .
We could also parameterize these equilibrium points by the free variable y eq = as follows:
xeq eq eq
1 = , x2 = 0, u = 12.195, y
eq
= 0.082 =
This parametrization is sometimes more convenient when we study gain-scheduling to control
nonlinear systems.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 202

5 Jacobians and the Taylor Theorem

First consider a scalar values function (x1 , x2 , , xn ) of n variables. The Jacobian of is


the row vector [ ]
(x1 , , xn ) = x
1

xn

For example for the function (x1 , x2 , x3 ) of three variables,

(x1 , x2 , x3 ) = x1 x22 1/x1 + sin(x3 )

the Jacobian is
[ ]
=
x1

x2

x3
[ ]
= x22 + 1/x21 2x1 x2 cos(x3 )

The Jacobian is a function of the variables x1 , x2 , x3 . We can evaluate the Jacobian at


a point and get actual numbers. In this example, we could evaluate the Jacobian at
(x1 , x2 , x3 ) = (1, 2, 0) to get
(1, 1, 0) = [ 5 4 1 ]

Now consider a vector-valued function : Rn Rm . What this actually means is that we


have m individual functions in n variables. These functions are collectively represented by
, and the variables are collectively represented by x. Let us write this function as

1 (x1 , , xn )
(x) = (x1 , x2 , , xn ) = ..
.
m (x1 , , xn )

The Jacobian of is the m n matrix of functions


1
x
1
xn
.. 1 ..
= . .
m
x1
m
xn

Fix a vector Rn . We can evaluate the Jacobian at to get an m n matrix of numbers.


Our notation for this is 1
x1
x
1

..
n

() = ... .
m
x1
xn @
m

For example, consider the function


[ ] [ ]
1 (x1 , x2 , x3 ) x1 sin(x2 )
(x1 , x2 , x3 ) = =
2 (x1 , x2 , x3 ) x22 cos(x3 )
ME 132, Spring 2015, UC Berkeley, F. Borrelli 203

The Jacobian of (x) evaluated at (1, 1, 0) is


[ ] [ ]
sin(x2 ) x1 cos(x2 ) 0 1 1 0
(x1 , x2 , x3 ) = =
0 2x2 cos(x3 ) x22 sin(x3 ) @(1,/2,0) 0 0

Analogous to the classical Taylor series expansion of a scalar function of one variable, we
can write the Taylor series expansion of around as
(x) = () + () (x ) + higher order terms
The first two terms above are the linear approximation of around . We can therefore
approximate as
(x) () + () (x )
and this approximation will be good in some (possibly small) neighborhood of .

6 Linearization about Equilibrium Points

We will now use the Taylor Theorem to approximate a nonlinear plant model by a LTI plant
model. This approximation is called the Jacobian Linearization and is good as long as the
applied input u(t) is close to its equilibrium value ueq and the resulting state trajectory x(t)
is close to the equilibrium value xeq .

Theorem 3 Consider a nonlinear time-invariant input-output dierential equation model


realized as
x = f (x, u), y = h(x, u)
Let = (xeq , ueq ) be an equilibrium point of this model, and define y eq = h(xeq , ueq ).
Define the deviation variables
x = x xeq
u = u ueq
y = y yeq
and compute the matrices
f1
x
f1
xn
f1
u1
f1
um
1 ..
A = ... . B = ...
..
.
fn
x1
fn
xn @
fn
u1
fn
um @
h1
x1
h1
xn
h1
u1
h1
um
.. ..
C = . . D = ...
..
.
hp hp hp hp
x1
xn @ u1
um @
ME 132, Spring 2015, UC Berkeley, F. Borrelli 204

Then, we can approximate the nonlinear system in the vicinity of the equilibrium point by
the linear time-invariant state space realization

x(t) = Ax(t) + Bu(t)
y(t) = Cx(t) + Du(t)

Proof: The basic tool we use to prove this result is the Taylor theorem. We can approximate
f in a neighborhood of as
([ ] [ eq ])
x x
f (x, u) f (x , u ) + f ()
eq eq

u ueq
f1 f1
x
f1
xn u
f1
um
1 1 .. (u ueq )
= ... ... (x xeq ) + ... .
fn
x1
xn @
fn fn
u1
um @
fn

= A(x xeq ) + B(u ueq )

In a similar fashion we can approximate g in a neighborhood of as


([ ] [ eq ])
x x
h(x, u) h(x , u ) + h()
eq eq

u ueq
h1 h1
x1
x
h1
u
h1
u
.. (u ueq )
n 1 m

= y eq + ... ... (x xeq ) + ... .


hp hp hp hp
x1
x n @ u1
u m @

= y eq + C(x xeq ) + D(u ueq )

Let us now define the deviation variables x = x xeq , u = u ueq , and y = y y eq .


Observe that
= x = f (x, u) Ax + Bu,
x y = h(x, u) y eq Cx + Du

Thus, the original nonlinear system can be approximated by a linear time-invariant system.
This approximation is good provided we remain suciently close to the equilibrium point
= (xeq , ueq ).
The original nonlinear plant and its Jacobian linearization are illustrated in Figure 42.

Example 4 Consider again the magnetically suspended ball. We linearize the dynamics
about the equilibrium point
[ ]
eq
x = ueq = 12.195 y eq =
0
ME 132, Spring 2015, UC Berkeley, F. Borrelli 205

ueq y eq

Nonlinear + u Linearized y+
u y u y
Plant Plant

Figure 42: Nonlinear Plant and its Linearized Approximation.

Define the deviation variables x = x xeq , u = u ueq , and y = y yeq . We calculate the
matrices
[ ] [ ] [ f1 ] [ ]
f1 f1
x1 x2
0 1 u
0
A = f2 f2 = 76.86 0 B = f2 = 6.31
x1 x2 u @eq
@eq
[ h h ] [ h ]
C = x1 x2 @eq = [ 1 0 ] D = u @eq = 0

Then, the nonlinear system can be approximated by the linear time-invariant state space
realization

x(t) = Ax(t) + Bu(t)
y(t) = Cx(t) + Du(t)

Notice that the A-matrix here has eigenvalues at 8.77/ . One of these eigenvalues is in
the right half-plane. So the linearized approximation is unstable. This means that locally
the nonlinear system is unstable. Small deviations from the equilibrium point will send the
ball away from the equilibrium point.

7 Control using Jacobian Linearized Plant Models

Let us begin with a nonlinear plant model P . We could choose an equilibrium point of this
plant model, and find the Jacobian linearization H(s) of the plant about this equilibrium
point. Now we have a LTI plant model, and we can use the state-space methods or PID
methods to design a controller K(s) for the linearized plant model H(s). This feedback
system is shown in Figure 43. The command for this feedback system is r(t). This signal
is what we want the linearized plant output y(t) to track, and this is what the controller
K(s) is designed to do.
Let us figure out what r(t) should be. We want the output of the nonlinear plant y(t) to
track the command r(t). This signal r(t) will be generated externally (by a human operator,
a computer, or another control system). Since y(t) = y(t) y eq , this implies that we want
y(t) to track r(t) y eq . Therefore, we should choose

r(t) = r(t) y eq
ME 132, Spring 2015, UC Berkeley, F. Borrelli 206

u
H(s) y(t)

+
K(s) r(t)

Figure 43: Control System for Linear Plant Model H(s).

y y
+
+
u K(s) r u K(s) r

Figure 44: Control System for Linear Plant Model.

NL Plant y

+
ueq
+
+
K(s) r
controller

Figure 45: Final Implementation of Controller based on Jacobian Linearization.

The control system for the linearized plant model is shown in Figure 44.
But the linearized model H(s) is not a physical plant, it is just a construct of our imagination.
So we now need to figure out how we actually implement the controller K(s) for the nonlinear
physical plant P . If we examine the controller K(s) in isolation, its input is r(t) y eq . The
output of the controller is u(t). Notice that u(t) = u(t) ueq . so we can generate the input
to the nonlinear physical plant easily as

u(t) = u(t) + ueq

The final implementation of control system for the nonlinear plant is shown in Figure 45.
This controller is based on a linearized model of the nonlinear plant about the equilibrium
point (ueq , xeq ). The linearized model is a good approximation of the plant as long as we
stay close to this equilibrium point. This means that the controller will work well as long as
the input applied to the plant is close to ueq , the initial condition of the plant is close to xeq ,
and the subsequent state trajectory x(t) of the plant remains close to xeq .
ME 132, Spring 2015, UC Berkeley, F. Borrelli 207

8 Gain Scheduling

In many situations, we cannot be assured that we will stay close to a particular equilibrium
point of a nonlinear plant during control maneuvers. To eectively control the nonlinear
plant we will need to design controllers at many equilibrium points (also called operating
points) and switch between these controller in an intelligent way. This control strategy is
called gain scheduling.

NL Plant y

+
ueq (y)
+
+
K(y) r
controller

Figure 46: Gain Scheduling.

The strategy for Gain Scheduling is illustrated in Figure 46. The idea is to first parameterize
equilibrium points of the nonlinear system to be controlled using the free variable y eq = .
So the equilibrium points look like:
xeq = a(), ueq = b(), y eq =
Here a and b are functions of the variable . We will refer to the equilibrium point above
simply as .
Next, we can linearize the nonlinear plant about the equilibrium point . We will get a
linearized model

x(t) = Ax(t) + Bu(t)
y(t) = Cx(t) + Du(t)
The matrices A, B, C, D clearly depend on the equilibrium point and so they are functions
of . Now we can design controllers based on these linearized models. This is just what
we did in the previous section, only this time we have a continuous family of equilibrium
point parameterized by . So the controller designed at the equilibrium point might have
a state-space realization [ ]
F G
K(s)
H 0
Clearly the controller state-space matrices F, G, H depend on as indicated by the super-
scripts. Remember that the final implementation of the controller (see previous section)
is [ ]
u(t) = u(t) + ueq (), where u(t) = K (s) (r(t) y(t)) (D.3)
ME 132, Spring 2015, UC Berkeley, F. Borrelli 208

This implementation of controller K(s) for the nonlinear plant is shown in Figure 45. Now
let us write this more carefully. Let z(t) denote the state of the controller. We can write
(D.3) as
= F z(t) + G (r(t) y(t))u(t) = H z(t) + ueq ()
z(t)
Again, we stress that the matrices F, G, H depend on . Recall that is the equilibrium
point used to design the controller. A natural choice for is to set = y(t) which is the
current output of the nonlinear plant. This is the closest equilibrium point to where the
plant is now. So our final controller implementation is
z(t)
= F y z(t) + Gy (r(t) y(t))
u(t) = H y z(t) + ueq (y) (D.4)

This discussion is summarized nicely in Figure 46 which shows the final form of the gain-
scheduled controller.
A very important point we must make us that it of often necessary to slow down or low-
pass filter the command for gain-scheduling to work. In the context of the magnetically
suspended ball, if we gave a command that attempted to change the position of the ball
abruptly from 0.25 meters to 0.5 meters, we are asking the ball to move very fast (large
speed) from one position to the other. At no point would the ball be anywhere near an
equilibrium point. This is because at all the equilibria, the speed of the ball is zero. By
slowing down the command, we are allowing the ball to move slowly from one position to
the other, and it stays close to equilibrium points.

9 Feedback Linearization

A powerful technique for treating nonlinear systems in the context of control problems is
feedback linearization or dynamic inversion. The essential idea here is to cancel the non-
linearities.
Consider a physical system modeled by the nonlinear realization
x = f (x, u) y = h(x, u)
In many cases it is possible to construct a feedback function
u = (v, y)
such that the dynamics from the new inputs v to the outputs y are linear and time-invariant.
We can then design a controller for the linearized system using standard techniques that we
have studied earlier. These ideas are illustrated in Figure 47.
By setting u = (v, y), we are essentially building an input-redefining box that has new
inputs v and generates the plant inputs u based on measurements of the plant outputs y.
This box is part of the controller that we would implement for the nonlinear plant.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 209

Static Nonlinear-
v u Nonlinear y
ity
(v, y) Plant

feedback linearized system

Figure 47: Feedback Linearization.

Example 5 Consider again the magnetically suspended ball. If we set



m(g + v)
u = (y, v) = y
c
we obtain the linear time-invariant model

x 1 = x2 , x 2 = v, y = x1

Many nonlinear systems are not output feedback linearizable. Sometimes, if we have the
states (or good estimates) available, we can perform state feedback linearization. It is im-
portant to note that this technique is based on a model of some physical system. If this
model is inaccurate, the nonlinearity will not cancel exactly. It is therefore critical to
understand the robustness of this technique with respect to plant modeling errors.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 210

E Complex Arithmetic

1 Basic Stu

The set of real numbers is written R, and the set of complex numbers is written as C. For
a complex number z = a + jb, a is called the real part of z, written Re(z), and b is called
the imaginary part of z, written Im(z). The complex-conjugate of z is the complex number
z = a jb.

2 Magnitude and Phase



The magnitude of z is the non-negative real number |z| = a2 + b2 . Note that |z|2 = zz.
The phase of a nonzero complex number z, written z, is the angle such that

cos() = a/|z|, and sin() = b/|z|

The phase of z = 0 is undefined. Thus, if the complex number z is in the first or fourth
quadrant (i.e. a > 0), its phase is z = Tan1 (b/a). Here Tan1 is the principal branch of
the inverse tangent function, i.e. the branch whose range is restricted to /2 < Tan1 (y)
/2.
For products of complex numbers we have

|z1 z2 | = |z1 ||z2 | (z1 z2 ) = z1 + z2

For ratios of complex numbers we have (if z1 = 0),

|z1 /z2 | = |z1 |/|z2 | (z1 /z2 ) = z1 z2

3 Functions of a Complex Variable

An extremely important formula defining the complex exponential function is Euler identity:

exp(j) = cos() + j sin()

From this and the definition of phase, it follows that any complex number z can be written
in polar form as
z = |z| exp(jz)

Once we write a nonzero complex number z in polar form as above, we can naturally define
its (natural) logarithm as
ln z = ln |z| + jz
ME 132, Spring 2015, UC Berkeley, F. Borrelli 211

Note that because z = 0, the logarithm ln |z| is well-defined. We can also define square-roots
of a complex number z as
z = |z| exp(jz)/2)

4 Polynomials

We shall also need the following fact: any polynomial of degree n

p(s) = pn sn + pn1 sn1 + + p1 s + p0

has exactly n roots in the complex plane. This is called the Fundamental Theorem of
Algebra. While it has become common knowledge, it is actually quite dicult to prove.
If the coecients of the polynomial are all real, i.e. pi R, then the roots of p(s) occur in
conjugate-pairs. In other words, if z = a + jb is a root of p(s), then z = a jb is also a root.
Thus, if p(s) has odd degree, it must have a real root.

5 Subsets of the complex-plane

We shall often deal with certain sets of the complex-plane. These are

the unit circle = C = {z : |z| = 1} = {exp(j) : [0, 2)}


the open unit disk = D = {z : |z| < 1}
the open left-half-plane = H = {z : Re (z) < 0}
the open right-half-plane = H+ = {z : Re (z) > 0}

For any subset S C, its closure (i.e. the set obtained by including its boundary) is written
S. For example, the closed left-half plane is H+ . Similarly, we can write D, etc.

Exercises.

1) Let a be real. Show that



j a

j + a = 1 for all R
ME 132, Spring 2015, UC Berkeley, F. Borrelli 212

2) Plot the log-magnitude and phase of the complex number


a
H(j) =
j + b
versus log as varies from 0 to in the following cases.

(a) a = 1, b = 3 (a) a = 1, b = 3
(b) a = 1, b = 3 (b) a = 1, b = 3

3) Plot the log-magnitude and phase of the complex number

H(j) = exp(jT )

versus log as varies from 0 to in the following cases.


(a) T = 1 (b) T = 10

4) What is the equation of a circle in the complex plane of radius R and centered at zo ?
ME 132, Spring 2015, UC Berkeley, F. Borrelli 213

F Linear Algebra

1 Matrices and Vectors

We are very comfortable with vectors in 3 dimensions. Concepts such as vector addition,
orthogonality, the angle between vectors, dot products, changing co-ordinate systems are
intimately familiar. As we shall see, Linear Algebra allows us to generalize these concepts
to treat vectors in many dimensions, and to even more abstract notions of vectors.
The set of all n 1 column vectors of real numbers is written Rn . The ith entry of a column
vector v is denoted vi . Analogous is the set Cn where the vectors have complex entries. We
add vectors component-wise.
The set of all m n rectangular matrices of real numbers is written Rmn . The element in
the ith row and j th column of a matrix M is written as mij . Similarly, we have the set Cmn .
The n n matrix whose diagonal elements are 1 and whose other elements are all 0 is the
identity matrix and is written I or In to explicitly exhibit its size.
We will assume familiarity with elementary matrix concepts such as matrix multiplication,
transposes, determinants, and inverses. Matrices do not commute, i.e. in general, for ma-
trices A and B of compatible dimension AB = BA. So we must be careful to respect the
order in expressions with matrices. Indeed, if v Cn , v v is a real number, while vv is an
n n matrix.
It is very useful to think of matrices in terms of their columns (or rows). For example, the
product
[ ][ ] [ ] [ ] [ ]
a11 a12 a13 v1 a11 a12 a13 3
Av = a21 a22 a23 v2 = v1 a21 + v2 a22 + v3 a23 = vi a[i]
a31 a32 a33 v3 a31 a32 a33 i=1

is the weighted sum of the columns of A, the weights coming from the vector v.
It is also very useful to deal with block-partitioned matrices. For example, we could write

a11 a12 a13 b12 b13 [ ]
a21 a22 a23 a12 a13 A11 A12
A=
a31 a32 a33 a12 a13
=
A21 A22
a31 a32 a33 a12 a13
Multiplication of block-partitioned matrices is as one would expect.
[ ][ ] [ ]
A11 A12 B11 B12 A11 B11 + A12 B21 A11 B12 + A12 B22
AB = =
A21 A22 B21 B22 A21 B11 + A22 B21 A21 B12 + A22 B22
This, of course, requires A and B to be partitioned conformably, i.e. so that the various
products make sense. For example, in the equation above we would need A11 to have as
many columns as B11 has rows.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 214

Through these notes, we will make assertions about matrices in various Theorems, Propo-
sitions, and Lemmas. To make the results more transparent, we will not always explicitly
state the dimensions of the matrices involved. The reader should assume that the results
hold only when the matrices have appropriately sensible dimensions. For example suppose
we write A1 in the statement of some Theorem. It will imply we are assuming that A is
square and invertible. Or if we write the expression I + AB in some lemma, it must imply
that A is m n and B is n m. But it does not imply that A and B are square matrices.

2 Linear Simultaneous Equations

Matrices can be used to write a collection of linear equations in several unknowns compactly.
For example:

x1 + 2x2 + 7x3 = 4 1 2 7 [ ] 4
x1
3x2 4x3 = 8 0 3 4 8
x2 = Ax = b
5x1 6x2 = 9 5 6 0 9
x3
x3 = 1 0 0 1 1
Any collection of linear equations can be written as
Ax = b A C mn
Here x is the vector of n unknowns, and A, b are constructed from the coecients of the m
equations. There are only three possibilities:

(a) Over-determined. The equation Ax = b has no solution.


(b) Under-determined. The equation Ax = b has several solutions.
(c) The equation Ax = b has only one solution.

3 Transposes and Adjoints

Definition 1 Let A Cmn .


The transpose of A written AT is an n m matrix whose i, j th entry is aj,i
The adjoint of A, written A is its complex-conjugate-transpose, i.e. A = (A)T

Lemma 2 Properties of Adjoints.

(a) (A ) = A
(b) (A + B) = A + B
(c) (AB) = B A
ME 132, Spring 2015, UC Berkeley, F. Borrelli 215

4 Determinants and Inverses

Definition 3 Let A Cnn .


The inverse of A is the unique matrix A1 such that AA1 = I

We will assume you are familiar with minors, co-factors, determinants, and computing in-
verses.
Here are some useful facts that we will use frequently.

Lemma 4 Properties of Inverses.

(a) AA1 = A1 A = I
(b) (AB)1 = B 1 A1
(c) (A )1 = (A1 )

Lemma 5 Properties of Determinants.


Let A and B are square matrices of the same size. Then
(a) det (AB) = det (BA) = det(A) det(B)
(b) det(AT ) = det(A)
(c) det (A ) = det(A)

Proposition 6 Inverses for Block-partitioned Matrices.

(a) If X and Z are square and invertible, then


[ ]1 [ 1 ]
X Y X X 1 Y Z 1
=
0 Z 0 Z 1

(b) If A and D are square, and D is invertible, then


[ ] [ ][ ]
A B A BD1 C BD1 I 0
=
C D 0 I C D

(c) Suppose A and D are square. If D and = A BD1 C are invertible, then
[ ]1 [ ]
A B 1 1 BD1
=
C D D1 C1 D1 C1 BD1 + D1
ME 132, Spring 2015, UC Berkeley, F. Borrelli 216

Corollary 7 (Determinants for Block-partitioned Matrices.)

(a) If X and Z are square, then


[ ]
X Y
det = det(X) det(Z)
0 Z

(b) If A and D are square, and D is invertible, then


[ ]
A B ( )
det = det A BD1 C det(D)
C D

5 Eigenvalues and Eigenvectors

Definition 8 Let A C nn . The characteristic polynomial of A written

A (s) = det(sI A) = sn + n1 sn1 + + 1 s1 + 0 s0

The roots of A (s) of which there are n are called the eigenvalues of A.

Lemma 9 Let A C nn and be an eigenvalue of A. Then, there exists a vector v = 0


such that Av = v. This vector v is called an eigenvector of A with associated eigenvalue .

Proof. Since is an eigenvalue of A, we have

det(I A) = A () = 0

Thus the matrix (I A) is not invertible. Consequently, its null space is not trivial, i.e.

v = 0 such that (I A)v = 0

proving the claim.


It is evident that any nonzero multiple of v is also an eigenvector corresponding to the same
eigenvalue. We view an eigenvector as a vector whose direction is invariant under the action
of A. In the context of this interpretation, we regard all (nonzero) scalar multiples of an
eigenvector as being the same eigenvector.
Let A have distinct eigenvalues. Then it has a full set of (i.e. n linearly independent)
eigenvectors. This assertion will be proved shortly. If however A has repeated eigenvalues a
pathology may arise in that we are unable to find a full set of eigenvectors.
ME 132, Spring 2015, UC Berkeley, F. Borrelli 217

6 Simple-case of the Jordan form

Let A C nn be a (square!) matrix. We can think of A as a box. Vectors u C n go in, and


vectors y = Au C n come out. For example, the box could mean rotate vector coming in
by 30 clockwise to produce a new vector.
We can change coordinates by the transformation
xT x or x = T 1 x
where T C nn is an invertible matrix. The box does the same thing it hasnt changed.
We
But in these new coordinated, the matrix describing the box changes as follows to A.
can find this new matrix easily:
y = Au = y = T 1 y = T 1 Au = T 1 AT u
So the action of the matrix A in the new coordinates is represented by the matrix
A = T 1 AT
The matrices A and A are said to be similar.
We wish to make a special choice of basis so that the (new) matrix representation of A has
particularly lucid structure. Equivalently, we wish to select a nonsingular matrix T in order
that T 1 AT has a transparent form called the Jordan canonical from.
In the special case where A has distinct eigenvalues, we have the following key result.

Theorem 10 Let A C nn be simple with eigenvalues i and corresponding eigenvectors


vi , for i = 1, , n. Define the n n matrices

1 0 0
0 2 0
T = [ v1 vn ] , =
... .. .
. ..
0 0 n
Then,

(a) The eigenvectors v1 , , vn are linearly independent, i.e. T is invertible.


(b) T 1 AT =

Proof. (a) We will use contradiction. Suppose v1 , , vn are linearly dependent. Then one
of these vectors can be expressed as a linear combination of the remaining vectors. Without
loss of generality, we can write
n
v1 = k vk (F.1)
2
ME 132, Spring 2015, UC Berkeley, F. Borrelli 218

Suppose Av = v. Define the matrix


M = (2 I A)(3 I A) (n I A)
and consider the expression:
M v = (2 I A)(3 I A) (n1 I A)(n )v
= (2 I A)(3 I A) (n2 I A)(n1 )(n )v
= (2 )(3 ) (n2 )v
Using the fact that A has distinct eigenvalues, we have
M v1 = (2 1 )(3 1 ) (n2 1 )v1 = 0
For k = 2, 3, , n, we have
M vk = (2 k )(3 k ) (n2 k )vk = 0
It now follows from (F.1) that
( n )

n
0 = M v1 = M k vk = k M vk = 0
2 2

This is a contradiction, proving that the eigenvectors v1 , , vn are linearly independent.


Equivalently, the matrix
T = [ v1 v2 vn ] C nn
is invertible.
(b) Observe that
AT = [ Av1 Av2 Avn ] = [ 1 v1 2 v2 n vn ] = T
Pre-multiplying by T 1 yields T 1 AT = , completing the proof.

Essentially, Theorem (10) states that simple matrices can be diagonalized using similarity
transformations. The matrix above is called the Jordan form of A. Observe that this
matrix is diagonal and its diagonal entries are the eigenvalues of A.

Example 11 Let [ ]
2 3
A=
1 2

This matrix is simple and has eigenvalues at 1, 1 with associated eigenvectors [ 3 1 ] and

[ 1 1 ] . It then follows that
[ ] [ ]
1 1 0 3 1
T AT = , where T =
0 1 1 1
ME 132, Spring 2015, UC Berkeley, F. Borrelli 219

7 Matrix Exponentials

Matrix exponentials are particularly important and arise in connection with systems of cou-
pled linear ordinary dierential equations. Since the Taylor series

s2 t2 s3 t3
est = 1 + st + + +
2! 3!
converges everywhere, we can define the exponential of any matrix A C nn by

A2 t2 A3 t3
eAt = I + At + + +
2! 3!

Theorem 12 (Properties of Matrix Exponentials)

(a) eA0 = I

(b) eA(t+s) = eAt eAs

(c) If AB = BA then e(A+B)t = eAt eBt = eBt eAt


[ ]
(d) det eAt = etrace(A)t
[ ]1
(e) eAt is nonsingular for all < t < and eAt = eAt

(f ) eAt is the unique solution X of the linear system of ordinary dierential equations

X = AX, subject to X(0) = I

Example 13 Consider the matrix


[ ]

A=

You should be able to check that


[ ]
At t cos(t) sin(t)
e =e
sin(t) cos(t)

S-ar putea să vă placă și