me 132 reader

227
ME 132, Dynamic Systems and Feedback Class Notes Andrew Packard, Roberto Horowitz, Kameshwar Poolla, Francesco Borrelli Fall 2012 Instructor: Prof. F. Borrelli Department of Mechanical Engineering University of California Berkeley CA, 94720-1740 copyright 1995-2010 A. Packard, Horowitz, Poolla, Borrelli

Upload: nhan-thanh

Post on 10-Nov-2014

90 views

Category:

Documents


6 download

DESCRIPTION

control system reader

TRANSCRIPT

Page 1: ME 132 Reader

ME 132, Dynamic Systems and Feedback

Class Notes

Andrew Packard, Roberto Horowitz, Kameshwar Poolla, Francesco Borrelli

Fall 2012

Instructor:

Prof. F. Borrelli

Department of Mechanical Engineering

University of California

Berkeley CA, 94720-1740

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

Page 2: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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

Page 3: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 Differential Equations . . . . . . . . . . . . . . . . . 53

2 Importance of Linearity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

Page 4: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli iii

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

3.1 Interpretation of complex roots to ODEs with real-coefficients . . . . 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 differential 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 differential equation . . . . . . . . . . . . . . . . . . . . . . . . . . 79

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

5 Derivatives on the inputs: Effect 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

Page 5: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 Differential Operators (LDOs) . . . . . . . . . . . . . . . . . . . . . . 106

2 Algebra of Linear differential 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

Page 6: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 Tradeoffs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

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

3 What’s 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 Sufficient Version . . . . . . . . . . . . . . . . . . . . . 179

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

4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182

Page 7: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 Differential 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 Stuff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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

Page 8: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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

Page 9: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 1

1 Introduction

1 The Power of Feedback

Every morning I wake up and have a shower. I live in North Berkeley, where the housingis somewhat run-down, but I suspect the situation is the same everywhere. My shower isvery basic. It has hot and cold water taps that are not calibrated. So I can’t set the showertemperature I like, and then step in. Instead, I am forced to use feedback control. I stickmy hand in the shower to measure the temperature. In my brain, I have an idea of whatshower temperature I would like. I then adjust the hot and cold water taps based on thediscrepancy between what I measure and what I want. In fact, it is possible to set the showertemperature to within 0.5F 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 onethat 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 ofthese physical systems may themselves have complicated dynamics, often represented bydifferential equations. These interconnections form the core of our study of control systems.We therefore need a convenient means of handling and representing complex interconnectionsof physical systems. The basic unit for doing this is a block diagram.

Ovenu

yy

y

u1

2

1

2

3

Figure 1: Block diagram of anoven.

Oven

Figure 2: Complex interconnected system.

Consider for example an oven with two electrical heating coils, and three thermometers tomeasure temperature. The recorded temperatures y1, y2, y3 at each of the three thermometersis 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 differential equationsto model conduction effects, and radiative and convective losses. Instead of carrying theseequations along with us, we simply represent the oven as a block as shown in Figure 1. This

Page 10: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 2

block has two inputs (the applied voltages yi) and three outputs (the temperatures yj). Wemay now connect various inputs and outputs of this oven to other devices, each of which mayhave complicated dynamics, but is represented conveniently as a block, as shown in Figure2. 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 notnumbers but signals, i.e. they are functions of time. Also, the value y(t) of the output y attime 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 systemdiscussed earlier.

The physical system to be controlled is called the plant. This term has its origins in chemicalengineering where the control of chemical plants or factories is of concern. In the showerexample, the plant consists of the hot and cold water tanks, the heating elements, connectingpipes, plumbing connecting to the city water supply and to other showers and toilets all acrosstown.

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 voltageis proportional to the physical quantity being measured. This is very convenient, becausethese signals can be readily processed with electronics, or can be stored on a computer foranalysis or for real-time processing. In the context of our shower example, the sensor is ourhand. The water temperature is measured and converted to electrical signals that propagatealong neuro-sensory pathways to the brain.

An actuator is a device that has the capacity to affect the behavior of the plant. An electricalsignal is applied to the actuator, which results in some mechanical motion such as the openingof 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 directlyaffects 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 toelectrical signals sent along neuro-muscular pathways from the brain.

The controlled variables are the physical quantities we are interested in controlling. In theshower example, this is simply the water temperature of the shower.

The reference or command is an electrical signal that represents what we would like theregulated variable to behave like. In the context of the shower example, this is the desiredshower temperature.

Page 11: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 3

Disturbances are phenomena that affect the behavior of the plant being controlled. In ourshower example, disturbances include the outside temperature (which affects the character-istics of the water heater and the heat loss through the plumbing), and other user of thewater supply (flushing an adjacent toilet can decrease the cold water pressure head resultingin scalding of the unfortunate person taking a shower). Disturbances are often induced byenvironmental 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, affects the behavior of theplant. In the shower example, our brain serves as the controller. Based on the differencebetween the reference or desired shower temperature and the electrical signals that repre-sent the measured shower temperature, our brain sends out electrical signals along neuralpathways that cause our hand muscles (the actuators) to adjust the hot and cold watertaps. Controllers are essential an algorithm that prescribes how to process sensed signalsand reference signals to generate the actuator inputs.

Finally, noises are present at various points in the overall system. We will have some amountof 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 affectingthe controller itself (due to quantization errors in a digital implementation of the controlalgorithm).

Throughout these notes, we will consistently use the following symbols:

P plant K controlleru input y outputd disturbance n noiser reference

4 The Structure of Control Systems

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

5 Discussion

A. Commands or Reference Signals

Page 12: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 4

Controller

SensorsPlantActuators

Disturbances

Commands

Measurement noise

Controller noise

Actuator noise

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 valueas the command, and later select a different 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 objectiveis 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 tobe “successful”. Notice in this example that the reference signal (the position vectorof 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-controlin 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. Forexample, a pilot may issue a command to bank his/her aircraft starboard by 12 degreesby manually turning the steering column. This mechanical motion is converted intoan 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, orby other physical systems. For example, we might have an automated steering systemfor a car. Here, we could have a vision system consisting of a camera and relatedelectronics that watches the center-line of the roadway. The system generates steeringcommands that instruct the car to turn appropriately based on the curvature of theupcoming road. These commands drive the car steering control system.

B. The Controller

Observe that the controller processes voltage signals (the command and the sensoroutputs) and produces voltage signals (applied to the actuators). This is desirablebecause it is very convenient to process voltage signals. This can be done with analogor digital electronics, or with software. The controller is then a mapping or algorithmthat processes the signals y(t) and r(t) and generates the signals u(t). This algorithmcan be very complicated. It may contain logical elements (if .. then .. else

Page 13: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 5

0 2 4 6 8 10−2

−1

0

1

2

Time (secs)

Ref

eren

ce (

volts

)

Figure 4: Typical reference signal.

statements), or differential equations. Software implementations of the control algo-rithm are more flexible than hardware implementations, and are natural candidatesfor development or prototyping. However, control algorithms are realized in hardwarefor production units because these can be much more cost-effective.

C. Robustness

As we shall discover soon, the design of a control system begins with a model ofthe plant dynamics. The controller is designed to deliver the requisite performanceassuming the plant behaves as predicted by the model.

The controller should also work well even if the actual plant behaves slightly differentlythan the plant model. Equivalently, the controller should be designed deliver satisfac-tory performance for modest perturbations of the plant model. This very importantdesign requirement is often stated as insisting that the controller or the feedback systembe robust to modeling errors.

There are several reasons why the actual plant dynamics may be different than theplant model.

First, we may have made many simplifying assumptions in modeling the plant. Forexample, we often choose to neglect friction terms or aerodynamic effects.

Second, in many situations, the plant dynamics may change during operation. Forexample, in chemical reactors, there is often a build-up of slag at the base of the reactorwhich changes the heat-transfer characteristic of the reactor. This in turn causes thedynamics 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 ofwhich behaves slightly differently. But we don’t custom design a controller for each carrolling off 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 thatoccur in the manufacturing cycle.

D. The Notion of Performance

Page 14: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 6

There is no universal measure to assist us in deciding whether one controller is betterthan another. This decision is often problem specific.

Consider for example the step responses shown in Figure 5. In the context of positioncontrol of an elevator, the response in panel (b) is unacceptable. The response exhibitsundershoot and significant oscillations. Both of these features would cause great con-sternation to elevator passengers. Undershoot means the elevator travels momentarilyin the wrong direction, while the under-damped behavior corresponds to the elevatoroscillating with significant amplitudes before settling to the correct floor level.

0 2 4 6 8−0.5

0

0.5

1

1.5

2

time

step

res

pons

e

0 2 4 6 8−0.5

0

0.5

1

1.5

2

time

step

res

pons

e

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

Conversely, consider the position control problem of the end-effector of a robot armin a high-precision manufacturing facility. Assuming the robot workspace is free ofobstacles, the response in panel (b) is preferable to that in panel (b). This is becausethe step response of panel (b) has a much smaller settling time. In this application, itis imperative for the robot arm to be in place quickly so that subsequent machiningcan 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 ofparts per hour that the robot can service.

There are some aspects of performance that are universal. For example, we wouldalways want our control system to result in closed-loop dynamics that are insensitiveto 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 difficult choices.Let us discuss these choices in the context of a realistic example.

Our example is drawn from semiconductor manufacturing. One of the critical processingsteps in processing silicon wafers in plasma etching, illustrated in Figure 6. Here, ions are

Page 15: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 7

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

wafer

etch chamber

ground plate

ions

3 concentricelectrodes

Figure 6: Illustration of the plasma etch process.

The first decision we are confronted with is to select what physical variables we wish tocontrol or regulate. This decision is based on considerations specific to the process beingcontrolled. 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 ifwe can directly measure the regulated variables. This results in the most straightforwardcontrol problem. However, in many situations (particularly in process control), we can onlyindirectly measure the regulated variables. In other words, we get to measure some otherphysical variables that are affected 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 thumbis 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 methodsdistinguished by the type of plant model we have, and the measure of performance wedemand 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 ina software implementation) and tested with the real plant. Finally, we can design andmanufacture production versions of the controller. These will have user-friendly softwareinterfaces.

Page 16: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 different control system designproblems.

inputs ucontrolled

exogenous

measuredoutputs y

regulated variables z inputs w

controller

generalizedplant

Figure 7: General control system architecture.

In the diagram above, we have the generalized plant which includes the physical plant to becontroller, the sensors, and the actuators.

There are two sets of input signals to the generalized plant. The controlled inputs u are theinputs that we may adjust in the course of controlling the plant. These are just the actuatorinputs. The exogenous inputs are signals that affect the generalized plant over which wehave no authority. These include the commands r, the external disturbances d, and noisesn that affect various components of the generalized plant.

There are two sets of outputs from the generalized plant. The measures outputs y are allsignals available to the control system. These typically include the sensor outputs ys andthe commands r. The regulated outputs are a collection of signals which we would like tokeep “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 generalconfiguration 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 acar, and the regulated variable is the speed v of the car. We have available a speedometerthat 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 thecar is affected by various disturbances, most prominent of these being d, the incline of theroadway. We do not have any sensor that measures the roadway incline (if we did, then dwould a measured output and not a disturbance).

Page 17: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 9

r

u

e

Kp

P

-+

++

++

d

u y

r

P

Kp

oK +Ko

+

d+++-

e

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

A. The model

We begin by offering a very simple model of the car. Common experience revealsthat for a fixed fuel throttle position the car achieves a certain steady speed. Withthe throttle being held fixed, if the roadway is inclined uphill, this steady speed isdiminished. We therefore suggest a model of the form

y = Gu−Hd

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

Go = 20, Ho = 5

It is these nominal values that will be used to design our controllers. However, thebehavior of the actual plant may be better represented by other values of G and Hthat are close to, but not exactly equal, to these nominal values. Indeed, we maybetter describe the plant by a more complex model. Many important dynamics havebeen ignored in our extremely simplified plant model. In fact, our model suggests thatchanges in the throttle immediately affect the speed, which we know from commonexperience to be unrealistic.

B. Control design

Next we will design a control system to regulate the speed of the car. Our first objectivewill be to achieve reference tracking (y(t) ≃ r(t)) for the nominal model (G = Go) andin absence of disturbances (d = 0). Then, we will analyze the behavior of the controlledsystem in the presence of disturbances (d 6= 0) and model mismatch (G 6= Go). Wewill study the difference between open-loop control and closed-loop control.

1. Open-loop Control System

Page 18: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 10

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

y = GKolr −Hd

As a first cut, we should demand that the cruise control system work perfectlyfor the nominal plant (i.e. G = Go, H = Ho), and in the absence of disturbances(i.e. d = 0). Thus, we insist that

r = GoKolr, or GoKol = 1, which forces the design Kol =1

Go= 0.05

This results in the open-loop control system behavior

y =G

Gor −Hd (1.1)

which is

y =G

20r −Hd

-+

Car Model

d

r

H

Gu yKol

Figure 9: Open-loop cruise control sys-tem.

Figure 10: Closed-loop cruise control system.

2. Closed-loop Control System

Now lets design a closed-loop or feedback control system. The configuration isshown in Figure 10. The controller gains Kff and Kfb are to be designed. Analysisof Figure 10 yields the relationships

y = Gu−Hd, u = Kffr −Kfby

These can be combined as

y = GKffr −GKfby −Hd, or (1 +GKfb)y = GKffr −Hd

Page 19: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 11

We therefore have the closed-loop control system behavior

y =GKff

1 +GKfbr − H

1 +GKfbd (1.2)

Again, for the nominal plant model with no disturbances, we demand perfecttracking. As a result,

r =GoKff

1 +GoKfbr

which gives us the design rule

GoKff

1 +GoKfb

= 1 (1.3)

One way to achieve this is through “high-gain feedback”. This means that if weselect |GoKfb| >> 1 and Kff = Kfb then

GoKff

1 +GoKfb

≃ 1 (1.4)

For instance if we choose GoKfb = 2000, then Kfb = 100 and Kff = 100. Thisresults in the closed-loop control system behavior

y =100G

1 + 100Gr − H

1 + 100Gd

C. Robustness

So far we have designed Kol or Kff and Kfb in order to obtain y ≃ r under no modelmismatch and d = 0. Two important questions need to be answered:

• What is the effect of the road incline d on the vehicle speed? (Disturbance Re-jection)

• How sensitive is the controller performance (y ≃ r) to (small) inaccuracies inmodel parameters and model simplification. (Sensitivity Analysis)

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

1. Disturbance Rejection

We analyze the “nominal model” case: G = Go, H = Ho, and focus only on thedisturbance effect on the output: r = 0 and d 6= 0.

(a) Open-loop Disturbance RejectionFrom equation (1.1) we have

y = −Hod

Page 20: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 12

Therefore we notice that the open-loop control has no power to reduce theeffect of the disturbance d on the output y. For instance since H0 = 5 a slopeof 1degree provides a speed reduction of 5m/s (≃ 11 miles per hours) whichis definitely not acceptable and cannot be changed by any choice of Kol.

(b) Closed-loop Disturbance RejectionFrom equation (1.5) we have

y = − Ho

1 +GoKfb

d

Clearly, if we use a “high-gain feedback” controller we obtain Ho

1+GoKfb

≃ 0and therefore we are able to almost cancel the effect of the disturbance onthe output.For our choice of controller parameters we have

y = − 5

1 + 20 ∗ 100d = −0.002d

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 = Ho and d = 0, then we havea nominal output y = yo. The question we are trying to answer is: what is thevariation of the output y around the nominal output yo when there is a variationof the plant G around the nominal plant Go.

To this aim are going to use the quantity

S =

∂yy

∂GG

∣∣∣∣∣G=Go, y=yo

=∂y

∂G

∣∣∣∣G=Go, y=yo

Go

yo

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 controlledsystem behavior does not drastically change if we have some model mismatch.

(a) Open-loop SensitivityLet us now calculate the sensitivity of the output y with respect to G at thenominal value Go in the absence of disturbances (d = 0). Using the open-loopcontrol system behavior (1.1), we obtain

S =∂y

∂G

G

y=

r

Go

G

Gr/Go= 1

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.

Page 21: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 13

(b) Closed-loop SensitivityLet us repeat the sensitivity calculation for the closed-loop control scheme.The closed-loop system behavior in the absence of disturbances is

y =GKff

1 +GKfbr

We can then compute

S =∂y

∂G

G

y=Kff(1 +GKfb)r −KfbGKffr

(1 +GKfb)21 +GKfb

Kffr=

1

1 +GKfb

∣∣∣∣G=Go

In conclusion

S =1

1 +GoKfb

We can again conclude that a “high-gain feedback” controller allow us to havea small sensitivity to uncertain parameters and plant/model mismatch.Let’s evaluate S for the controller chosen in the past sections

S =1

1 +GoKfb

=1

2001

In this case, we see that a 1 percent deviation of the plant from its nominalvalue Go will result in an insignificant 1/2001 ≈ .0005 percent deviation inthe output y. Thus, the behavior of the closed-loop control scheme is far lesssensitive 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-gainfeedback” has to be carefully used.

Assume now that we have a noisy sensor and thus the information fed back to thecontroller is

ym = y + n

where n is the sensor noise. The control input will be

u = Kffr −Kfbym

which yields the closed loop behavior

y = GKffr −GKfby −GKfbn−Hd

or

y =GKff

1 +GKfbr − H

1 +GKfbd− GKfb

1 +GKfbn (1.5)

Page 22: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 14

The term GKfb

1+GKfb

n characterizes the effect of the sensor noise on the plant output.

A good controller should make sure that any noise injected at the sensor output shouldbe 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.

Page 23: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 15

2 Modeling

1 The Uses of Models

Modeling of physical systems is a vital component of modern engineering. A model oftenconsists of complex coupled differential equations. The solution of these differential equationsdescribe 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 maychoose to ignore rolling resistance, aero-dynamic effects, 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 isthat the complexity of the control system is approximately the same as the complexity of themodel used to design the controller1. If we use an exceedingly detailed model, the resultingcontroller may be so complex as to render implementation unreliable, or even worse, we maynot be able to implement the control algorithm in real time. On the other hand, if we usea too simple model to design control systems, the resulting controller may not function asanticipated 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

x(t) = d2x(t)dt2

1We will make this assertion precise in a very specific context when we develop state-space controllerdesign methods.

Page 24: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 amodel describing the behavior of v(t) under any input u(t). The mass is also affected by aviscous 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 coefficient.

Using Newton’s law’s we can easily write the equations of motion as

mv(t) = u(t)− Fb(t) = u(t)− bv(t) (2.1)

Use the notation y(t) = v(t) and rewrite (2.1) with one being the coefficient of y

y +b

my =

1

mu(t) (2.2)

Equation 2.2 is a single linear ordinary differential equation (SLODE).

It is an Ordinary Differential Equation since it involves only ONE independent variable (thetime t). In case the differential equations involve two or more independent variables theyare called partial differential equations. In this class we will study only ODEs. Equation 2.2is a first order SLODE since the highest derivative that appears in the differential equationis 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 initialspeed with the symbol v0, the initial condition will have the form

v(0) = v0

Page 25: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 17

Therefore the complete SLODE model is

y +b

my =

1

mu(t) (2.3)

y(0) = v0 (2.4)

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

x = − b

mx+

1

mu (2.5)

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 wejust 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 serieswith 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 interestedin deriving a model describing the behavior of the voltage across the capacitor vC(t) underany input u(t).

Recall the fundamental equations linking the current i(t) through the resistor and the thevoltage across the resistor

vR(t) = Ri(t)

Page 26: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 18

and the fundamental equations linking the current i(t) through the capacitor and the thevoltage across the capacitor (in an ideal capacitor wholly characterized by a constant capac-itance C)

i(t) = CdvC(t)

dt

The circuit equation can be easily derived by using the Kirchhoff’s voltage law (the algebraicsum of the electrical potential differences around any closed circuit must be zero):

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

which becomesu(t)− RCvC(t)− vC(t) = 0

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

y +1

RCy =

1

RCu(t) (2.7)

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

x = − 1

RCx+

1

RCu (2.9)

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

2There are many schemes available to inexpensively measure S(t). For example, an optical sensor sendsa light pulse out which reflects off the mass, and its position S(t) can be deduced from the elapsed traveltime of the light pulse.

3Note that the actuator accepts a voltage input and converts it to a force. We presume that this conversionis has a unit gain, i.e., 1 volt produces 1 Newton of force.

Page 27: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 19

Figure 13: Spring-Mass-Damper System.

• the spring element has mass zero and it generates a braking force FK(t) proportionalto the mass position S(t):

FK(t) = KS(t)

where K is the spring constant.

• the position of the mass is also affected by a viscous damper, which supplies a brakingforce Fb = by proportional to, and opposing the velocity of the mass. b is the frictioncoefficient.

Using Newton’s law’s we can easily write the equations of motion as

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

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

y +b

my +

K

my =

1

mu(t) (2.11)

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 differential equations. Define the twostates as x1(t) = S(t) and x2(t) = S(t), then

x1 = S = x2

x2 = S = − b

mx2 −

K

mx1 +

1

mu(t)

These equations can be written in matrix form as[x1x2

]

=

[0 1

−Km

− bm

] [x1x2

]

+

[01m

]

u

Page 28: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 20

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

y = [ 1 0 ]

[

x1x2

]

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

where x(t) =

[x1(t)x2(t)

]

, A =

[0 1

−Km

− bm

]

, B =

[01m

]

, C = [ 1 0 ], x0 = [ s0 v0 ].

6.2 Example: RLC Circuit

Consider the electric circuit in Figure 14 consisting of a capacitor C, a resistor R and aninductor 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 thecapacitor vC(t) under any input u(t).

Recall the fundamental equations linking the current i(t) through the inductor and thethe voltage across the inductor (in an ideal inductor wholly characterized by a constantinductance L)

vL(t) = Ldi(t)

dt

The circuit equation can be easily derived by using the Kirchhoff’s voltage law (the algebraicsum of the electrical potential differences around any closed circuit must be zero):

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

Page 29: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 21

which becomesu(t)− RCvC(t)− vC(t)− LCvC(t) = 0

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

y +R

Ly +

1

LCy =

1

LCu(t) (2.13)

y(0) = vc,0, y(0) =dvCdt

(0) =i0C

(2.14)

where vc,0 and i0 are the initial conditions, i.e., the voltage across the capacitor and thecurrent through the inductor (and the whole circuit) at time 0.

The state space model consists of 2 coupled first order differential equations. Define the twostates as x1(t) = vC(t) and x2(t) = vC(t), then

x1 = s = x2

x2 = s = −RLx2 −

1

LCx1 +

1

LCu(t)

These equations can be written in matrix form as[x1x2

]

=

[0 1

− 1LC

−RL

] [x1x2

]

+

[01LC

]

u

The initial conditions are x1(0) = vc,0 and x2(0) = i0C. Also we have two states but are

interested only in one output (the voltage across the capacitor). For this reason we introducethe output equation:

y = [ 1 0 ]

[x1x2

]

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

where x(t) =

[x1(t)x2(t)

]

, A =

[0 1

−RL

− 1LC

]

, B =

[01LC

]

, C = [ 1 0 ], x0 =[vC,0

i0C

].

7 n-th Order Linear Dynamical Systems

7.1 SLODE Models

A generic n-th order SLODE model has the form

y[n](t) + a1y[n−1](t) + a2y

[n−2](t) + · · ·+ any(t) =b0u

[n](t) + b1u[n−1](t) + b2u

[n−2](t) + · · ·+ bnu(t)(2.15)

Page 30: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 22

subject to initial conditions y(0) = y[0]0 , y

[1](0) = y[1]0 , y

[2](0) = y[2]0 , . . . , y

[n−1](0) = y[n−1]0 .

where y[k] denotes the k’th derivative of the function y,

y[k] =dky

dtk

7.2 State-Space Models

A generic n-th order state space consist of n coupled first order differential equations thatlook 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 lettersm,n, p for the numbers of inputs, states, and outputs respectively. In this course we willconsider 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 ∈ Rn×n, B ∈ Rn×m, C ∈ Rp×n, D ∈ Rp×m.

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 differentialequations (and thus a state-space model). For example, consider the differential equationmodel

y[3] + 3y + 4y + 7y = u

Define the states byx1 = y, x2 = y, x3 = y

We can then re-write this differential equation model as

x1 = y = x2

x2 = y = x3

x3 = y[3] = −3y − 4y − 7y + u = −7x1 − 4x2 − 3x1 + u

y = x1

These equations can be written in matrix form as[x1x2x3

]

=

[0 1 00 0 1−7 −4 −3

][x1x2x3

]

+

[001

]

u (2.16a)

y = [ 1 0 0 ]

[x1x2x3

]

(2.16b)

Page 31: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 23

Let’s do the inverse exercise. Assume we are given the state space model (2.16). We wantto derive the equivalent SLODE model. We observe from (2.16b) that y = x1. Thereforey = x1, which is y = x1 = x2 (use the first equation in (2.16a)). Therefore y = x2, whichis y = x3 (use the second equation in (2.16a)). Finally y[3] = x3, which is y[3] = x3 =−7x1−4x2−3x3+u (use the third equation in (2.16a)). In conclusion y = −7y−4y−3y+uwhich gives the SLODE:

y[3] + 3y + 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 futurevalues of the input (i.e., u(t) for all t ≥ t0), will let you compute future values of the outputy (i.e., y(t) for all t ≥ t0).

In other words, past history (before t0) of the system’s evolution is not important in deter-mining its evolution beyond t all of the relevant past information is embedded in the statevariables value’s at t0.

For example, suppose we have a point mass subject to a force [input]. In order to predictthe future motion of the particle, we need to know the force, and also the initial conditionwhich is the position and velocity of the particle.

For an unconstrained rigid body moving in three dimensions, its state consists of the positionand velocity its center of mass and its orientation (three angles) and rotation (three angularvelocities). 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 constructin 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 otherinterface 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 electromagnetas shown below. Let y be the position of the ball, measured down from the base of theelectromagnet. If a current u is injected into the coils of the electromagnet, it will produce a

Page 32: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 24

magnetic field which in turn exerts an upward force on the ball given by Fup = − cu2

y2. Note

that the force decreases as the 1/y2 because the effect of the magnet weakens when the ballis further away, and that the force is proportional to u2 which is representative of the powersupplied to the magnet.

y

mg

upF

Figure 15: Magnetically suspended ball.

Let us assume that we can measure the position y of the ball. This can be arranged opticallyusing light-emitting diodes with photocells.

We can then write a simple model for the motion of the ball from Newton’s second law as

my = mg − cu2

y2(2.17)

Note that this is a single-input, single-output nonlinear model. The input and output of thismodel are

u the current injected into the magnet coilsy the position of the ball

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

m 0.15 Kg mass of ballc 0.01 Kg-m3/Coul2 magnetic coupling constant

We can convert this nonlinear differential equation model to a state space model by definingthe states:

x1 = y, x2 = y

We get the state-space equations:

x1 = f1(x1, x2, u) = x2

x2 = f2(x1, x2, u) = g − cu2

mx21= 10−

(u

3.87x1

)2

y = h(x1, x2, u) = x1

Page 33: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 25

There are a number of sources of modeling error in our simple model above. The mostsignificant 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 modelingomission is that we have treated the motion of the ball as rectilinear. In practice, unless theball is confined to a vertical guide, it will have small motions in the horizontal plane also.These have significant effects on the dynamics of the ball, as the magnetic force reducessignificantly off the magnet axis. We have also neglected resistive and inductive effects inthe electromagnet coils, and approximated the ball as a point mass.

Despite the simplicity of this physical system, and the crudeness of our model, we standto gain an understanding of nonlinear control using this as a test-bed. Industrial levitationsystems 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 andqout(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 afunction of the external input u(t) = qin(t). Let A be the area of the tank. By using theconservation 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)

Torricelli’s law states that the speed of a fluid through a sharp-edged hole under the forceof gravity is the same as the speed that a body would acquire in falling freely from a heighth, i.e. vout(t) =

2gh(t), where g is the acceleration due to gravity. In conclusion ournonlinear model is

h =1

A(u(t)− a

2gh(t))

Page 34: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 26

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

x = − a

A

2gx+1

Au

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 endpoint and length l = 0.75 meters. The angle θ is measured, and an actuator can supply atorque u = Tc(t) to the pivot point. The moment of inertia about the pivot point is I = ml2

By writing Euler’s equation for the pendulum, we can readily arrive at a differential equationmodel for this system:

I ¨θ(t) = Tc −mglsin(θ(t))

or¨θ(t) =

1

ml2Tc −

g

lsin(θ(t))

which is a second order nonlinear differential equation. The state space model with x1(t) =θ(t) and x2(t) = θ(t) is

x1 = x2

x2 = −glsin(x1) +

1

ml2u

9 Nonlinear Dynamical Systems in State Space Form

Note that in the previous nonlinear examples we cannot write these equations in matrixform as we did for linear differential equations. However we can find a compact form for any

Page 35: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 27

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

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

Define the states byx1 = y, x2 = y

We can then re-write this differential equation model as

x1 = y = x2

x2 = y = −3yy − 7 cos(y) + 4u2 + uy = −3x1x2 − 7x1 + 4u2 + ux1

y = x1

Note the form of these equations:

x1 = f1(x1, x2, u) = x2

x2 = f2(x1, x2, u) = − 3x1x2 − 7x1 + 4u2 + ux1

y = h(x1, x2, u) = x1

More generally, for an m-input, p-output nonlinear differential equation model, we wouldget equations like

x1 = f1(x1, · · · , xn, u1, · · · , um)...

...

xn = 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 thatthere are actually many scalar functions contained in the symbols f and h.

Page 36: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 28

10 Properties of Models

Consider a general model M with input u and output y. Note that u and y are signals. Fora signal u, we let u(t) denote the value of the signal at time t. Let us formally define someproperties 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 Mhas memory, and is called dynamic.

The model M is called causal if y(t) depends on u(τ) for τ ≤ t, and is called strictly causalif y(t) depends on u(τ) for τ < t.

The model M is called linear if

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

for any input signals u1 and u2, and any real numbers α1 and α2. This is called superpositionprinciple.

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 coefficients do not depend on time. Linear modelsin 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 usingsimple 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: theintegrator. 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 inFigure 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.

Page 37: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 sytemshown 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 byusing 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, seeFigure 23:

Page 38: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 amotor that enables some mechanical motion which, in turn, affects the dynamics of theplant. For example, the fuel flow in an automobile is actuated by a valve which is openedand closed by means of a motor. Given the importance of motors to control systems, it isworthwhile to briefly examine how they work, and to write down simple models that describetheir dynamics.

The basic principle in modeling a DC motor is that a charge q, moving in a magnetic fieldB with velocity v experiences a force F = qv×B. This yields two electromechanical ideas:

4For 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.

Page 39: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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; awire moving perpendicular to its length and perpendicular to a magnetic field experiences apotential difference 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/magnetassembly

A simple model for this has three aspects:

• Electrical: Although the resistance and inductance of the windings are distributedalong the windings, we treat them as a single lumped resistance and a single lumpedinductance.

• Mechanical: All moments acting on the shaft lead to the angular acceleration of theshaft.

Page 40: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 32

• Electromechanical: Relationships between the electrical properties and the mechanicalproperties.

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

Figure 24: DC Motor circuit.

The circuit voltages satisfy

ea(t)− i(t)R − Ldi

dt− eb(t) = 0 (2.18)

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, andthe strength of the magnetic field. The torque that is exerted on the shaft due to thecurrent/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 thestrength of the magnetic field.

Balance of angular momentum for the shaft gives

Jθ(t) = Tm(t) + TF (t) + TL(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.

Page 41: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 33

We can write these equations in the form

di

dt=

1

L[−Ri(t)−Kbω(t) + ea(t)]

dt= ω(t)

dt=

1

J[Kωi(t)−Bω(t) + TL(t)]

which is easily put into matrix form

d

dt

[i(t)θ(t)ω(t)

]

=

−RL

0 −Kb

L0 0 1Kω

J0 −B

J

[i(t)θ(t)ω(t)

]

+

1

L0

0 0

01

J

[ea(t)TL(t)

]

(2.23)

Note that if we define

x(t) :=

[i(t)θ(t)ω(t)

]

d(t) :=

[ea(t)TL(t)

]

then the equations are of the form x(t) = f(x(t), d(t)), and that the function f is actuallylinear,

x(t) = Ax(t) +Bd(t)

Usually, the inductance L is quite small, and we can make an approximation that

Ldi

dt≈ 0,

which simplifies equation (2.18) into an algebraic equation, −i(t)R+ea(t)−eb(t) = 0. Solvingfor i gives

i(t) =ea(t)− eb(t)

R

=1

Rea(t)−

Kb

Rω(t)

Hence, i is no longer governed by a differential equation, but rather an algebraic relationbetween ea and ω. This can be substituted into the state equation for ω, yielding

ω(t) = −KωKb +BR

JRω(t) +

JRea(t) +

1

JTL(t) (2.24)

Combine with θ(t) = ω(t) to get

d

dt

[θ(t)ω(t)

]

=

[0 1

0 −KωKb +BR

JR

][θ(t)ω(t)

]

+

[0 0Kω

JR

1

J

] [ea(t)TL(t)

]

(2.25)

Page 42: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 34

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

1 The Big Picture

We shall study models described by Linear Time-Invariant input-output differential equa-tions. The general form of such a model is

y[n] + a1y[n−1] + · · ·+ an−1y + any = b0u

[m] + b1u[m−1] + · · ·+ bm−1u+ bmu (3.1)

where y[k] denotes the kth derivative of the signal y(t): dky(t)dtk

. Equation (3.1) is often calledSLODE (Single Linear Order Differential Equation). Here we will require that m ≤ n. Forreasons we will understand later, this is equivalent to stating that the model (3.1) is causal.We will learn how to solve these differential equations, and more importantly, we will discoverhow to make broad qualitative statements about these solutions. Much of our intuitionabout control system design and its limitations will be drawn from our understanding of LTIsystems.

A great many models of physical processes that we may be interested in controlling are notlinear. Nevertheless, as we shall see much later, the study of LTI systems is a vital toolin learning how to control even nonlinear systems. Essentially, feedback control algorithmsmake small adjustments to the inputs based on measured outputs. For small deviations ofthe input about some nominal input trajectory, the output of a nonlinear system looks likea small deviation around some nominal output. The effects of the small input deviations onthe output is well approximated by a linear (possibly time-varying) system. It is thereforeessential to undertake a study of linear systems.

In this section, we review the solutions of linear, first-order differential equations with time-dependent forcing functions and constant coefficients. 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 tohigher order, linear ODEs, with emphasis on applying these concepts to the analysis anddesign of feedback systems.

Page 43: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 coefficients (ie.,numbers). Given the initial condition y(0) = yo and an arbitrary input function u(t) definedon [0,∞), the solution of Eq. (3.2) is given by

ys(t) = e−at yo︸ ︷︷ ︸

yh(t), free resp.

+

∫ t

0

e−a(t−τ) b u(τ) dτ

︸ ︷︷ ︸

yp(t), forced resp.

. (3.3)

The first term of the solution above is called the homogeneous solution yh(t). It is the partof 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 componentis due to the input u alone. It is also called the forced response, the zero-state response, orthe input response.

We can easily check that (3.3) is indeed the solution of (3.2) by verifying two facts: thefunction ys satisfies the differential equation for all t ≥ 0; and ys satisfies the given initialcondition at t = 0. The theory of differential equations tells us that there is one and onlyone function that satisfies both (existence and uniqueness of solutions). To verify, first checkthe value of ys(t) at t = 0:

ys(0) = e−a0 yo +

∫ 0

0

e−a(t−τ) b u(τ) dτ = yo .

Taking the time derivative of (3.3) we obtain

ys(t) = −a e−at yo +d

dt

e−at∫ t

0

eaτ b u(τ) dτ

= −a e−at yo − a e−at∫ t

0

eaτ b u(τ) dτ

︸ ︷︷ ︸

−ays(t)

+e−ateat b u(t)

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

as desired.

Page 44: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 36

3 The Free Response

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

0 1 2 30

0.5

1

1.5

2

2.5

3

0 1 2 3 40

0.2

0.4

0.6

0.8

1

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

In the second panel, we have plotted the normalized free response when a > 0. Moreprecisely, we have plotted y(t)/yo versus at. The time

T :=1

a

is called the time constant of a first order stable system ( a > 0). T is an indication of howfast is the response of the system. The larger a, the smaller T and the faster the responseof the system.

Notice that

yh(T )

yo=

1

e≈ .37 = 37%

yh(2T )

yo=

1

e2≈ .13 ≈ 10%

yh(3T )

yo=

1

e3≈ .05 = 5%

The calculations above states that the free response essentially decays to zero within threetime 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 willmore 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, thefree response always decays to zero. This is because with u(t) = 0, we have

limt→∞

y(t) = limt→∞

e−atyo = 0

Page 45: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 37

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

|y(t)| =

∣∣∣∣e−atyo +

∫ t

0

e−a(t−τ)bu(τ)dτ

∣∣∣∣≤∣∣e−atyo

∣∣+

∫ t

0

∣∣e−a(t−τ)bu(τ)

∣∣ dτ

≤ |yo|+∫ t

0

Kue−a(t−τ)bdτ ≤ |yo|+Kub = Ky

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:

u(t) =

0 t < 0uss t ≥ 0

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

y(t) = e−atyo +

∫ t

0

e−a(t−τ)bussdτ = e−atyo +bussa

(1− e−at

)

= e−atyo −b

ausse

−at

︸ ︷︷ ︸

ytr(t)

+b

auss︸︷︷︸

yss(t)

(3.4)

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

yss = limt→∞

y(t) =b

auss (3.5)

so the steady-state gain to step inputs is b/a. This fact critically depends on our assumptionthat 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.

Page 46: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 38

0 2 4 6 8 10 12 14 16 18−2

−1.5

−1

−0.5

0

0.5

1

Time (sec)

responseinput

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 factis very useful in sketching the response of first-order systems to inputs composed of steps ofvarious heights, as illustrated in Figure 26.

4.1 Linearity

Why is the differential equation in (3.2) called a linear differential equation? Suppose y1 isthe solution to the differential equation with the initial condition y0,1 and forcing function u1,and y2 is the solution to the differential equation with the initial condition y0,2 and forcingfunction 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 (different initial condition, differentforcing).

Now take two constants α and β. What is the solution to the differential equation withinitial condition y(0) = αy0,1 + βy0,2, and forcing function u(t) = αu1(t) + βu2(t)? It is easy(just plug into the differential equation, or the integral form of the solution) to see that thesolution is

y(t) = αy1(t) + βy2(t)

This is often called the superposition property. In this class, we will more typically use theterm linear, indicating that the solution of the differential equation is a linear function ofthe (initial condition, forcing function) pair.

5 The Sinusoidal Response

We now compute the response of a stable first-order LTI system to sinusoidal inputs. Thisis important because any input may be decomposed via the Fourier Transform into a sum

Page 47: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 39

of sinusoidal terms. Since the system under consideration is linear, the forced response issimply the sum of the forced responses (weighted by the Fourier coefficients) to the sinusoidalterms. Studying the response of a first order system due to sinusoidal inputs will serve uswell 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

u(t) =

0 t < 0U sin(ωt) t ≥ 0

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

y(t) = e−atyo +

∫ t

0

e−a(t−τ)bU sin(ωτ)dτ

= e−atyo +bωU

a2 + ω2e−at

︸ ︷︷ ︸

ytr(t)

+Ub

a2 + ω2(a sin(ωt)− ω cos(ωt))

︸ ︷︷ ︸

yss(t)

(3.7)

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 timeconstants (i.e. 3/a = 3 seconds), after which the total response y is indistinguishable fromthe steady state response yss.

0 2 4 6 8 10 12 14 16 18 20

−1

0

1

2

3

Time (sec)

uyy

ss

Figure 27: Sinusoidal response.

Observe that the response above has three terms: the first two decay to zero, and the thirdpersists in time. This observation rests on our assumption that the system is stable. Thecomponents of the sinusoidal response that decay to zero are called the transient response,

Page 48: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 40

while the component that persists in time is called the steady-state response. Lets look moreclosely at the steady-state response. Using standard trigonometric identities 6 we can write

yss(t) =M(ω)U sin(ωt+ φ)

where

M(ω) =b√

a2 + ω2, φ(ω) = Tan−1(

−ωa

) (3.8)

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-shiftedby φ(ω).

It is quite easy to verify that the same result holds for cosine inputs also. The amplitudegainM(ω) and the phase shift φ(ω) are called the frequency response of the stable first-orderLTI system (3.6).

6 The Frequency Response

It is very useful to plot the frequency response (3.8). In many physical systems the range offrequencies we are interested in is quite broad, and the amplitude gainM(ω) can have a widerange of values. Experience has revealed that it is more informative7 to plot the magnitudefrequency response on a log-log scale, and the phase frequency response on a linear-log scale.More precisely, engineers usually plot

20 log10M(ω) vs. log10 ω, and φ(ω) vs. log10 ω

The quantity 20 log10M(ω) occurs so commonly that it has its own units called decibelswhich is abbreviated as db. The table of Figure 28 converts some gain values to decibels. Itis 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 wehave derived in the previous section.

6It is easy to verify that

A sin(θ) +B cos(θ) =√

A2 +B2 sin(θ + φ)

where the phase offset φ is given by

φ = Tan−1(B

A)

7This is particularly true for highly resonant systems.

Page 49: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 41

M(ω) 20 log10M(ω).01 −40 db.1 −20 db1 0 db2 ≈ 6 db5 ≈ 14 db10 20 db20 ≈ 26 db50 ≈ 34 db100 40 db

Figure 28: Gain todecibel conversions.

Normalized Frequency ω/a (rad/sec)

Pha

se (

deg)

Mag

nitu

de (

db)

−40

−30

−20

−10

0

0.1 1 10 100

−80

−60

−40

−20

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 thedifferential equation (3.2).

2. Suppose f is a piecewise continuous function. Assume A < B. Explain (with pictures,or equations, etc) why

∣∣∣∣

∫ B

A

f(x)dx

∣∣∣∣≤∫ B

A

|f(x)| dx

This simple idea is used repeatedly when bounding the output response in terms ofbounds on the input forcing function.

3. A stable first-order system (input u, output y) has differential equation model

x(t) = ax(t) + bu(t)= a

[x(t)− b

−au(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 signalu

u(t) = 1 for 0 ≤ t < 5u(t) = 2 for 5 ≤ t < 10u(t) = 6 for 10 ≤ t < 10.1u(t) = 3 for 10.1 ≤ t <∞.

Page 50: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 42

sketch a reasonably accurate graph of x(t) for t ranging from 0 to 20. The sketchshould be based on your understanding of a first-order system’s response (usingits 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 theinput signal u

u(t) = 1 for 0 ≤ t < 0.005u(t) = 2 for 0.005 ≤ t < 0.01u(t) = 6 for 0.01 ≤ t < 0.0101u(t) = 3 for 0.0101 ≤ t <∞.

sketch a reasonably accurate graph of x(t) for t ranging from 0 to 0.02. Thesketch should be based on your understanding of a first-order system’s response,not by doing any particular integration. In what manner is this the “same” asthe response in part 3b?

4. Consider the first-order linear system

x(t) = A [x(t)− u(t)]

with A < 0. Note that the system is stable, the time constant is τc = 1−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 different manners - carry out the convolution integral, orverify that the proposed solution satisfies the initial condition (at t = 0) and satisfiesthe differential equation for all t > 0. Both are useful exercises, but you only need todo one for the assignment. Note that if we ignore the decaying exponential part of thesolution, then the “steady-state” solution is also a unit-ramp, but it is delayed fromthe input by τc time units. This gives us another interpretation of the time-constantof 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− ψ). Explainwhat 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− ψ)

Page 51: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 43

(c) Explain how the graphs in part 5b confirm the claim in part 5a.

6. For the first-order linear system (constant coefficients 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) fort ≥ 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

G(ω) =cb

jω − a

Make a plot oflog10 |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). Putboth 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 bothangle 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 eachgraph, also plot u(t). In each case, pick the overall duration so that the limitingbehavior is clear, but not so large that the graph is cluttered. Be sure and getthe steady-state magnitude and phasing of the response y (relative to u) correct.

Page 52: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 44

(e) Compare the steady-state sinusoidal responses of the response you computed andplotted 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. Markthe relevant points of the frequency-response curves.

7. With regards to your answers in problem 6,

(a) Comment on the effect 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 coefficients 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. Supposethat 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, sketchthe inverse function tan−1(w) versus w for all w. Note that the inverse functionis multivalued, since for any angle θ and any integer n, tan (θ) = tan (θ + nπ).From now on, when we refer to tan−1, we mean the function that for everyy ∈ R, −π

2< tan−1(y) < π

2, and tan (tan−1(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 beable to exactly describe what sin φ and what cosφ are. If you divide to write itin tan−1 form, make sure that you verify the rule we set out above.

(c) Numerically fill in the table below

Page 53: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 ≈ 1

1000|A|, choose

ωmax ≈ 1000|A|. Useful functions are logspace, loglog and ./ (period, slash).On each graph, hand-draw in “straightline” approximations which come from theentries in the table you derived above. Specifically, plot the 7 points, and connectthem with straight lines. Qualitatively, compare the straightline approximationto 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-drawin “straightline” approximations which come from the entries in the table you de-rived above. Qualitatively, compare the straightline approximation to the actualcurves.

(g) So, consider the cascade connection of two, first-order, stable, systems

x1(t) = A1x1(t) +B1u(t)y1(t) = C1x1(t) +D1u(t)x2(t) = A2x2(t) +B2y1(t)y(t) = C2x2(t) +D2y1(t)

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

S1 S2- - -u y1 y

Suppose that the frequency response of System 1 is M1(ω), φ1(ω) (or just thecomplex G1(ω)), and the frequency response of System 2 is M2(ω), φ2(ω) (ie., thecomplex 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(ω))

Page 54: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 46

(h) Let G denote the complex function representing the frequency response (forcing-frequency-dependent amplitude magnification A and phase shift φ, combined intoa 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) + b1d(t) + b2u(t)y(t) = cx(t)

A proportional control,u(t) = K1r(t)−K2ymeas(t)

is used, and the measurement is assumed to the be the actual value, plus measurementnoise,

ymeas(t) = y(t) + n(t)

As usual, y is the process output, and is the variable we want to regulate, r is thereference signal (the desired value of y), d is a process disturbance, u is the controlvariable, n is the measurement noise (so that y + n is the measurement of y), K1 andK2 are gains to be chosen. For simplicity, we will choose some nice numbers for thevalues, 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 gainsas described below, and look at closed-loop properties. The goal of the problem is tostart 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 andK2 are variables, substitute for u, write the differential equationfor x in the form

x(t) = Ax(t) +B1r(t) +B2d(t) +B3n(t)

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

y(t) = C1x(t) +D11r(t) +D12d(t) +D13n(t)u(t) = C2x(t) +D21r(t) +D22d(t) +D23n(t)

Together, these are the “closed-loop governing equations.” Note that all of thesymbols (A,B1, . . . , D23) will be functions of a and the controller gains. Below,we will “design” K1 and K2 two different ways, and assess the performance of theoverall system.

(b) Under what conditions is the closed-loop system is stable? Under those conditions,

Page 55: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 atthe plant (no controller), u and d are independent inputs, and the steady-stategain from d to y is cb1

−a which in this particular instance happens to be 1. Findthe value of K2 so that: the closed-loop system is stable; and the magnitude ofthe closed-loop steady-state gain from d to y is 1

5of the magnitude of the open-

loop steady-state gain from d to y. That will be our design of K2, based on thisdisturbance rejection specification.

(d) With K2 chosen, choose K1 so that the closed-loop steady-state gain from r to yis equal to 1 (recall, the goal is that y should “track” r, as r represents the desiredvalue of y).

(e) Next, we will assess the design in terms of the closed-loop effect that the externalinputs (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. Fornotational purposes, letHv→q denote the frequency-response function from a inputsignal v to an output signal q (for example, from r to y). We will be making plotsof

|Hv→q(ω)| vs ω and ∠Hv→q(ω) 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, youwill use commands such as loglog, semilogx, abs and angle. As mentioned, theplots will be arranged in a 2× 3 array, organized as

|Hr→y|∠Hr→y

|Hd→y| |Hn→y||Hr→u|∠Hr→u

|Hd→u| |Hn→u|

Note that because 2 of the entries actually have both the magnitude and angleplotted, there will be 8 axes. If you forget how to do this, try the followingcommands 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);

Page 56: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 48

Plot the frequency-response functions. Use (for example) 100 logarithmicallyspaced 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 case’sclosed-loop property, and then compare other closed-loop properties. For theunstable 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 stableplant 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 allthe 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 disturbancerejection, the system with the unstable plant uses “more” control input u, and ismore sensitive to noise at all frequencies.

(h) Look at the paper entitled “Respect the Unstable” by Gunter Stein. It is in theIEEE Control Systems Magazine, August 2003, pp. 12-25. You will need to ignoremost of the math at this point, but there are some good paragraphs that reiteratewhat I am saying here, and good lessons to be learned from the accidents hedescribes. Please write a short paragraph about one of the accidents he describes.

10. Re-read “Leibnitz’s” 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 thisis

x(t) = e∫ t0a(ξ)dξxo +

∫ t

0

e∫ tτa(ξ)dξb(τ)u(τ)dτ

11. Suppose two systems are interconnected, with individual equations given as

S1 : y(t) = [u(t)− y(t)]S2 : u(t) = 2 [y(t)− r(t)]

(3.9)

(a) Consider first S1 (input u, output y): Show that for any initial condition y0, ifu(t) ≡ u (a constant), then y(t) approaches a constant y, that only depends onthe 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).

Page 57: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 andy, only dependent on r. Draw a block-diagram showing how the limiting valuesare 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 allt ≥ 0. Eliminate u from the equations A.5, and determine y(t) for all t. Make asimple 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 analysisin part 4c is incorrect. That is why, for a closed-loop steady-state analysis to be basedon the separate component’s steady-state properties, we must know from other meansthat 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)]S2 : u(t) = 2 [r(t)− y(t)]

(3.10)

(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 theequations 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 thevalue 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 feedbackwith 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) + b1d(t) + b2u(t)y(t) = cx(t)

(a) Assume P is stable (ie., a < 0). For P itself, what is the steady-state gain fromu to y (assuming d ≡ 0)? Call this gain G. What is the steady-state gain from dto y (assuming u ≡ 0)? Call this gain H .

(b) P is controlled by a “proportional” controller of the form

u(t) = K1r(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. Bysubstituting for u, write the differential equation for x in the form

x(t) = Ax(t) +B1r(t) +B2d(t) +B3n(t)

Page 58: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 50

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

y(t) = C1x(t) +D11r(t) +D12d(t) +D13n(t)u(t) = C2x(t) +D21r(t) +D22d(t) +D23n(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 differentways, 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-stategain from d to y (assuming r ≡ 0 and n ≡ 0)?

(d) Design a “feed-forward” controller based on the steady-state gainG. In particular,pick K1 :=

1G, 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 systemas the “closed-loop” system.

i. For the “closed-loop” system, compute the steady-state gains from all externalinputs (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 parameterb2? Here you should treat K1 as a fixed number.

iv. Comment on the relationship between the open-loop steady-state gain fromd→ 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 d’s eventual effecton 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 hadno feedback (K2 = 0). So the closed-loop system is in fact an open-loopsystem. Summarize the effect of the open-loop control strategy (called “feed-forward,” since the control input is actually just a function of the referencesignal 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 wellas the tracking capabilities (how y follows r), the sensitivity of the trackingcapabilities to parameter changes, and the disturbance rejection properties.

(e) Now design a true feedback control system. Pick K2 so that the closed-loopsteady-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 thatthe 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.

Page 59: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 51

i. With K2 chosen, pick K1 so that the closed-loop steady-state gain from r → yis 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 theprevious case (feedforward)?

v. With K2 6= 0, does the noise n now affect y?

(f) Let’s 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 forthe 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 ina 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 lineson 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 feedbacksystem accomplishes good tracking that is more insensitive to process parameterchanges than the feedforward system.

14. Consider a system with input u, and output y governed by the differential equation

y(t) + a1y(t) = u(t) + b1u(t) (3.11)

This is different than what we have covered so far, because the derivative of the inputshows up in the right-hand-side (the overall function forcing y, from the ODE point ofview).

(a) Let q(t) := y(t)− u(t). By substitution, find the differential equation governingthe 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-stepfunction input). Solve for q, using the differential equation found in part 14ainitial condition q(0) = 0.

(c) Since y = q + u, show that the step-response of 6.3 is

y(t) =b1a1

+

(

1− b1a1

)

e−a1t

Page 60: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 52

(d) Suppose that a1 > 0. Draw the step response for two cases: b1 = 0.9a1 andb1 = 1.1a1. Comment on the step response for 0 < a1 ≈ b1. What happens ifa1 < 0 (even if b1 ≈ a1, but not exactly equal)?

Page 61: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 53

4 Review of SLODEs

Throughout this section, if y denotes a function (of time, say), then y[k] or y(k) denotes thek’th derivative of the function y,

y[k] =dky

dtk

In the case of k = 1 and k = 2, it will be convenient to also use y and y.

1 Linear, Time-Invariant Differential Equations

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

y(n)(t) + a1y(n−1)(t) + · · ·+ any(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 acombination of such signals. One job of the control designer is to analyze the resultingequation, and determine if the behavior of the closed-loop system is acceptable.

The differential equation in (4.1) is called a forced, linear, time-invariant differential equa-tion. For now, associate the fact that the aini=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 yand its derivatives with the term linear.

The right-hand side function, v, is called the forcing function. For a specific problem, it willbe a given, known function of time.

Sometimes, we are given an initial time t0 and initial conditions for differential equation,that is, real numbers

y0, y0, y0, . . . , y(n−1)0 (4.2)

and we are looking for a solution, namely a function y that satisfies both the differentialequation (4.1) and the initial condition constraints

y(t0) = y0, y(t0) = y0, y(t0) = y0, . . . , y(n−1)(t0) = y(n−1)0 . (4.3)

For essentially all differential 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, definedfor t ≥ t0, and initial conditions of the form (4.3). Then, there exists a unique function ywhich satisfies the initial conditions and the differential equation (4.1).

Page 62: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 54

2 Importance of Linearity

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

y(n)P (t) + a1y

(n−1)P (t) + · · ·+ anyP (t) = v(t) (4.4)

and yH is a function which, for all t satisfies

y(n)H (t) + a1y

(n−1)H (t) + · · ·+ anyH(t) = 0 (4.5)

yH is called a homogeneous solution of (4.1), and the differential equation in (4.5) is calledthe homogeneous equation. The function yP is called a particular solution to (4.1), since itsatisfies 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 byyP and yH to get

[yP + yH ](n) (t) + a1 [yP + yH ]

(n−1) (t) + · · · an [yP + yH ] (t) = v(t)

This implies that the function yP+yH also satisfies (4.1). Hence, adding a particular solutionto a homogeneous solution results in a new particular solution.

Conversely, suppose that yP1and yP2

are two functions, both of which solve (4.1). Considerthe 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 differ by a homogeneous solution. Henceall 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

Let’s try to solve (4.5). Take a fixed complex number r ∈ C, and suppose that the functionyH , defined as

yH(t) = ert

is a solution to (4.5). Substituting in, using the fact that for any integer k > 0, y(k)H (t) = rkert,

gives(rn + a1r

n−1 + · · ·+ an)ert = 0

Page 63: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 55

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

rn + a1rn−1 + · · ·+ 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 substitutionreveals 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, . . . , tl−1ert

all satisfy the

homogeneous differential equation. This leads to the following nomenclature:

Let r1, r2, . . . , rn be the roots of the polynomial equation

λn + a1λn−1 + · · ·+ an = 0

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

Fact 1 (requires proof): If the rini=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

yH(t) =n∑

i=1

cierit (4.7)

Fact 2 (requires proof): If the rini=1 are not distinct from one another, then group theroots r1, r2, · · · , rn as

p1, p1, . . . , p1︸ ︷︷ ︸

l1

, p2, p2, . . . , p2︸ ︷︷ ︸

l2

, · · · , pf , pf , . . . , pf︸ ︷︷ ︸

lf

(4.8)

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

yH(t) =

f∑

i=1

li−1∑

j=0

cijepittj (4.9)

So, Fact 2 includes Fact 1 as a special case. Both indicate that by solving for the roots of thecharacteristic equation, it is easy to pick n linearly independent functions which form a basisfor the set of all homogeneous solutions to the differential equation. Here, we explicitly haveused the time-invariance (ie., the coefficients of the ODE are constants) to generate a basis(the exponential functions) for all homogeneous solutions. However, the fact that the spaceof homogenous solutions is n-dimensional only relies on linearity, and not time-invariance.

Page 64: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 56

Basic idea: Suppose there arem solutions to the homogeneous differential equation, labeledy1,H , y2,H, . . . , ym,H, with m > n. Then, look at the n ×m matrix of these solutions initialconditions,

M :=

y(0)1,H y

(0)2,H · · · y

(0)m,H

y(1)1,H y

(1)2,H · · · y

(1)m,H

......

. . ....

y(n−1)1,H y

(n−1)2,H · · · y

(n−1)m,H

Since m > n, this must have linearly dependent columns, so there is a nonzero m× 1 vectorα such that Mα = 0n×1. Define yz := α1y1,H + α2y2,H + · · ·+ αmym,H . Since this is a sumof homogeneous solutions, it itself is a homogeneous solution. Moreover, yz satisfies

y(0)z (t0) = 0, y(1)z (t0) = 0, · · · , y(n−1)z (t0) = 0

Note that the function yI(t) ≡ 0 for all t also satisfies the same initial conditions as yz, andit satisfies the homogeneous differential equation as well. By uniqueness of solutions, it mustbe that yz(t) = yI(t) for all t. Hence, yz is actually the identically zero function. Hence, wehave shown that the set of homogeneous solutions is finite dimensional, and of dimension atmost n. Moreover, by the simple substitutions above, we already know how to construct nlinearly independent solutions to the homogeneous differential equation, so those must forma basis for all homogeneous solutions.

The reason that terms like tkert appear for differential equations whose characteristic equa-tion has repeated roots is partially explored in Problem 6.

3.1 Interpretation of complex roots to ODEs with real-coefficients

In all cases we consider, the differential equation has real coefficients (the a1, a2, . . . , an).This means that the characteristic equation has real coefficients, but it does not mean thatthe roots are necessarily real numbers (eg., even a real quadratic equation may have complexroots). However, since the coefficients are real, then complex roots will come in complex-conjugate pairs, so if λ := α + jβ is a root, and α and β are real numbers, and β 6= 0, thenit 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 theconstants vary over all choices of complex numbers. We will almost exclusively be interestedin solutions starting from real initial conditions, with real forcing functions, and hence willonly need to consider real homogeneous solutions. This raises the question of how to interpretthe complex functions eλt which arise when λ (a root) is complex.

Suppose λ1 ∈ C is a complex root. Since the characteristic equation has real coefficients,it follows that that complex conjugate of λ1, λ2 = λ1 is also a root. Let α and β be realnumbers such that

λ1 = α + jβ, λ2 = α− jβ, β 6= 0

Page 65: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 57

The terms of the homogeneous solution associated with these roots are

c1eλ1t + c2e

λ2t

where c1 and c2 are any complex numbers. We want to study under what conditions (on c1and c2) will this function be purely real. Plugging in gives

c1eαt [cos βt+ j sin βt] + c2e

αt [cos βt− j sin βt]

Regrouping gives(eαt [(c1 + c2) cos βt+ j(c1 − c2) sinβt]

Since cos and sin are linearly independent functions, the only conditions for this to be apurely real function is that c1 + c2 be real, and j(c1 − c2) be real. This requires that c1 andc2 be complex-conjugates of one another. In other words, for the function

c1eαt [cos βt+ j sin βt] + c2e

αt [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 partof c2. Also, j(c1 − c2) = 2B, where B is the imaginary part of c2. Hence, the purely realhomogeneous solutions are of the form

eαt [2A cos βt+ 2B sin βt]

where A and B are free real constants. Since they are free, it serves no purpose to write 2Aand 2B, and we can simply write that all real homogeneous solutions arising from the tworoots λ1 = α + jβ and λ2 = α− jβ are

eαt [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 thecoefficients of the ODE are real, and we are interested in writing down a description of allreal homogeneous solutions.

Fact 3: Assume that all coefficients a1, a2, . . . , an are real numbers. Group the n roots ofthe characteristic equation as

p1, p1, . . . , p1︸ ︷︷ ︸

l1

, · · · , pd, pd, . . . , pd︸ ︷︷ ︸

ld

,

α1 + jβ1, α1 + jβ1, . . . , α1 + jβ1︸ ︷︷ ︸

h1

, α1 − jβ1, α1 − jβ1, . . . , α1 − jβ1︸ ︷︷ ︸

h1

,

...αc + jβc, αc + jβc, . . . , αc + jβc︸ ︷︷ ︸

hc

, αc − jβc, α1 − jβc, . . . , αc − jβc︸ ︷︷ ︸

hc

(4.10)

Page 66: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 58

where each p, α and β are real, and each β 6= 0. Then yH is a real-valued function whichsatisfies (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

yH(t) =d∑

i=1

li−1∑

j=0

cijepittj +

c∑

k=1

hk−1∑

s=0

eαktts [Aks cos βkt +Bks sin βkt] (4.11)

4 General Solution Technique

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

1. Find any particular solution yP

2. Choose constants cij so that the function

yP (t) +

f∑

i=1

li−1∑

j=0

cijtjepit

satisfies the initial conditions.

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

5 Behavior of Homogeneous Solutions as t→ ∞

In this section, we study the behavior of the class of homogeneous solutions as t→ ∞. If wecan show that all homogeneous solutions decay to 0 as t→ ∞, then it must be that for a giveforcing function, all particular solutions, regardless of the initial conditions, approach eachother. 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 imaginaryparts. Let α := Real(r) and β := Imag(r). Hence, both α and β are real numbers, andr = α+ jβ. We will always use j :=

√−1. The exponential function ert can be expressed as

ert = eαt [cos βt+ j sin βt]

Note that the real part of r, namely α, determines the qualitative behavior of ert as t→ ∞.Specifically,

Page 67: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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, wesee that the roots of the characteristic polynomial determine the qualitative nature of thehomogeneous 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

erpt, t erpt, · · · , t(lp−1) erpt .

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

limt→∞

tm eαt = 0 .

Therefore, the real part of the repeated root rp, namely αp, also determines the qualitativebehavior of the homogeneous solution modes associated with this repeated root as t → ∞.Specifically,

• if αp < 0, then limt→∞ tm erpt = 0 for m = 0, · · · lp − 1.

• if αp = 0, then |erpt| = 1 for all t, but

• if αp ≥ 0, then limt→∞ |tmert| = ∞ 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, rini=1, of the characteristic polynomial satisfy

Real(ri) < 0

then every homogeneous solution decays to 0 as t→ .∞

• If any of the roots, rini=1, of the characteristic polynomial satisfy

Real(ri) ≥ 0

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

Page 68: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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) + a1y[n−1](t) + · · ·+ an−1y

[1](t) + any(t)= b0u

[n](t) + b1u[n−1](t) + · · ·+ bn−1u

[1](t) + bnu(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 functionyP (t) ≡ bn

anu is a particular solution, although it does not satisfy any of the initial conditions.

The actual solution y differs from this particular solution by some homogeneous solution,yH . Hence for all t,

y(t) = yP (t) + yH(t)

=bnanu+ yH(t)

Now, take limits, since we know (by the stability assumption) that limt→∞ yH(t) = 0, giving

limt→∞

y(t) =bnanu

Hence, the steady-state gain of the system isbnan

.

Page 69: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 61

7 Example

Consider the differential equation

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

subject to the initial conditions y(0) = y0, y(0) = y0. 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) = c1e−3.7t + c2e

−0.3t

Terms of the form e−3.7t take about 0.8 time units to decay, while terms of the form e−0.3t

take about 10 time units to decay. In general then (though not always - it depends on theinitial 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 yPdoes not satisfy the initial conditions, but it does satisfy the differential equation.

As we have learned, all solutions to (4.12) are any particular solution plus all homogeneoussolutions. Therefore, the general solution is

y(t) = 1 + c1e(−2−

√3)t + c2e

(−2+√3)t

which has as its derivative

y(t) = (−2 −√3)c1e

(−2−√3)t + (−2 +

√3)c2e

(−2+√3)t

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

y(0) = 1 + c1 + c2= y0

y(0) =(−2−

√3)c1 +

(−2 +

√3)c2

= y0

In matrix form, we have[

1 1−2−

√3 −2 +

√3

] [c1c2

]

=

[y0 − 1y0

]

This is easy to invert. recall

[a bc d

]−1

=1

ad− bc

[d −b−c a

]

Page 70: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 62

Hence [1 1

−2 −√3 −2 +

√3

]−1

=1

2√3

[−2 +

√3 −1

2 +√3 1

]

so that [c1c2

]

=

[1 1

−2−√3 −2 +

√3

]−1 [y0 − 1y0

]

For the case at hand, let’s take y0 := 0, y0 := 0, hence[c1c2

]

=1

2√3

[2−

√3

−2−√3

]

A plot of y(t) is shown in the figure below.

0 5 10 150

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Time, t

Res

pons

e, y

(t)

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

8 Stability Conditions for 2nd order differential equation

Given real numbers a0, a1 and a2, with a0 6= 0, we wish to determine if the roots of theequation

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

a0y(t) + a1y(t) + a2y(t) = 0

Page 71: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 63

Since a0 6= 0 (so that we actually do have a quadratic, rather than linear equation) divideout by it, giving

y(t) +a1a0y(t) +

a2a0y(t) = 0

Call b1 :=a1a0, b2 :=

a2a0. The characteristic equation is λ2 + b1λ+ b2 = 0. The roots are

λ1 =−b1 +

b21 − 4b22

, λ2 =−b1 −

b21 − 4b22

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, then

Re(λi) =−b12

≥ 0. If the square-root is real, then then Re(λ1) =−b1+

√b21−4b2

2≥ 0. In

either case, at least one of the roots has a nonnegative real part.

3. b2 ≤ 0: In this case, the square root is real, and hence both roots are real. However,√

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 negativereal parts if and only if b1 > 0, b2 > 0.

If the leading coefficient 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. Wewill study simple methods to determine if all of the roots have negative real parts later. Forinstance;

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 b1b2 > b3.

Note that the condition b1b2 > b3, coupled with the first two conditions, certainly impliesthat b2 > 0. However, the simpler conditions b1 > 0, b2 > 0, b3 > 0 are only necessary, not

Page 72: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 64

sufficient, 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 systemby simple examination of its characteristic equation coefficients.

Theorem (RH4): For a fourth order polynomial equation λ4+b1λ3+b2λ

2+b3λ+b4 = 0, allof the roots have negative real parts if and only if b1 > 0, b4 > 0, b1b2 > b3 and (b1b2−b3)b3 >b21b4.

These theorems are specific examples of the Routh-Hurwitz theorem which is often taught inundergraduate 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 polynomialequation

λn + b1λn−1 + · · ·+ bn−1λ+ bn = 0

have negative real-parts. The theorem states that all roots have negative real parts if andonly if n simple inequalities, involving polynomial expressions of the coefficients (the bk) aresatisfied. Note that the theorem does not find the roots - it merely proves, unequivocally, thatthe roots all lie in the open, left-half plane if and only if some easy-to-evaluate expressions,involving the coefficients, are negative. There is a pattern by which one can “simply” derivewhat 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 conditionsbecome more complex with increasing order. For systems beyond 4th order, it is not clear howuseful (beyond the theoretical elegance) the formula are, especially in the context of modernlaptop computational power, where high-quality root-finding programs are easily accessible(eg., Matlab, Mathematica, etc). We encourage the student to memorize the 2nd, 3rd and4th order conditions and through their use, determine if knowing higher-order versions wouldbe useful. The interested student can find more information about Routh-Hurwitz on theweb.

9 Important 2nd order example

It is useful to study a general second order differential equation, and interpret it in a differentmanner. Start with

y(t) + a1y(t) + a2y(t) = bv(t) (4.13)

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

y(t) + 2ξωny(t) + ω2ny(t) = bv(t)

Page 73: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 65

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

2ξωn = a1, ω2n = a2

which can be inverted to give

ξ =a1

2√a2, ωn =

√a2

Note that since a1, a2 > 0, we also have ξ, ωn > 0. With these new variables, the homoge-neous equation is

y(t) + 2ξωny(t) + ω2ny(t) = 0

which has a characteristic polynomial

λ2 + 2ξωnλ+ ω2n = 0

The roots are atλ = −ξωn ± ωn

ξ2 − 1

= −ξωn ± jωn√

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

yH(t) = c1e

(

−ξωn+ωn

√ξ2−1

)

t+ c2e

(

−ξωn−ωn

√ξ2−1

)

t

• ξ = 1, which results in repeated real roots, at λ = −ξωn, so that the general form ofhomogeneous solutions are

yH(t) = c1e−ξωnt + c2te

−ξωnt

• 0 < ξ < 1: Roots are distinct, and complex (complex-conjugate pair), with negativereal part, and the general homogeneous solution is easily expressable as

yH(t) = c1e

[

−ξωn+jωn

√1−ξ2

]

t+ c2e

[

−ξωn−jωn

√1−ξ2

]

t

This can be rewritten as

yH(t) = e−ξωnt[

c1ejωn

√1−ξ2t + c2e

−jωn

√1−ξ2t

]

Recall ejβ = cos β + j sin β. Hence

yH(t) = e−ξωnt

[c1 cosωn

1− ξ2t + jc1 sinωn√

1− ξ2t

+c2 cosωn√

1− ξ2t − jc2 sinωn√

1− ξ2t

]

which simplifies to

yH(t) = e−ξωnt[

(c1 + c2) cosωn√

1− ξ2t + j(c1 − c2) sinωn√

1− ξ2t]

Page 74: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 66

For a general problem, use the initial conditions to determine c1 and c2. Usually, the initialconditions, y(0), y(0), are real numbers, the differential equation coefficients (a1, a2 or ξ, ωn)are real, hence the solution must be real. Since cosωn

1− ξ2t and sinωn√

1− ξ2t arelinearly independent functions, it will always then work out that

c1 + c2 = purely realc1 − c2 = purely imaginary

In other words, Im(c1) = −Im(c2), and Re(c1) = Re(c2), which means that c1 is the complexconjugate of c2.

Under this condition, call c := c1. The homogeneous solution is

yH(t) = e−ξωnt[

2Re(c) cosωn√

1− ξ2t − 2Im(c) sinωn√

1− ξ2t]

Use A := 2Re(c), and B := −2Im(c), and the final form of the real homogeneous solution is

yH(t) = e−ξωnt[

A cosωn√

1− ξ2t + B sinωn√

1− ξ2t]

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− ξ2 is the imaginarypart.

The solution is made up of two terms:

1. An exponentially decaying envelope, e−ξωnt. Note that this decays to zero in approxi-mately 3

ξωn

2. sinosoidal oscillation terms, sinωn√

1− ξ2t and cosωn√

1− ξ2t. The period of oscil-lation is 2π

ωn

√1−ξ2

.

Comparing these times, we expect “alot of oscillations before the homogeneous solutiondecays” if

ωn√

1− ξ2<<

3

ξωn

Clearly ωn drops out of this comparison, and the above condition is equivalent to

3

ξ√

1− ξ2<< 1

This quantity is very small if and only if ξ is very small, in which case there are manyoscillations in the homogeneous solutions, and the system associated with the differentialequation is called “lightly damped.” The quantity ξ is called the damping ratio.

Page 75: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 67

If 2π3

ξ√1−ξ2

<< 1, then homogeneous solutions “look like”

Typical Lightly Damped Response

Time

Res

pons

e

Conversely, if 2π3

ξ√1−ξ2

>> 1, then then homogeneous solutions “look like”

Typical Heavily Damped Response

Time

Res

pons

e

A moderate value of ξ, say ξ ≈ 0.7 gives homogeneous responses that “look like” the figurebelow.

Page 76: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 68

Typical Moderately Damped Response

Time

Res

pons

e

Another way to look at this is to consider the quotient

N :=Time to decay

Period of oscillation

If N is 4, one would expect to see ≈ 4 periods of oscillation before the homogeneous solutionhas significantly decayed (since the time it takes to decay is about 4 periods). By contrast, ifN = 0.5, then one would expect to see about 1

2of a period of oscillation before the solution

has decayed. We can compute N , in terms of ξ and ωn, namely

N =

3ξωn

2π√1−ξ2

=3√

1− ξ2

2πξ

The quantity N is graphed, as a function of ξ. Typical plots of homogeneous solutions areplotted for 5 cases. The corresponding value of N matches quite nicely with the number of“visible” oscillations in the solution.

Page 77: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 69

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

1

2

3

4

5

6

7

8

9

10

ξ

N :=

Per

iod/

TTD

Finally, note that ωn enters yH very simply,

yH(t) = e−ξωnt[

A cosωn√

1− ξ2t + B sinωn√

1− ξ2t]

Note, everywhere ωn or t appear, they appear together in a term ωnt. 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) + a1y(t) + a2y(t) = bv(t)

Note that yP (t) =ba2v satisfies the differential equation. Hence, the actual solution (which

must also satisfy the initial conditions) is of the form

b

a2v + e−ξωnt

[

A cosωn√

1− ξ2t + B sinωn√

1− ξ2t]

where A and B are chosen suitably to satisfy the initial conditions. So, the homogeneoussolutions connect the initial conditions to the final conditions. In this case,

limt→∞

y(t) =b

a2v, lim

t→∞y(t) = 0

Shown in Fig. 30 below are plots for b = ω2n (so that a2 = b), v = 1, with ξ taking on values

between 0.1 and 10.

Page 78: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 70

0 1 2 3 4 5 6 7 8 9 100

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

Normalized time, w_n t

Res

pons

e, y

Step response of 2nd order system

Increasing x

Figure 30: Step response of a second order system for varying values of damping ratio ξ.

Page 79: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 71

10 Problems

1. Consider the differential equation

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

Let yH,1(t) := 2e−t − e−2t, and yH,2(t) := e−t − e−2t.

(a) Compute yH,1(0) and yH,1(0). Plot yH,1(t) versus t. Show that the function yH,1satisfies the differential equation in (4.14).

(b) Compute yH,2(0) and yH,2(0). Plot yH,2(t) versus t. Show that the function yH,2satisfies the differential 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 initialconditions y(0) = y0, y(0) = v0. Consider all possible combinations of initial conditionsfrom the lists below:

y0 = −2,−1, 0, 1, 2and

v0 = −2,−1, 0, 1, 2(Now, do part (a) first!)

(a) Note that without explicitly solving the differential 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 thesenumbers, 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 (orsimilar) to plot these expressions. Compare to your simplistic approximations inpart 2a.

3. The response (with all appropriate initial conditions set to 0) of the systems listedbelow 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

Page 80: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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

Page 81: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 73

0 20 40 60 80 1000

1

2

0 2 4 60

0.5

1

0 2 4 60

0.5

1

0 10 20 300

1

2

0 0.5 1 1.50

0.5

1

0 0.5 1 1.5 2 2.5−10

−5

0

5

0 20 40 600

1

2

0 10 20 30 400

0.5

1

1.5

0 1 2 30

0.5

1

1.5

0 0.2 0.4 0.6 0.8 1−1.5

−1

−0.5

0

0 2 4 60

0.5

1

0 1 2 3 40

0.5

1

1.5

4. Consider the homogeneous differential equation

y[3](t) + 9y(t) + 24y(t) + 20y(t) = 0

(a) What is the characteristic polynomial of the ODE?

(b) What are the roots of the characteristic polynomial.

Page 82: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 74

(c) Write the general form of a homogeneous solution. Explain what are the freeparameters.

(d) Show, by direct substitution, that yH(t) = te−2t is a solution.

(e) Show, by direct substitution, that yH(t) = t2e−2t 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. Forcomparison, recall that for the function eat, the function is equal to 0.05 of themaximum value at about 3

−a .

6. (a) Suppose λ ∈ C and k ≥ 0 is an integer. Show that x(t) := 1k+1

tk+1e−λt is asolution to the differential equation

x(t) + λx(t) = tke−λt

(b) Suppose y and z satisfy the differential equations

z(t) + λz(t) = y(t), y(t) + λy(t) = 0

Eliminate y, and find a 2nd-order differential equation governing z

(c) Suppose q satisfies the differential equation

q(t) + 2λq(t) + λ2q(t) = 0

Define r(t) := q(t) + λq(t). What differential equation does r satisfy? Hint:What is r(t) + λr(t)

7. In section 9, we considered differential equations of the form

y(t) + a1y(t) + a2y(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 solutionsare of the form

b

a2v + e−ξωnt

[

A cosωn√

1− ξ2t + B sinωn√

1− ξ2t]

where A and B are free parameters.

Suppose the initial conditions are y(0) = y0 and y(0) = y0. Find the correct values forA and B so that the initial conditions are satisfied. Your answer should be in terms ofthe given initial conditions, and system parameters (ωn, ξ, b).

Page 83: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 75

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

(a) What are the roots of the equation

s2 + 2ξωns+ ω2n = 0

(b) Let λ be the complex number

λ := −ξωn + jωn√

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.

-

6λ×

AAAA

Re

Im C

ψ

Express sinψ in terms of ξ and ωn.

9. The cascade of two systems is shown below. The relationship between the inputs andoutputs are given. Differentiate and eliminate the intermediate variable v, obtaining adifferential equation relationship between u and y.

S1 S2- - -u v y

S1 : v(t) + a1v(t) + a2v(t) = b1u(t) + b2u(t)

S2 : y(t) + c1y(t) = d1v(t)

Repeat the calculation for the cascade in the reverse order, as shown below.

S2 S1- - -u v y

S1 : y(t) + a1y(t) + a2y(t) = b1v(t) + b2v(t)

S2 : v(t) + c1v(t) = d1u(t)

10. Compute (by analytic hand calculation) and plot the solutions to the differential equa-tions below. Before you explicitly solve each differential 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) ofcomplex roots.

• the final value of y, ie., limt→∞ y(t).

Page 84: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 76

for each case. For the plots, put both cases in part (a) on one plot, and put both casesfor part (b) on another plot.

(a) i. d3

dt3y(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 youcan 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 forall t > 0.

(b) i. d3

dt3y(t) + 10.6y(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 tothe 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 differential 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 differential equation in (10)(a)(i) into thecascade 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 thetwo plots in (10)(a) consistent with your decomposition?

(b) Do a similar decomposition for (10)(b)(i), and again think/comment about theresponse of the 3rd order system in (10)(b)(i) and the 2nd order system’s responsein (10)(b)(ii).

12. (a) Suppose α is a fixed real number. If p(s) is a n’th order polynomial, with rootsλ1, λ2, . . . , λn, what are the roots of the n’th 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?

Page 85: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 77

Summary for SLODEs

1 Main Results

• SLODEs have the form

y(n)(t) + a1y(n−1)(t) + · · ·+ any(t) = bv(t) (4.15)

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

λn + a1λn−1 + · · ·+ an = 0

This polynomial is called the characteristic polynomial associated with the differentialequation.

• If the rini=1 are all distinct from one another, then the homogenous solution yH is

yH(t) =n∑

i=1

cierit (4.16)

• If the rini=1 are not distinct from one another, then the homogenous solution yH is

yH(t) =

f∑

i=1

li−1∑

j=0

cijepittj (4.17)

where we have grouped the roots r1, r2, · · · , rn as

p1, p1, . . . , p1︸ ︷︷ ︸

l1

, p2, p2, . . . , p2︸ ︷︷ ︸

l2

, · · · , pf , pf , . . . , pf︸ ︷︷ ︸

lf

(4.18)

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 aparticular solution is

yP (t) =b

anu

• For stable systems limt→∞ yH(t) = 0, and therefore since y(t) = yP (t) + yH(t)

limt→∞

y(t) =b

anu

Hence, the steady-state gain of the system isbnan

.

Page 86: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 78

2 General Solution Technique

1. Find any particular solution yP

2. Choose constants cij so that the function

yP (t) +

f∑

i=1

li−1∑

j=0

cijtjepit

satisfies the initial conditions.

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

3 Behavior of Homogeneous Solutions as t→ ∞• If all of the roots, rini=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, rini=1, of the characteristic polynomial satisfy

Real(ri) ≥ 0

then there are homogeneous solutions that do not decay to 0 as t → ∞ (THESYSTEM IS UNSTABLE)

• For stable systems, the time constant T is

T =1

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 samesign (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 b1b2 > 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, b1b2 > b3 and(b1b2 − b3)b3 > b21b4.

Page 87: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 79

5 2nd order differential equation

• General form isy(t) + a1y(t) + a2y(t) = bv(t) (4.19)

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

y(t) + 2ξωny(t) + ω2ny(t) = bv(t)

where both ξ, ωn > 0.

• We have2ξωn = a1, ω2

n = a2

which can be inverted to give

ξ =a1

2√a2, ωn =

√a2

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

• The characteristic polynomial

λ2 + 2ξωnλ+ ω2n = 0

• The roots are atλ = −ξωn ± ωn

ξ2 − 1

= −ξωn ± jωn√

1− ξ2

6 Solutions of 2nd order differential equation

• ξ > 1: Roots are distinct, and both roots are real, and negative.

yH(t) = c1e

(

−ξωn+ωn

√ξ2−1

)

t+ c2e

(

−ξωn−ωn

√ξ2−1

)

t

Settling time (Time to decay)= 3

|−ξωn+ωn

√ξ2−1|

• ξ = 1: Roots are repeated real at λ = −ξωn,

yH(t) = c1e−ξωnt + c2te

−ξωnt

Settling time (Time to decay)= 3ξωn

Page 88: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 80

• 0 < ξ < 1: Roots are distinct, and complex (complex-conjugate pair), with negativereal part

yH(t) = e−ξωnt[

A cosωn√

1− ξ2t + B sinωn√

1− ξ2t]

or equivalently

yH(t) = e−ξωnt[√

(A2 +B2) sin(ωn√

1− ξ2t+ φ)]

where φ = atan(A/B)

– Settling time (Time to decay)= 3ξωn

– The period of oscillation = 2π

ωn

√1−ξ2

.

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

N :=Time to decay

Period of oscillation=

3√

1− ξ2

2πξ

– Everywhere ωn appears together in a term ωnt. Hence, ωn simply “scales” theresponse yH(t) in t. The larger value of ωn, the faster the response.

Page 89: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 81

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

sponse

1 Introduction

Consider the bicycle diagram shown in Figure 31, where the input to the system is thestearing 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 contactpoints of the wheels with the ground, a is the distance from a vertical line through the centerof 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.

Page 90: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 82

equation of the bicycle by summing the tourques acting on the system (due to gravity, andcentrifugal forces). The momentum balance becomes

y − g

hy =

aV

bhu+

V 2

bhu (5.1)

where V is the velocity of the bicycle. We can notice in (5.1) that the first-order derivative uof the input u(t) appears in the right-hand side of the differential equation. Suppose that weare given initial conditions y0 and y0, and are asked to compute the response to a unit-stepinput, applied just after the system is released from the initial conditions. Note that theinput is not differentiable at t = 0, and hence the right-hand side of the differential equationis not well defined. How do we get a solution in that case? In order to study this, we firstconsider particular solutions to a special class of nonconstant forcing functions.

2 Other Particular Solutions

We have already seen that the differential equation

y[n](t) + a1y[n−1](t) + · · ·+ an−1y(t) + any(t) = 1

has a particular solution yP (t) = 1an

for all t. Recall that all particular solutions can begenerated by adding all homogeneous solutions to any one particular solution.

What about a particular solution to the equation

y[n](t) + a1y[n−1](t) + · · ·+ an−1y(t) + any(t) = γ0 + γ1t

where γ0 and γ1 are some fixed constants. If we differentiate both sides, we see that aparticular solution is y taking a constant value, and hence we “guess” that there is a particularsolution of the form

yP (t) = αt+ β

for some proper choice of constants α and β. Indeed, note that yP = α, and all higher orderderivatives are identically zero. Plugging in, and equating gives

an−1α + an (αt+ β) = γ0 + γ1t

which must hold for all t. This gives

an−1α + anβ = γ0, anα = γ1

which can be easily solved, yielding

α =γ1an, β =

γ0 − an−1α

an

This approach is easy to generalize for forcing functions of the form∑n

k=0 γktk.

Page 91: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 83

3 Limits approaching steps

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

y(t) + a1y(t) + a2y(t) = b1u(t) + b2u(t) (5.2)

subject to initial conditions y(0) = Y0, y(0) = Y0, and the input u(t) = µ(t).

We begin with a simpler problem, which avoids the differentiability problems of the unitstep function. For each ǫ > 0, define a function µǫ as

µǫ(t) :=

0 for t < 01ǫt for 0 ≤ t < ǫ

1 for ǫ ≤ t

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

µǫ(t) =

0 for t < 01ǫ

for 0 < t < ǫ0 for ǫ < t

We want to determine the solution of the differential equation (5.2) subject to initial con-ditions y(0) = Y0, y(0) = Y0, and the input u(t) = µǫ(t). Let the solution be denoted byyǫ(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 solutionto match up the initial conditions at 0.

• Over the second interval, we follow the same procedure (since the qualitative behaviorof the right-hand-side of the differential equation is different in this time interval, weneed to start with a new particular solution), last values (ie., the values at t = ǫ) ofthe solution obtained in the first interval as initial conditions.

In order to achieve our original objective (response due to unit-step), after completing thesolution in the first interval, we take the limit as ǫ → 0 in order to compute the “initialconditions” for the second interval.

Reiterating – we want to determine properties of the solution at t = ǫ, in particular we wantto determine yǫ(ǫ), and yǫ(ǫ), and then take the limit as ǫ → 0 (ie., as the input functionbecomes 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 conditionsfor the solution after the input’s step change has taken place.

Page 92: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 84

During the interval (0, ǫ), the right-hand side of (5.2) is well defined, and is

b1u(t) + b2u(t) =b2ǫt+

b1ǫ

A particular solution (using the method we derived in Section 2) is yP (t) = αt+ β, where

α =b2a2ǫ

, β =b1a2 − a1b2

a22ǫ

Let λ1, λ2 be the roots of the characteristic polynomial,

λ2 + a1λ+ a2 = 0

For now, let’s assume that they are distinct (you could rework what we do here for the casewhen they are not distinct - it all works out the same). For a later calculation, please checkthat a1 = −λ1−λ2, and a2 = λ1λ2. Hence, the solution to the differential equation for t > 0must be

yǫ(t) = αt+ β + c1eλ1t + c2e

λ2t (5.3)

where c1 and c2 are uniquely chosen to satisfy the initial conditions yǫ(0) = Y0, yǫ(0) = Y0.Differentiating gives that

yǫ(t) = α + c1λ1eλ1t + c2λ2e

λ2t (5.4)

Satisfying the initial conditions at t = 0 gives conditions that the constants c1 and c2 mustsatisfy [

1 1λ1 λ2

] [c1c2

]

=

[Y0 − βY0 − α

]

which can be solved as[c1c2

]

=1

λ2 − λ1

[λ2 −1−λ1 1

] [Y0 − βY0 − α

]

In terms of c1 and c2, the value of yǫ and yǫ at t = ǫ are (using equations (5.3 and 5.4))

[yǫ(ǫ)yǫ(ǫ)

]

=

[eλ1ǫ eλ2ǫ

λ1eλ1ǫ λ2e

λ2ǫ

] [c1c2

]

+

[αǫ+ βα

]

Substituting, gives

[yǫ(ǫ)yǫ(ǫ)

]

=1

λ2 − λ1

[eλ1ǫ eλ2ǫ

λ1eλ1ǫ λ2e

λ2ǫ

] [λ2 −1−λ1 1

] [Y0 − βY0 − α

]

+

[αǫ+ βα

]

Rearranging gives

[yǫ(ǫ)yǫ(ǫ)

]

=1

λ2 − λ1

[λ2e

λ1ǫ − λ1eλ2ǫ eλ2ǫ − eλ1ǫ

λ2λ1(eλ1ǫ − eλ2ǫ

)λ2e

λ2ǫ − λ1eλ1ǫ

] [Y0 − βY0 − α

]

+

[αǫ+ βα

]

Page 93: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 85

For notational purposes, let

Mǫ :=1

λ2 − λ1

[λ2e

λ1ǫ − λ1eλ2ǫ eλ2ǫ − eλ1ǫ

λ2λ1(eλ1ǫ − eλ2ǫ

)λ2e

λ2ǫ − λ1eλ1ǫ

]

Then, we have [yǫ(ǫ)yǫ(ǫ)

]

=Mǫ

[Y0 − βY0 − α

]

+

[αǫ+ βα

]

This is further manipulated into[yǫ(ǫ)yǫ(ǫ)

]

=Mǫ

[Y0Y0

]

+

(

−Mǫ +

[1 ǫ0 1

])[βα

]

But recall, α and β depend on ǫ, so that should be substituted,

[yǫ(ǫ)yǫ(ǫ)

]

=Mǫ

[Y0Y0

]

+1

ǫ

(

−Mǫ +

[1 ǫ0 1

])[ b1a2−a1b2a22

b2a2

]

Note thatlimǫ→0

Mǫ = I2

and using L’Hospital’s rule,

limǫ→0

1

ǫ

(

−Mǫ +

[1 ǫ0 1

])

=

[0 0

λ2λ1 −λ2 − λ1

]

=

[0 0a2 a1

]

Hence, [y(0+)y(0+)

]

:= limǫ→0,ǫ>0

[yǫ(ǫ)yǫ(ǫ)

]

=

[Y0

Y0 + b1

]

In summary, suppose the input waveform is such that the right-hand side (ie., forcing func-tion) of the differential equation has singularities at certain discrete instants in time. Betweenthose instants, all terms of the differential equation are well behaved, and we solve it in theclassical 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 determinedfrom the differential equation. Essentially, we get “new” initial conditions for the differen-tial equation just after the singularity in terms of the solution of the ODE just before thesingularity and the ODE itself.

We have seen that the values of y and y at a time just before the input singularity are relatedto 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 forgeneral systems (not just second order). Distributions are mathematical constructions that,

Page 94: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 86

in a rigorous manner, allow us to repeat the rigorous calculation we just did in this sectionin a less tedious fashion.

Another point to notice: this calculation shows that the term b1u(t), which appears on theright-hand side of the ODE in equation (5.2) plays a role in the solution. So, both theleft and right sides of an input/output ODE have qualitative and quantitative effects of thesolution. We will formalize this as we proceed...

4 Problems

1. Consider the differential equation

y(t) + 4y(t) + 3y(t) = b1u(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 youcan (in terms of b1) so that you only need to the majority of the work once, andthen 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 finaltime. Plot them on the same graph.

Page 95: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 87

6 Distributions

In this section we learn some tricks that allow us to redo the calculation in the previoussection 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 didin section 5 in a less tedious fashion.

1 Introduction

Recall our goal: determine the response of

y[n](t) + a1y[n−1](t) + a2y

[n−2](t) + · · ·+ any(t) =b0u

[n](t) + b1u[n−1](t) + b2u

[n−2](t) + · · ·+ bnu(t)(6.1)

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

[1](0−) =

y[1]0 , y

[2](0−) = y[2]0 , . . . , y

[n−1](0−) = y[n−1]0 . Here 0− refers to the time just before the unit-

step input is applied. So, the system is placed in initial conditions, and released, the releasetime being denoted 0−. At that instant, the input’s value is 0, so u(0−) = 0. An infinitesimaltime later, at 0+, the input value is changed to +1. The input is actually at unit-step att = 0, and the initial conditions are known just before the step-input is applied.

The difficulty is that the right-hand side of (6.1) is not classically defined, since u is notdifferentiable. 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 differentiable family of functions µǫ that have the property

µǫ(t) =

0 for t < 01 for t > ǫ

and which converge to the unit step µ as ǫ→ 0.

2. Compute solution yǫ(t) to the differential equation

y[n](t) + a1y[n−1](t) + a2y

[n−2](t) + · · ·+ any(t) =b0u

[n](t) + b1u[n−1](t) + b2u

[n−2](t) + · · ·+ bnu(t)

subject to the forcing function u(t) = µǫ(t) and initial conditions y(0) = y[0]0 , y

[1](0) =

y[1]0 , y

[2](0) = y[2]0 , . . . , y

[n−1](0) = y[n−1]0 .

3. Look at the values of yǫ(ǫ), yǫ(ǫ), yǫ(ǫ) . . . , y[n−1]ǫ (ǫ). Take the limit as ǫ → 0, and get

a relationship between the values of y, y, y, . . . , y[n−1] at t = 0− and t = 0+.

Page 96: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 88

4. For t > 0, the right hand side of the ODE in (6.1) is well defined (in fact, it’s a constant,bn), and the solution can be determined from finding any particular solution, andcombining with the family of homogeneous solutions to correctly match the conditionsat 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

2. The final answer for the limits y[k]ǫ (ǫ) 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, calleddistributions.

The most common distribution that is not a normal function is the Dirac-δ function. Togain intuition about this, consider an ǫ-approximation to the unit-step function of the form

µǫ(t) =

0 for t < 01ǫt for 0 < t < ǫ

1 for t ≥ 1

The derivative of this is

d

dtµǫ(t) =

0 for t < 01ǫ

for 0 < t < ǫ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ǫ→0

∫ ∞

−∞f(t)δǫ(t)dt = f(0)

and for any t 6= 0, limǫ→0 δǫ(t) = 0. Hence, in the limit we can imagine a “function” δ whosevalue at nonzero t is 0, whose value at t = 0 is undefined, but whose integral is finite, namely1.

Now, we can start another level smoother. Let δǫ be defined as

δǫ(t) :=

0 for t < 0tǫ2

for 0 < t < ǫ2ǫ−tǫ2

for ǫ < t < 2ǫ0 for 2ǫ < t

Page 97: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 89

Note that independent of ǫ we have∫ ∞

−∞δǫ(t)dt = 1

and for any t 6= 0, limǫ→0 δǫ(t) = 0. The derivative is well defined, and satisfies

dδǫdt

=

0 for t < 01ǫ2

for 0 < t < ǫ− 1ǫ2

for ǫ < t < 2ǫ0 for t > 2ǫ

Note that for any continuous function f , we have

limǫ→0

∫ ∞

−∞f(t)δǫ(t)dt = f(0)

and for any differentiable function f , we have

limǫ→0

∫ ∞

−∞f(t)

dδǫdtdt = −f(0)

and

limǫ→0

∫ ∞

−∞

∣∣∣∣

dδǫdt

∣∣∣∣dt = ∞

In the limit, we get an even more singular function, δ (or δ[1]), which has the property thatit is zero for all nonzero t, not well defined for t = 0, and even the integral of the absolutevalue is not well defined.

If we start with a smoother (quadratics) version of δǫ, then we can differentiate twice, gettingδǫ and δǫ, and look at their limiting behavior. Starting still smoother, we can continue theprocess, generating a collection of singular functions, δ[k], defined formally as

δ[0](t) := δ(t) :=dµ

dt, δ[k](t) =

dδ[k−1]

dt

As we have seen in the first few, each δ[k] is “more singular” than the preceeding one, δ[k−1].Hence, there is no manner in which several lower order derivatives of δ-functions can belinearly combined to represent a δ-function of higher order. In other words, the derivativesof δ functions are a linearly independent set.

2 Procedure to get step response

Consider our general system differential 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

Page 98: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 90

has δ[n−1]. Hence, this is the highest order singularity which must occur on the left-handside. If this order singularity occurs in any of the terms y, y, . . . , y[n−1], then additionaldifferentiation 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 δ[n−1] is y[n]. This suggests that y[n] is of theform

y[n] = e1δ[n−1] + e2δ

[n−2] + · · ·+ 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 n’th derivative of y, then there are constraints on thelower order derivatives of y as well. Integrating, we get

y[n] = e1δ[n−1] + e2δ

[n−2] + · · · + enδ + en+1µ + fny[n−1] = e1δ

[n−2] + · · · + en−1δ + enµ + fn−1...

y[1] = e1δ + e2µ + f2y[0] = + e1µ + f1

where each of the fi are continuous functions. Plugging into the ODE, and equating thedifferent singularities gives n equations in n unknowns, expressed in matrix form below

1 0 0 · · · 0a1 1 0 · · · 0a2 a1 1 · · · 0...

......

. . ....

an−1 an−2 · · · a1 1

e1e2e3...en

=

b0b1b2...

bn−1

(6.2)

The matrix is always invertible, and the system of equations can be solved, yielding the evector. It is easy to see that it can be solved recursively, from e1 through en (and even en+1)as

e1 = b0e2 = b1 − a1e1e3 = b2 − a1e2 − a2e1...

...ek = bk−1 − a1ek−1 − a2ek−2 − · · · − ak−1e1

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

y(0+) = y(0−) + e1y(0+) = y(0−) + e2

y[2](0+) = y[2](0−) + e3...

......

y[k](0+) = y[k](0−) + ek+1...

......

y[n−1](0+) = y[n−1](0−) + en

Page 99: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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) ≡ bn

an) to match the initial

conditions at t = 0+, completing our solution. You can/should write a general MatLabfunction M-file to compute all of these quantities for given row vectors

A = [ 1 a1 a2 · · · an−1 an ] , B = [ b0 b1 b2 · · · bn−1 bn ]

Page 100: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 92

3 Problems

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

y(t) + a1y(t) = u(t) + b1u(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. Considery[3](t) + 3.8y(t) + 6.8y(t) + 4y(t) = b2u(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 the7 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: Oneof the roots of the characteristic equation is −1. Also, if you proceed symbolically, youend up with the coefficients of the homogeneous components being of the form

c =M−1v(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 (don’t bothercomputing the inverse). Then, for each of the 6 cases, plug in a particular value forb2, and let MatLab compute the coefficients automatically. Set up your plotting scriptfile to accept a 3×1 vector of homogeneous coefficients. In your solutions, include anyuseful M-files that you write.

3. Consider the three differential equations

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

Suppose that each is subject to the forcing function u(t) := µ(t), and initial conditionsy(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) at0+, and sketch solutions. Then, derive the exact expression for the solutions, and plotusing MatLab.

Page 101: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 93

Summary: Solution of SLODEs with Derivatives on the

inputs

Introduction

• Goal: determine the response of

y[n](t) + a1y[n−1](t) + a2y

[n−2](t) + · · ·+ any(t) =b0u

[n](t) + b1u[n−1](t) + b2u

[n−2](t) + · · ·+ bnu(t)(6.4)

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

[1](0−) =

y[1]0 , y

[2](0−) = y[2]0 , . . . , y

[n−1](0−) = y[n−1]0 .

• 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 difficulty is that the right-hand side is not classically defined, since u is not differ-entiable.

• The solution can be obtained by considering a sequence of problems, with smoothapproximations to the unit step, and obtain the solution as a limiting process.

Main Concept for obtaining the solution

• For ǫ > 0, define a function µǫ as

µǫ(t) :=

0 for t < 01ǫt for 0 ≤ t < ǫ

1 for ǫ ≤ t

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

µǫ(t) =

0 for t < 01ǫ

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 aparticular solution, and then adding in the appropriate homogeneous solution to matchup the initial conditions at 0−.

Page 102: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 affect the “initial conditions” for thesecond interval.

• As ǫ→ 0 we are only interested in computing the new initial conditions, i.e., the valuesof 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ǫ→0

∫ ∞

−∞f(t)δǫ(t)dt = f(0)

and for any t 6= 0, limǫ→0 δǫ(t) = 0.

• The functionδ(t) = limǫ→0δǫ

is the Dirac-δ function.

• The “function” δ is equal to 0 at all times with the exception of t = 0. At t = 0 it isundefined, but the integral is finite, namely 1.

• We proceed similarly and define the first derivative of the function δ(t), the secondderivative and so on..

δ[0](t) := δ(t) :=dµ

dt, δ[k](t) =

dδ[k−1]

dt

Page 103: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 95

The procedure

• Consider our general system differential equation

y[n](t) + a1y[n−1](t) + a2y

[n−2](t) + · · ·+ any(t) =b0u

[n](t) + b1u[n−1](t) + b2u

[n−2](t) + · · ·+ bnu(t)(6.5)

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

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

y[n] = e1δ[n−1] + e2δ

[n−2] + · · ·+ enδ + en+1µ+ fn(t)

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

• Integrating, we get

y[n] = e1δ[n−1] + e2δ

[n−2] + · · · + enδ + en+1µ + fn(t)y[n−1] = e1δ

[n−2] + · · · + en−1δ + enµ + fn−1(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[n−1](0−) = f[n−1](0

+) = y[n−1](0−)

Therefore the ei give the discontinuity in each derivative of y at t = 0+:

y(0+) = y(0−) + e1y(0+) = y(0−) + e2

y[2](0+) = y[2](0−) + e3...

......

y[k](0+) = y[k](0−) + ek+1...

......

y[n−1](0+) = y[n−1](0−) + en

Page 104: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 96

• Plugging into the ODE, and equating the different δ, δ[1], . . .,δ[n−1] functions gives nequations in n unknowns, expressed in matrix form below

1 0 0 · · · 0a1 1 0 · · · 0a2 a1 1 · · · 0...

......

. . ....

an−1 an−2 · · · a1 1

e1e2e3...en

=

b0b1b2...

bn−1

(6.6)

The matrix is always invertible, and the system of equations can be solved, yieldingthe e vector.

• It is easy to see that it can be solved recursively, from e1 through en as

e1 = b0e2 = b1 − a1e1e3 = b2 − a1e2 − a2e1...

...ek = bk−1 − a1ek−1 − a2ek−2 − · · · − ak−1e1

• Compute the new initial conditions at t = 0+:

y(0+) = y(0−) + e1y(0+) = y(0−) + e2

y[2](0+) = y[2](0−) + e3...

......

y[k](0+) = y[k](0−) + ek+1...

......

y[n−1](0+) = y[n−1](0−) + en

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

y[n](t) + a1y[n−1](t) + a2y

[n−2](t) + · · ·+ any(t) = bnu(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

A =

1 0 0 · · · 0a1 1 0 · · · 0a2 a1 1 · · · 0...

......

. . ....

an−1 an−2 · · · a1 1

, B = [ b0 b1 b2 · · · bn−1 bn ]′

Page 105: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 97

7 Frequency Responses of Linear Systems

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

y[n](t) + a1y[n−1](t) + · · ·+ an−1y

[1](t) + any(t)= b0u

[n](t) + b1u[n−1](t) + · · ·+ bn−1u

[1](t) + bnu(t)(7.1)

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 theopen left-half of the complex plane. This guarantees that all homogeneous solutions decayexponentially to zero as t→ ∞.

Suppose that the forcing function u(t) is chosen as a complex exponential, namely ω is a fixedreal number, and u(t) = ejωt. Note that the derivatives are particularly easy to compute,namely

u[k](t) = (jω)kejωt

It is easy to show that for some complex number H , one particular solution is of the form

yP (t) = Hejωt

How? Simply plug it in to the ODE, leaving

H [(jω)n + a1(jω)n−1 + · · ·+ an−1(jω) + an] e

jωt

= [b0(jω)n + b1(jω)

n−1 + · · ·+ bn−1(jω) + bn] ejωt

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

H [(jω)n + a1(jω)n−1 + · · ·+ an−1(jω) + an]

= [b0(jω)n + b1(jω)

n−1 + · · ·+ bn−1(jω) + bn]

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

λn + a1λn−1 + · · ·+ an−1λ+ 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

H =b0(jω)

n + b1(jω)n−1 + · · ·+ bn−1(jω) + bn

(jω)n + a1(jω)n−1 + · · ·+ an−1(jω) + an(7.2)

Moreover, since actual solution differs from this particular solution by some homogeneoussolution, we must have

y(t) = yP (t) + yH(t)

Page 106: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 98

In the limit, the homogeneous solution decays, regardless of the initial conditions, and wehave

limt→∞

y(t)− yP (t) = 0

Since yP is periodic, and y tends towards it asymptotically (the homogeneous solutions aredecaying), we call this specific particular solution the steady-state behavior of y, and denoteit 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 thedependence of H on the forcing frequency.

H(ω) :=b0(jω)

n + b1(jω)n−1 + · · ·+ bn−1(jω) + bn

(jω)n + a1(jω)n−1 + · · ·+ an−1(jω) + an(7.3)

This function is called the “frequency response” of the linear system in (7.1). Sometimesit is referred to as the “frequency response from u to y,” written as Hu→y(ω). For stablesystems, we have proven for fixed value u and fixed ω

u(t) := uejωt ⇒ yss(t) = H(ω)uejωt

Note that H(ω) = G(s)|s=jω where G(s) is the transfer function of the SLODE (7.1). There-fore

u(t) := uejωt ⇒ yss(t) = G(jω)uejωt

1 Complex and Real Particular Solutions

What is the meaning of a complex solution to the differential equation (7.1)? Suppose thatfunctions u and y are complex, and solve the ODE. Denote the real part of the function u asuR, 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). Differentiating this k times gives

u[k](t) = u[k]R (t) + ju

[k]I (t)

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

y[n]R (t) + jy

[n]I (t)

]

+ a1

[

y[n−1]R (t) + jy

[n−1]I (t)

]

+ · · ·+ an [yR(t) + jyI(t)] =

= b0

[

u[n]R (t) + ju

[n]I (t)

]

+ b1

[

u[n−1]R (t) + ju

[n−1]I (t)

]

+ · · ·+ bn [uR(t) + juI(t)]

But the real and imaginary parts must be equal individually, so exploiting the fact that thecoeffcients ai and bj are real numbers, we get

y[n]R (t) + a1y

[n−1]R (t) + · · ·+ an−1y

[1]R (t) + anyR(t)

= b0u[n]R (t) + b1u

[n−1]R (t) + · · ·+ bn−1u

[1]R (t) + bnuR(t)

Page 107: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 99

andy[n]I (t) + a1y

[n−1]I (t) + · · ·+ an−1y

[1]I (t) + anyI(t)

= b0u[n]I (t) + b1u

[n−1]I (t) + · · ·+ bn−1u

[1]I (t) + bnuI(t)

Hence, if (u, y) are functions which satisfy the ODE, then both (uR, yR) and (uI , yI) alsosatisfy 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 towithin an additive factor of 2π) which has the properties

cos∠H =ReH

|H| , sin∠H =ImH

|H|

Then,Re(Hejθ

)= Re [(HR + jHI) (cos θ + j sin θ)]= HR cos θ −HI sin θ

= |H|[HR

|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|[HR

|H| sin θ +HI

|H| cos θ]

= |H| [cos∠H sin θ + sin∠H cos θ]= |H| sin (θ + ∠H)

Now consider the differential equation/frequency response case. Let H(ω) denote the fre-quency response function. If the input u(t) = cosωt = Re (ejωt), then the steady-stateoutput y will satisfy

y(t) = |H(ω)| cos (ωt+ ∠H(ω))

A similar calculation holds for sin, and these are summarized below.

Input Steady-State Output1 H(0) = bn

ancos(ω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)

Page 108: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 100

Input Steady-State Output1 G(0) = bn

ancos(ω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 arerow vectors, of the form of the form

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

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

a0y[n](t) + a1y

[n−1](t) + · · ·+ an−1y[1](t) + any(t)

= b0u[n](t) + b1u

[n−1](t) + · · ·+ bn−1u[1](t) + bnu(t)

with y the dependent variable (output), and u the independent variable (input). Ω is a1-by-N vector of real frequencies. The function should return one argument, H , whichwill 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 responsefunction 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 differences (eg., in what frequency ranges are theyappreciably different?; in the frequency ranges where they are different, what is themagnitude of the response function as compared to the largest value of the responsemagnitude?

3. Using the Matlab function from above, draw the Bode plot of the frequency responsefunction 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 differences (eg., in what frequency ranges are theyappreciably different?; in the frequency ranges where they are different, what is themagnitude of the response function as compared to the largest value of the responsemagnitude?

4. Suppose the ODE for a system is

y(t) + 2ξωny(t) + ω2ny(t) = ω2

nu(t)

where u is the input, and y is the output. Assume that ξ > 0 and ωn > 0.

Page 109: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 ω4n, derive

|H(ω)|2 = 1[

1−(ωωn

)2]2

+ 4ξ2(ωωn

)2

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

|H(ω)|2 =(ωn

ω

)4

[(ωn

ω

)2 − 1]2

+ 4ξ2(ωn

ω

)2

Using this, show that for ω >> ωn, |H(ω)| ≈(ωn

ω

)2. 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?

(h) For a general function F (ω) that is never 0, show thatd

dω|F (ω)| = 0 at exactly

the same values of ω as whend

dω|F (ω)|2 = 0.

(i) Find the frequencies (real numbers) ω whered

dω|H(ω)| = 0.

(j) Show that if ξ < 1√2, 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√2. Show that

|H(ωcrit)| =1

2ξ√

1− ξ2

(l) Assuming that ξ < 1√2. Define φ := ∠H(ωcrit). What is tanφ?

Page 110: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 axeslog |H(ω)| versus log ω, and ∠ |H(ω)| versus log ω. In this problem, you havederived a few key features of the plots, but not the entire shape of the plot. Yoursketches 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 casesabove. Plot them for the range ω ∈ [0.001 1000]. Verify that the actual plotshave all of the features that you derived and sketched in the previous part.

Page 111: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 103

8 Bode Plots

1 Problems

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

(a) Suppose H(s) = 1s, which is the transfer function of an integrator. For all ω > 0,

it is easy to see that

|H(jω)| = 1

ω, ∠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

C(s) =s+ z

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

F (s) =1

τ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 describedabove, with z = 0.2 and τ = 0.2.

2. We have talked about sensor noise extensively, but have not done much with regardto simulations (numerical solutions to the ODEs). In this problem, we learn how thecommand lsim can be used to compute the response of a system (described by itstransfer 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. Makethe vector a column vector (the command lsim is forgiving, and a row-vectorworks as well).

Page 112: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 104

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

• Create a column vector of signal values, UVAL, which are the corresponding valuesof the forcing function at the times specified in TVEC. In this example, we willmake a random input, using RANDN. This signal is typical of what we refer to asnoise. 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 signalmore than the “slow” system (H ,with time-constant 1.0). This is consistent with Bodemagnitude plots of G and H , which shows that G responds more to high-frequencysignals 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 feedbackarchitecture of Section A with a two simplifications: Let S = 1, and assume thedisturbance d enters directly (no H), but enters at the input to the plant G. Theplant model is

G(s) =1

s

There are two controllers to consider

C1(s) = 1, C2(s) =s+ 0.2

s

and two filters to consider

F1(s) = 1, F2(s) =1

0.2s+ 1

We will consider two closed-loop systems: System #1 with (G,C1, F1) and System #2with (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 functionfrom R → Y for both S1 and S2. Put both lines on the same axes. Use thecommand bode.

(b) Using Matlab, draw the Bode (magnitude only) plot of the transfer function fromD → Y for both S1 and S2. Put both lines on the same axes. Use the commandbodemag.

Page 113: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 105

(c) Using Matlab, draw the Bode (magnitude only) plot of the transfer function fromN → Y for both S1 and S2. Put both lines on the same axes. Use the commandbodemag.

(d) Using Matlab, draw the time-response of y due to a unit-step in r for both S1 andS2. 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 different color for the differentsystem’s outputs. You can use the command lsim. Create the random inputusing the method in problem 2, using 200− by− 1 randomly generated vector onthe time interval [0 10]. Use a for-loop, and hold on, and repeat this simulation5 times, placing all plots on the same axes.

(g) Carefully explain, in each case (r → y, d → y, n → y) how the relationshipbetween the Bode plots is consistent with the relationship of the time-responseplots. The r → y is somewhat difficult to draw distinctions as both the Bode plotsand time-responses look quite similar (this is somewhat the point), although theeffect that d and n have on y are different in the two cases.

Page 114: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 106

9 Transfer functions

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

y[n](t) + a1y[n−1](t) + · · ·+ an−1y

[1](t) + any(t)= b0u

[n](t) + b1u[n−1](t) + · · ·+ bn−1u

[1](t) + bnu(t)(9.1)

we write “in transfer function form”

Y =b0s

n + b1sn−1 + · · ·+ bn−1s+ bn

sn + a1sn−1 + · · ·+ an−1s+ anU (9.2)

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

G(s) :=b0s

n + b1sn−1 + · · ·+ bn−1s+ bn

sn + a1sn−1 + · · ·+ an−1s+ an

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

Y = Gu→y(s)U

is nothing more than a new notation for the differential 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, =. Bycontrast, 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 differentialequation to which it is associated.

Nevertheless, in this section, we will see that, in fact, we can assign proper equality, andmake algebraic substitutions and manipulations of transfer function expressions, which willaid our manipulation of linear differential equations. But all of that requires proof, and thatis the purpose of this section.

1 Linear Differential Operators (LDOs)

Note that in the expression (9.2), the symbol s plays the role of ddt, and higher powers of s

mean higher order derivatives, ie., sk means dk

dtk. If z is a function of time, let the notation

[

b0dn

dtn+ b1

dn−1

dtn−1+ · · ·+ bn−1

d

dt+ bn

]

(z) := b0dnz

dtn+ b1

dn−1z

dtn−1+ · · ·+ bn−1

dz

dt+ bnz

Page 115: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 107

We will call this type of operation a linear differential operation, or LDO. For the purposesof this section, we will denote these by capital letters, say

L :=[dn

dtn+ a1

dn−1

dtn−1 + · · ·+ an−1ddt+ an

]

R :=[

b0dn

dtn+ b1

dn−1

dtn−1 + · · ·+ bn−1ddt+ bn

]

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

L :=

[dn

dtn+ a1

dn−1

dtn−1+ · · ·+ an−1

d

dt+ an

]

then pL(s) is defined as

pL(s) := sn + a1sn−1 + · · ·+ an−1s+ an

Similarly, with each polynomial, we associate an LDO – if

q(s) := sm + b1sm−1 + · · ·+ bm−1s+ bm

then Lq is defined as

Lq :=

[dm

dtm+ b1

dm−1

dtm−1+ · · ·+ bm−1

d

dt+ bm

]

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

Y =pR(s)

pL(s)U

Similarly, if the transfer function description of a system is

V =n(s)

d(s)W

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

Page 116: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 108

2 Algebra of Linear differential operations

Note that two successive linear differential operations can be done in either order. Forexample let

L1 :=

[d2

dt2+ 5

d

dt+ 6

]

and

L2 :=

[d3

dt3− 2

d2

dt2+ 3

d

dt− 4

]

Then, on a differentiable signal z, simple calculations gives

L1 (L2(z)) =[d2

dt2+ 5 d

dt+ 6] ([

d3

dt3− 2 d2

dt2+ 3 d

dt− 4]

(z)]

=[d2

dt2+ 5 d

dt+ 6] (z[3] − 2z + 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

L2 (L1(z)) =[d3

dt3− 2 d2

dt2+ 3 d

dt− 4] ([

d2

dt2+ 5 d

dt+ 6]

(z)]

=[d3

dt3− 2 d2

dt2+ 3 d

dt− 4] (z[2] + 5z + 6z

)

= z[5] + 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 differentialoperator 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 operationon a signal z as [L1 + L2] (z) := L1(z) + L2(z).

Page 117: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 109

It is clear that the following manipulations are always true for every differentiable 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[L1L2](s) = pL1

(s)pL2(s)

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

3 Feedback Connection

The most important interconnection we know of is the basic feedback loop. It is also theeasiest interconnection for which we derive the differential equation governing the intercon-nection from the differential equation governing the components.

Consider the simple unity-feedback system shown below in Figure 32

S- d - -6

ru

y−+

Figure 32: Unity-Feedback interconnection

Assume that system S is described by the LDO L(y) = N(u). The feedback interconnectionyields u(t) = r(t)− y(t). Eliminate u by substitution, yielding an LDO relationship betweenr and y

L(y) = N(r − y) = N(r)−N(y)

This is rearranged to the closed-loop LDO

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

That’s a pretty simple derivation. Based on the ODE description of the closed-loop, we canimmediately write the closed-loop transfer function,

Y =pN(s)

p[L+N ](s)R

=pN(s)

pL(s) + pN(s)R.

Page 118: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 110

Additional manipulation leads to further interpretation. Let G(s) denote the transfer func-

tion of S, so G = pN (s)pL(s)

. Starting with the transfer function expression we just derived, wecan formally manipulate to an easily recognizable expression. Specifically

Y =pN(s)

pL(s) + pN(s)R

=

pN (s)pL(s)

1 + pN (s)pL(s)

R

=G(s)

1 +G(s)R

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 itstransfer function G. This is shown below.

S- d - -6

ru

y−+

G- d - -6

RU

Y−+

The diagram on the right is interpreted as a diagram of the equations U = R − Y , andY = 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− sideY = G

1+GR 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, we’ll usea positive-feedback convention here.

S1

S2

- - -

6dr y

qv

+

+

Assume that system S1 is described by the LDO L1(y) = N1(u), and S2 is governed byL2(v) = N2(q). Note that by definition then, the transfer function descriptions of S1 and S2

Page 119: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 111

areY =

pN1

pL1︸︷︷︸

:=G1

U, V =pN2

pL2︸︷︷︸

:=G2

Q

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 differential 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

Y =pL2N1

pL2L1−N1N2

R

which is easily rewritten as

Y =pL2

pN1

pL2pL1

− pN1pN2

R

But, again, this can be formally manipulated into a recognizable expression involving the theindividual transfer functions of S1 and S2. Divide top and bottom of the transfer functionby pL1

pL2, to give

Y =

pL2pN1

pL2pL1

1− pN1pN2

pL2pL1

R

=G1

1−G2G1R

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 Siwith their transfer functions Gi. This is shown below.

S1

S2

- - -

6dr y

qv

+

+G1

G2

- - -

6dR Y

QV

+

+

Page 120: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 112

The diagram on the right is interpreted as a diagram of the equations U = R − G2Y , andY = G1U . Note that manipulating these as though they are arithmetic expressions gives

Y = G1(R−G2Y ) after substituting for U(1−G1G2)Y = G1R moving G1G2Y over to left− hand− sideY = G1

1−G2G1R 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,

S1 S2- - -u y v

with S1 governed by

y[n](t) + a1y[n−1](t) + · · ·+ any(t) = b0u

[n](t) + b1u[n−1](t) + · · ·+ bnu(t)

and S2 governed by

v[m](t) + c1v[m−1](t) + · · ·+ cmv(t) = d0y

[m](t) + d1y[m−1](t) + · · ·+ dmy(t)

Let G1(s) denote the transfer function of S1, and G2(s) denote the transfer function of S2.Define the differential operations

L1 :=

[dn

dtn+ a1

dn−1

dtn−1+ · · ·+ an−1

d

dt+ an

]

R1 :=

[

b0dn

dtn+ b1

dn−1

dtn−1+ · · ·+ bn−1

d

dt+ bn

]

and

L2 :=

[dm

dtm+ c1

dm−1

dtm−1+ · · ·+ cm−1

d

dt+ cm

]

R2 :=

[

d0dm

dtm+ d1

dm−1

dtm−1+ · · ·+ dm−1

d

dt+ dm

]

Hence, the governing equation for system S1 is L1(y) = R1(u), while the governing equationfor system S2 is L2(v) = R2(y). Moreover, in terms of transfer functions, we have

G1(s) =pR1

(s)

pL1(s)

, G2(s) =pR2

(s)

pL2(s)

Page 121: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 113

Now, apply the differential operation R2 to the first system, leaving

R2 (L1(y)) = R2 (R1(u))

Apply the differential operation L1 to system 2, leaving

L1 (L2(v)) = L1 (R2(y))

But, in the last section, we saw that two linear differential operations can be applied in anyorder, hence L1 (R2(y)) = R2 (L1(y)). This means that the governing differential equationfor the cascaded system is

L1 (L2(v)) = R2 (R1(u))

which can be rearranged intoL2 (L1(v)) = R2 (R1(u))

or, in different notation[L2 L1] (v) = [R2 R1] (u)

In transfer function form, this means

V =p[R2R1](s)

p[L2L1](s)U

=pR2

(s)pR1(s)

pL2(s)pL1

(s)U

= G2(s)G1(s)U

Again, this has a nice interpretation. Redraw the interconnection, replacing the signals withthe capital letter equivalents, and the systems by their transfer functions.

S1 S2- - -u y v

G1 G2- - -U Y V

The diagram on the right depicts the equations Y = G1U , and V = G2Y . Treating these asarithmetic equalities allows substitution for Y , which yields V = G2G1U , as desired.

Example: Suppose S1 is governed by

y(t) + 3y(t) + y(t) = 3u(t)− u(t)

and S2 is governed byv(t)− 6v(t) + 2v(t) = y(t) + 4y(t)

Page 122: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 114

Then for S1 we have

L1 =

[d2

dt2+ 3

d

dt+ 1

]

, R1 =

[

3d

dt− 1

]

, G1(s) =3s− 1

s2 + 3s+ 1

while for S2 we have

L2 =

[d2

dt2− 6

d

dt+ 2

]

, R2 =

[d

dt+ 4

]

, G2(s) =s+ 4

s2 − 6s+ 2

The product of the transfer functions is easily calculated as

G(s) := G2(s)G1(s) =3s2 + 11s− 4

s4 − 3s3 − 15s2 + 2

so that the differential 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,

S2

S1-

-

?

6d -u

y1

y2

y++

System S1 is governed by

y[n]1 (t) + a1y

[n−1]1 (t) + · · ·+ any1(t) = b0u

[n](t) + b1u[n−1](t) + · · ·+ bnu(t)

and denoted as L1(y1) = R1(u). Likewise, system S2 is governed by

y[m]2 (t) + c1y

[m−1]2 (t) + · · ·+ cmy2(t) = d0u

[m](t) + d1u[m−1](t) + · · ·+ dmu(t)

and denoted L2(y2) = R2(u).

Apply the differential operation L2 to the governing equation for S1, yielding

L2 (L1(y1)) = L2 (R1(u)) (9.3)

Page 123: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 115

Similarly, apply the differential operation L1 to the governing equation for S2, yielding and

L1 (L2(y2)) = L1 (R2(u))

But the linear differential 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

Y =p[L2R1+L1R2](s)

p[L2L1](s)U

=p[L2R1](s) + p[L1R2](s)

pL2(s)pL1

(s)U

=pL2

(s)pR1(s) + pL1

(s)pR2(s)

pL2(s)pL1

(s)U

=

[pR1

(s)

pL1(s)

+pR2

(s)

pL2(s)

]

U

= [G1(s) +G2(s)]U

So, the transfer function of the parallel connection is the sum of the individual transferfunctions.

This is extremely important! The transfer function of an interconnection of systemsis simply the algebraic gain of the closed-loop systems, treating individual subsystems ascomplex 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 alinear differential equation relating their inputs and outputs.

• Redraw the block diagram of the interconnection. Change signals (lower-case) to uppercase, and replace each system with its transfer function.

Page 124: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 andmultiplication 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

Y =pR1

(s)

pL(s)U +

pR2(s)

pL(s)W +

pR3(s)

pL(s)V (9.6)

This may be manipulated algebraically.

9 Poles and Zeros of Transfer Functions

Consider to Linear Differential operators, L and R, and the input/output system describedby 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 := pR(s)pL(s)

.

As we already know, the roots of pL(s) = 0 give us complete information regarding the formof homogeneous solutions to the differential equation L(y) = 0. These roots, which are rootsof 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 homogeneoussolutions of the differential equation R(u) = 0. In sections 5 and 6, we saw the importanceof the right-hand-side of the differential equation on the forced response. Later we will learnhow to interpret this in terms of the number and location of the transfer function zeros.

Page 125: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 117

10 Remarks/Summary

• Transfer function represent the SLODE when the initial conditions are set to zero.

• Consider the SLODE

y[n](t) + a1y[n−1](t) + · · ·+ an−1y

[1](t) + any(t)= b0u

[n](t) + b1u[n−1](t) + · · ·+ bn−1u

[1](t) + bnu(t)(9.7)

and the associated transfer function

G(s) =b0s

n + b1sn−1 + · · ·+ bn−1s+ bn

sn + a1sn−1 + · · ·+ an−1s+ an(9.8)

We have proven that for stable system with constant input u(t) = uss, the output atsteady-state is yss =

bnanuss. Therefore

yss = G(0)uss

• The roots of the denominator of the transfer functionG(s) (sn + a1sn−1 + · · ·+ an−1s+ an)

are called the poles of the transfer function. The roots of the denominator of the trans-fer function G(s) (b0s

n + b1sn−1 + · · ·+ bn−1s+ bn) are called the poles of the transfer

function.

• The zeros affect 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 areference and disturbance input.

S1

S2

- - -

?e w

6er y

q

u6

v

+

++

Assume that system S1 is described by the LDO L1(y) = N1(u), and S2 is governedby L2(v) = N2(q).

Page 126: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 118

(a) Find the differential equation relating r and w to y. The ODE will involvesums/differences/compositions of the Linear Differential Operators L1, N1, L2, N2.

(b) Find the differential equation relating r and w to u. The ODE will involvesums/differences/compositions of the Linear Differential Operators L1, N1, L2, N2.

Note that the characteristic equation is the same, whether the equations are writtenas (r, w) forcing y, or (r, w) forcing u.

2. Find the transfer function from u to y for the systems governed by the differentialequations

(a) y(t) = 1τ[u(t)− y(t)]

(b) y(t) + a1y(t) = b0u(t) + b1u(t)

(c) y(t) = u(t) (explain connection to Simulink icon for integrator...)

(d) y(t) + 2ξωny(t) + ω2ny(t) = ω2

nu(t)

3. Consider the interconnection below. The transfer functions of systems S1 and S2 are

G1(s) =3

s+ 6, G2(s) =

s+ 2

s+ 1

Determine the differential equation governing the relationship between u and y.

S1 S2- - -u y

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 theircorresponding capital letters. Find the transfer function from r to y.

F G

K

H- - - - -

6dR Y+

+

(b) For a single-loop feedback system, a rule for determining the closed-loop transferfunction 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.

Page 127: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 theircorresponding capital letters. Find the transfer function from r to y.

F G

K

H- - - - -

6dR Y+

(b) For a single-loop feedback system, with negative feedback, a rule for determiningthe 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 isshown 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.

G

K

- - -

6dR Y+

+

7. A feedback connection of 4 systems is shown below. Let the capital letters also denotethe transfer functions of each of the systems.

d dG

E H

F

- - - - -

?

6−++r y

(a) Break this apart as shown below.

d dG

E- - - -?

6−++r x

d

Page 128: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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

F

G2

G1 H- - d - -

-

6yr +

+

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 ofthe original subsystems.

(c) In terms of numerators and denominators of the individual transfer functions

(G(s) = NG(s)DG(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 andmeasurement 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 relatingr to y and d to y.

(b) Carry out the calculations for

C(s) = KP +KI

s, G1(s) =

E

τs+ 1, G2(s) = G, G3(s) =

1

ms + α

Directly from this closed-loop transfer function calculation, determine the differ-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 differential equation for the controller, which relates r and yto u.

ii. Determine the differential equation for the plant, which relates d and u to y.

iii. Combining these differential equations, eliminate u and determine the closed-loop differential equation relating r and d to y.

Page 129: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 121

9. Find the transfer function from e to u for the PI controller equations

z(t) = e(t)u(t) = KP e(t) +KIz(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 disturbanced 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), anda 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 inputsr, d and n to the output y.

(c) In one calculation, determine the 3 closed-loop transfer functions relating inputsr, 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 differential 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.

G1

G2

H

- j - -

?j

6

- -

R Y

−+

−+

Page 130: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 122

(b) Suppose that the transfer functions are given in terms of numerator and denomi-nator pairs, so

G1 =N1

D1, G2 =

N2

D2, H =

NH

DH

where all of the N and D are polynomials. Assume each denominator is of higherorder than its associated numerator. Carefully express the transfer function fromR to Y in terms of the individual numerators and denominators.

(c) What is the characteristic equation of the closed-loop system? Be sure that itsorder 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 themenubar, 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 themenubar, 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.den1

>> class(sys1.den1)

>> size(sys1.den1)

>> roots(sys1.den1)

>> pole(sys1)

Page 131: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 123

Explain what is being referenced and displayed. Recall that the “poles” of a transferfunction 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 thesystems, 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

Page 132: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 (we’ll see how to make these laterin the course) that accepts a low-power (almost no current) voltage signal, and movesthe accelerator pedal in a manner proportional to the voltage signal.

• The engine, which produces a torque that is related to the position of the acceleratorpedal (current and past values).

• The drivetrain of the car, which transmits this torque to the ground through the drivenwheels. 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. Wedo 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 signalfor 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 tothe 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 theroad, or additional aerodynamic forces due to wind gusts. For now we’ll 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:

Page 133: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 125

controllercar &

air resistance

speedometer

road

incline

des

enginepedal

actuator +

desired

measured

speed

speed

actual

speed

f

d

control

input

u

Controlled Plant

vv

Figure 33: Cruise Control System

1. There is a DC motor which controls the throttle position. We assume that the engineforce 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 ofthe car, hence

Fdrag(t) = −αv(t)where α is a positive constant.

Hence, the differential equation relating u, dF (or w) and v is simply

mv(t) = −αv(t) + Eu(t) + dF (t)= −αv(t) + Eu(t) +Hw(t)

(10.1)

Eq. (10.1) is a first order, Linear, Time Invariant (LTI) Ordinary Differential 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 cruisecontrol system, when the car is modeled by the first order ODE in (10.1). Suppose that u(t)

Page 134: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 126

is constant, at u, and w(t) is constant, w. The steady-state velocity of the car is just

v =E

αu +

H

αw

which is of the simple form (with P := Eα, D := H

α).

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 aconstant input voltage u(t) ≡ u is

v := limt→∞

v(t) =E

αu

Hence, a feasible Open-Loop control system would invert this relationship, namely

u(t) =α

Evdes(t)

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 α thatare believed accurate.

The equations which govern the open-loop car are now

v(t) = − α

mv(t) +

EKol

mvdes(t) +

H

mw(t) . (10.2)

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 everymile/hour) and the actual speed voltage to produce a control voltage, which commands thethrottle positioning DC motor system. For simplicity, take the control law to be a “constantgain” control law,

u(t) = Kffvdes(t)−Kfbv(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

v(t) = − α

mv(t) +

E

m[Kffvdes(t)−Kfbv(t)] +

H

mw(t)

= −α + EKfb

mv(t) +

EKff

mvdes(t) +

H

mw(t) . (10.4)

Page 135: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 127

input

desired

speed

vdes

+

actual

speed

v

control

Vehiclew

u

K

ff

fb

controller

+

K-

H

+

E1

+

-dt

α

m

m

df

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 andclosed-loop control. We will compare the performance, using the subcript [·]ol to refer toopen-loop control, and [·]cl to refer to closed-loop control.

First notice that both are sysems are governed by first-order linear ODEs with constantcoefficients.

First, the time constants are different,

Tol =m

α, Tcl =

m

α + EKfb

.

For positive Kfb, the response of the closed-loop system is always faster than that of theopen-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

vol = vdes +1

αdF , vcl =

EKff

α+ EKfbvdes +

1

α + EKfbdF

As in the earlier steady state analysis, by selecting Kfb sufficiently large, and setting

EKff

α + EKfb

≈ 1

we can achieve better disturbance rejection and tracking with closed-loop control than withopen-loop control.

Page 136: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 128

Do a numerical simulation to study the responses of both the open-loop and closed-loopcontrol system. For the closed-loop system, take Kfb := 8, Kff := 9.5.

Assume the following numerical values for the parameters: m = 1000, α = 60, E = 40 andH = −98, and assume the following conditions: v(0) = 25.

vdes(t) =

25 if 0 < t < 1030 if t ≥ 10

w(t) =

0 if t < 805 if t ≥ 80

The time response of the two control systems is shown below

0 20 40 60 80 100 120 14022

23

24

25

26

27

28

29

30

Time (seconds)

Car

Vel

ocity

Velocity (perfect car): Open and Closed−Loop Control

The control signal u(t) is shown in the figure below

Page 137: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 129

0 20 40 60 80 100 120 14035

40

45

50

55

60

65

70

75

80

85

Time (seconds)

Con

trol R

espo

nse

(u)

Control response (perfect car): Open and Closed−Loop Control

3 Integral Control

The car is governed bymv(t) = −αv(t) + Eu(t) +Hw(t)

For a given constant value of vdes, w, the ideal steady-state input u is

u :=α

Evdes −

H

αw

This is the only possible value for the steady-state value of u which gives a steady-statevelocity exactly equal to the desired velocity. Note that the “correct” control depends onboth vdes and w.

However, with our current closed-loop control law, if the car has speed v(t) = vdes, then thecontrol effort is

u(t) = (Kff −Kfb) vdes

With the proportional control, the car stops accelerating when the force from the controllersignal balances the force from air resistance and the incline.

The commanded force from the controller, with vdes fixed, is a linear (actually linear+offset,called affine) function of v. Hence, it is easy to see that for different values of w, the carwill cease accelerating (ie. steady-state) for values of v which are different from vdes. The“problem” is that the instantaneous throttle position is simply a function of the instantaneous

Page 138: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 130

desired speed and actual speed. There is no mechanism for the throttle to be opened furtherif this error in speed does not eventually decrease.

A new strategy should incorporate a term that corresponds to “if the speed is below thedesired speed, increase the throttle.” A mathematical version of this statement is givenbelow:

uI(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 thatinstant, increasing the throttle angle. Likewise, at any time t, for which vdes(t) < v(t), thecontrol law is, at that instant, decreasing the throttle angle. Finally, at any time t, for whichvdes(t) = v(t), the control law is, at that instant, not changing the throttle angle.

Integrating from t = 0 to t gives

uI(t) = uI(0) +Ki

∫ t

0

[vdes(ξ)− v(ξ)] dξ

which shows that the control “action,” u(t), is a running integral of the error between thedesired value and the actual value. This is called integral control action. As you wouldexpect, 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.]]

E+

H

1m

dt

am

+ +

-

+

-dt K I

vvdes u

wvehicle

controller

z

Figure 35: Cruise Control System with Integral Control

The equation for the car is as before

v(t) =1

m[−αv(t) + EuI(t) +Hw(t)]

The equations for the controller are

z(t) = vdes(t)− v(t)uI(t) = KIz(t)

Page 139: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 131

The variable z is called the “integrator” in the control system, since it is a running integralof the error vdes − v. Recall from circuit theory that an integrating circuit can be built witha 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 - differentiate the car equation model, yielding

v(t) =1

m[−αv(t) + Eu(t) +Hw(t)] (10.5)

Now u appears, but this is known from the controller equations. In fact

uI(t) = KI z(t)= KI [vdes(t)− v(t)]

Substitute this into (10.5) to yield

v(t) =1

m[EKI (vdes(t)− v(t))− αv(t) +Hw(t)]

which can be manipulated into the form

v(t) +α

mv(t) +

EKI

mv(t) =

EKI

mvdes(t)−

H

mw(t) (10.6)

In this final equation, w does not explicitly enter, only w does. Hence, if w(t) approachesa constant limit, say w, then w → 0, and the particular final value of w (ie., w) hasno effect on the limiting value of v(t).

This is the amazing thing about integral control – it eliminates the steady-state error dueto steady disturbances.

But, let’s 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) =α25EKI

• vdes(t) = 30m/s for t ≥ 10s.

• w(t) = 3 for t ≥ 160s.

Page 140: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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(t0) = 0, z(t0) = 0).

The trajectories for vdes(t) and w(t) for t > t0 are shown below.

0 50 100 150 200 250 30024

25

26

27

28

29

30

31

32

Time (seconds)

Car

Vel

ocity

Velocity Response with Integral Control

Increasing KI

Four different plots of v(t) are shown, for KI taking on values from 0.03 to 0.24. Although itsnot 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. Moreovernotice that these type of responses, which include overshoots and oscillations, are not possiblewith 1st order systems and are due to the fact that the close loop system is now a secondorder differential 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) = Kffvdes(t)−Kfbv(t) .

We can replace the feedforward term Kffvdes(t) by the integral action and keep the feedbackterm −Kfbv(t). The resulting controller

u(t) = uI(t)−Kfbv(t) (10.7)

uI(t) = KIz(t)

z(t) = vdes(t)− v(t)

Page 141: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 133

consists of an integral action and velocity feedback, and its block diagram is shown in Fig.36.

E+

H

1m

dt

m

+ +

-

+

-dt K I

vvdes u

wvehicle

controller

z +

-

K fb

uI

a

Figure 36: Cruise Control System with Integral Action and Velocity Feedback

Inserting the control law (10.7) into the differentiated vehicle dynamics in (10.5) , andperforming a similar set of manipulations to eliminate uI(t) as described above, results inthe following close loop velocity dynamics

v(t) +

m+EKfb

m

)

v(t) +EKI

mv(t) =

EKI

mvdes(t)−

H

mw(t) . (10.8)

Notice that only the coefficient 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 coefficient can nowbe changed by changing the feedback gain Kfb 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 aconstant limit, say w, then w → 0, and the particular final value of w (ie., w) has no effecton the limiting value of v(t).

In order to compare the effect of adding the additional velocity feedback action on the cruisecontroller with integral action, we repeat the simulations done above with a “realistic” carmodel, with m = 1000kg, E = 40, α = 60, H = 98. The simulation are again carried underthe 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) =α25EKI

• vdes(t) = 30m/s for t ≥ 10s.

Page 142: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 134

• w(t) = 3 for t ≥ 160s.

• KI = 0.24 and Kfb = 4 or

• KI = 0.24 and Kfb = 0.

0 50 100 150 200 250 30025

26

27

28

29

30

31

32

Car

Vel

ocity

Time (seconds)

KI = 0.24,

Kfb

= 0

KI = 0.24,

Kfb

= 4

KI = 0.24,

Kfb

= 0

Figure 37: Close Loop Response of a Cruise Control System with Integral Action and VelocityFeedback

Notice that setting the feedback term Kfb = 4 eliminates the oscillations in the response ofthe close loop system. In order to fully understand how the values of the control gains KI

and Kfb affect the response of the close loop system, we need to study differential equationsmore carefully.

4 Understanding the Integral Controller By Using Second Order

SLODE

As we saw in section 3, the integral controller was effective at reducing the steady-stateerror due to constant slope hills, but the transient response was simply either to slow, or toooscillatory. Based on our work in section 9, we should be able to explain this undesirablebehavior 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)u(t) = KP [vdes(t)− v(t)] +KIz(t)

(10.9)

Page 143: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 135

The behavior of the closed-loop system with just the I-controller can be investigated simplyby setting KP ≡ 0.

Recall that the car is governed by

v(t) = − α

mv(t) +

E

mu(t) +

H

mw(t) (10.10)

The differential equation governing the closed-loop system is obtained eliminating z and ufrom the equations (10.9) and (10.10). This is obtained by differentiating equation (10.10)and substituting from (10.9) for u. This yields

v(t) +α + EKP

mv(t) +

EKI

mv(t) =

EKI

mvdes(t) +

EKP

mvdes(t) +

H

mw(t) (10.11)

This is a second order system, and the characteristic equation is

λ2 +α + EKP

mλ+

EKI

m= 0.

Since this is second order polynomial, we know from section 8 that the conditions for stabilityare

α+ EKP

m> 0,

EKI

m> 0.

In this application, all of the physical variables (m,E, α) are already positive, hence theconditions for stability are

KI > 0, and KP >−αE

The roots of the characteristic equation can be expressed as functions of KP and KI . Wecan also express the natural frequency (ωn) and damping ratio (ξ) in terms of KP and KI

as well. This is easily done, yielding

ωn =

EKI

m, ξ =

α + EKP

2√mEKI

Note that

• ωn increases with increasing KI , but is unaffected by KP . Roughly, we expect thatincreasing KI will increase the “speed of response of the system,” while KP will nothave a dominant effect 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 observationssimplify:

Page 144: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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

λ1,2 =−(α + EKP )±

(α + EKP )2 − 4EKIm

2m(10.12)

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

−α+EKP

m, 0. As KI increases, the

two roots remain real, but move toward each other. When KI =(α+EKP )2

4Em, the roots

are equal, with value −(α+EKP )2m

. As KI increases further, the term inside the square

root is negative, so that the real part of the roots remains fixed at −(α+EKP )2m

, while theimaginary part simply increases with increasing KI . This is sketched in Fig. 38 with−(α+EKP )

2m= −10.

−10 −9 −8 −7 −6 −5 −4 −3 −2 −1 0−2.5

−2

−1.5

−1

−0.5

0

0.5

1

1.5

2

2.5

Root Locus

Real Axis

Imag

inar

y A

xis

Figure 38: Roots of Eq. (10.12) for KI ∈ [0,∞) when −(α+EKP )2m

= −10.

2. Fix KI > 0. As KP increases from −αE, the roots are complex, and move in circles with

radius√

EKI

m. When KP satisfies (α+ EKP )

2 = 4EKI , the roots are equal, and real

(at −√

EKI

m). As KP continues to increase, the roots split apart, one going off to −∞,

and the other root heading to 0 (from the left, always remaining negative). This is

sketched in Fig. 39 with√

EKI

m= 4.

Page 145: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 137

−6 −5 −4 −3 −2 −1 0−4

−3

−2

−1

0

1

2

3

4

Root Locus

Real Axis

Imag

inar

y A

xis

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 ,

KI =mω2

n

E, KP =

2ξωnm− α

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-loopsystem).

Page 146: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 questionsbelow, assume that w ≡ 0 – we are on a flat road.

(a) In terms of the parameters, what is the maximum acceleration achievable by thecar? 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 aspeed v. Your answer should be Tmin as a function of v, and will depend on themodel parameters.

(c) Take the parameters α = 60, E = 40, m = 1000, where all are SI units. Alsosuppose 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) = −α1v(t)− α2v2(t)

2. The closed-loop cruise control system equations are given in equation (10.4). Modifythe equations of the controller to include a measurement noise term, so

u(t) = Kffvdes(t)−Kfb

v(t) + n(t)︸ ︷︷ ︸

vmeasured

Here, n represents the measurement noise. The car parameters are given in Section2.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 systemare

v(t) = Av(t) +B1vdes(t) +B2w(t) +B3n(t)(v =)y1(t) = C1v(t) +D11vdes(t) +D12w(t) +D13n(t)(u =)y2(t) = C2v(t) +D21vdes(t) +D22w(t) +D23n(t)

Your answer for the coefficients will be in terms of the car parameters, and thefeedback gains. Assume that m,E and α are positive.

(b) Under what conditions is the closed-loop system stable?

Page 147: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 139

(c) What is the steady-state (ω = 0) gain from vdes to v? Your answer should be interms of the car parameters, and Kff and Kfb.

(d) What is the steady-state (ω = 0) gain from w to v? Your answer should be interms of the car parameters, and Kff and Kfb.

(e) What is the steady-state (ω = 0) gain from n to v? Your answer should be interms of the car parameters, and Kff and Kfb.

(f) If Kfb is given, what is the correct value of Kff so that the steady-state gain(ω = 0) from from vdes to v is exactly 1? Under that constraint, what are thevalues of the steady-state gain from w to v and n to v? What is the motivationfor picking Kfb “large”? What is a drawback for picking Kfb large?

(g) Consider three cases, Kfb = 2, 4, 8. For each case, compute the appropriate valueof Kff based on steady-state gain considerations in part 2f above.

(h) Using Matlab (subplot, loglog, abs, semilogx, angle) make a 2-by-3 plot ofthe frequency response functions (ie., the sinusoidal steady-state gain) from theinputs (vdes, w and n) to the outputs (v and u). The plots should be layed out asshown below.

|Gvdes→u|

∠Gvdes→v

|Gvdes→v|

|Gw→u|

|Gw→v|

|Gn→u|

|Gn→v|

For magnitude plots, use loglog. For angle plots, use semilogx. Each axesshould have 3 plots (associated with Kfb = 2, 4, 8 and the corresponding valuesfor Kff .

(i) Using Simulink, compute and plot the responses v and u for the system subjectedto the inputs vdes and w given on page 38/39. Use n(t) = 0 for all t. Do this forthe 3 different gain combinations. Plot the two “outputs of interest” in a 2-by-1array of subplots, with y1 in the top subplot, and y2 in the bottom. Both axesshould have 3 graphs in them.

(j) Certain aspects of the frequency-response curves are unaffected by the specific(Kfb, Kff) values (eg., the graphs are the same regardless of the value, the graphs

Page 148: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 140

converge together in certain frequency ranges, etc). Mark these situations on yourgraphs, and in each case, explain why this is happening. Compare/connect to thetime-response plots if possible/necessary.

(k) Certain aspects of the frequency-response curves are significantly affected by thespecific (Kfb, Kff) values (eg., the graphs have different magnitudes at low fre-quency, the graphs bend down (or up) at different frequencies, etc). Mark thesesituations 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. Thisis easily observed in the frequency response plots. Where does this “show up” inthe 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-frequencyvalue. Beyond that value, the frequency response plot fades unremarkably to 0.Moreover, as we increase Kfb the range of frequencies over which the frequency-response from vdes to v is nearly 1 is extended. Where does this “show up” in thetime response plots? Can you quantitatively connect the two plots?

(n) Notice that as Kfb increases, the magnitude of the frequency response from wto v decreases (less effect at high frequency though, and no effect at “infinite”frequency). Where does this “show up” in the time response plots? Can youquantitatively connect the two plots?

(o) Using Simulink, compute and plot the responses v and u for the system subjectedto the inputs vdes and w given on page 36. From the Sources library, use theBand-Limited White Noise block. Set the noise power to about 0.033, and thesample time to 0.1 seconds. Set the Seed field to clock*[0;0;0;0;0;1]. Thismeans that every time you simulate, Matlab will call the clock function, whichreturns a 1-by-6 array (year,month,day,hour,minute,second) and then “pick off”the “seconds” value. This is used as the seed in the random number generator,ensuring that you get a different noise trajectory each time you simulate. Dothis for the 3 different gain combinations. Plot the two “outputs of interest” in a2-by-1 array of subplots, with y1 in the top subplot, and y2 in the bottom. Bothaxes should have 3 graphs in them. Comment on the effec that measurementnoise has on the outputs, and how the increased feedback gain affects 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 effect 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.

Page 149: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 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 u

I(t),

where j2 = −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 differential equations that ypR(t) and ypI(t) respectively satisfy.

(b) Assume that

u(t) = ejωt,

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)

Page 150: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 142

ii. The particular solution yp(t) in Eq. (10.14) can also be written as

yp(t) =M(ω) e(jωt+φ(ω)) .

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(ejωt). (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 achievedfor t ≥ 1.

Determine the values of the parameters ω, a and b.

4. Consider the cruise-control problem, with parameters E = 40, m = 1000, α = 60. Usinga PI controller, choose KP and KI so that the roots of the closed-loop characteristicequation 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 isreferred 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 ornon-dynamic), namely

Fengine(t) = Eu(t)

Page 151: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 143

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−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

Time

inpu

t u

and

outp

ut y

uy

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 thethrottle, and then the engine must actually produce this force. A slightly more realisticmodel 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) = Eu.

NOTE:Although this is a dynamic relationship between u and Fengine, the steady-statebehavior 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 modelfor the car. Overall, your block diagram should have 3 integrator blocks – 1 inthe controller, 1 in the new engine model, and 1 in the car (simply representingthat velocity is the integral of acceleration).

(b) Write down differential 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)

Page 152: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 144

(c) Define a vector

x(t) :=

[v(t)q(t)z(t)

]

Write the equations in the form

x(t) = Ax(t) +B

[vdes(t)w(t)

]

where A ∈ R3×3 and B ∈ R3×2 are matrices whose entries depend only on theparameters (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) =αvE, z(t) = αv

EKI, 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 wremains 0, then all of the variables v, q and z remain constant in time. This givessome idea as to how the initial condition on z is set in the cruise control circuitryas the cruise control system is turned on while driving.

(e) Now, back to the problem. Differentiate the v(t) equation twice, and substitute asnecessary to get a differential equation for the closed-loop system only involvingv, vdes, w and their derivatives (and the parameters, or course). What is thecharacteristic 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 timeconstant of the dynamic engine model.

(g) Compare the actual roots obtained in part 4f, to the 2 roots obtained at thebeginning of the problem, which are calculated using the non-dynamic enginemodel, 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-loopresponse, 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 - theroots of the closed-loop system are pretty much the individual roots. However,when the engine speed-of-response becomes comparable to the desired responseof the “ideal” closed-loop system, then interaction takes place, and performancedegradation results. This shows that in some cases, you can neglect very fastsubsystems in your systems, and replace them by their steady-state behavior whendoing the control design. However, the objectives of your simplified control design(ie., the roots of the characteristic equation) should be significantly “slower” thanthe neglected system’s 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.

Page 153: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 145

The initial condition should be v(0) = 25, with q(0) and z(0) as derived earlier.The input signals should be

vdes(t) =

25 for 0 ≤ t ≤ 1030 for 10 ≤ t ≤ 4035 for 40 ≤ t ≤ 8032 for 80 ≤ t

and

w(t) =

0 for 0 ≤ t ≤ 303 for 30 ≤ t ≤ 60−3 for 60 ≤ t ≤ 900 for 90 ≤ t

Do these for the values of τ described above (hence you should get 7 differentsimulations). 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 acomplex 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 responseof the car using integral control.

6. In this problem, we consider a simple model for the roll axis of an airplane, and startworking on a control system which keeps the plane at a desired roll-angle. A diagramof the system is shown below.

"!#

Take IC = 4.5e5, c = 3.3e5, with θ also measured in degrees. The differential equationmodel for the roll axis is a simplistic balance of angular momentum for the rigid body

IC θ(t) + cθ(t) =Ma(t) +Md(t)

where Md(t) is a disturbance moment, caused by external wind and turbulence, andMa(t) is the moment generated by the ailerons. A model for the moment exerted bythe ailerons is

Ma(t) = Eδ(t)

where E = 1.4e5 and δ(t) is the deflection (in degrees) of the ailerons from theirnominal position.

Page 154: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 146

(a) Fill in the boxes, signs on summing junctions, and label the signals so that theblock diagram below depicts the cause/effect dynamic relationship between δ,Md

and θ.

e- - - - - -

6

?

airplane

(b) (writing a state-space model:) Define x1(t) := θ(t), x2(t) := θ(t). Find 2 × 2matrices A and B (depending only on the parameters E, IC, and c) such that theairplane model is governed by

[x1(t)x2(t)

]

= A

[x1(t)x2(t)

]

+B

[δ(t)Md(t)

]

Hint: The equation governing x1 is very simple...

(c) Assume that we have a small powerful motor which will move the ailerons toany commanded position. Suppose that to control the roll axis, we implement aproportional control law,

δ(t) = KP [θdes(t)− θ(t)]

Write down the closed-loop differential equation governing the relationship be-tween θ (and its derivatives), θdes and Md (you must eliminate δ). What is thecharacteristic equation of this closed-loop differential 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 theclosed-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-loopsystem for all initial conditions equal to zero (steady, level flight), withMd(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?

Page 155: ME 132 Reader

ME 132, Fall 2012, 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 haveon the roots of the closed-loop characteristic equation?

(k) Choose the gains KP and KD so that the roots of the closed-loop characteristicequation have ξ = 0.9, ωn = 1.0.

(l) Plot a step response (for 10 seconds) of the closed-loop system for all initialconditions equal to zero (steady, level flight), with Md(t) ≡ 0, θdes(t) = 10, andanother response with θdes(t) ≡ 0,

Md(t) =

0 0 < t < 25e6 2 < t <= 60 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 fromthe 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 betweenaileron deflection to moment, would vary with airspeed? Keeping the control gainsKP and KD fixed, recalculate the roots of the closed-loop characteristic equationfor four different cases E = 1.0e5, 1.2e5, 1.6e5, 1.8e5. Also, recalculate and plotthe 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 roughweather on a large passenger jet and looked out the window, you know that thisis 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 23lecture.

(a) The control strategy sets u based on the values of vdes, vmeas(= v + n), and itsinternal variable z. Write u as a linear combination of these variables.

(b) Differentiate this expression to get an expression for u involving only vdes, v, nand their first derivatives.

(c) Differentiate the governing equation for the car, and substitute for u. This shouldgive you differential equation governing v in the closed-loop system (it shouldmatch with the bottom equation on page 3 of the powerpoint slides).

Page 156: ME 132 Reader

ME 132, Dynamic Systems and Feedback

Additional Class Notes

Andrew Packard, Roberto Horowitz, Kameshwar Poolla, Francesco Borrelli

Fall 2012

Instructor:

Prof. F. Borrelli

Department of Mechanical Engineering

University of California

Berkeley CA, 94720-1740

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

Page 157: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 149

A Arithmetic of Feedback Loops

Many important guiding principles of feedback control systems can be derived from thearithmetic relations, along with their sensitivities, that are implied by the figure below.

g C G gH

F

S

g

- - - -

-

? -

?

?

6

Process to be controlled

Sensor

Controller

Filter

r

d

e uy

nymyf

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 preciseforms) 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 transformedvariable.

Here, r, d and n are independent variables. The variables e, u, y, ym, yf are dependent, beinggenerated (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 outputvariable 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 byyf = Fym. Each circle represents a summing junction, where variables are added (or sub-tracted) to yield an output variable. Addition is always implied, with subtraction explicitlydenoted by a negative sign (−) next to the variable’s path. For example, the variables r, eand yf are related by e = r − yf .

Page 158: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 150

Each summing junction and/or block can be represented by an equation which relates theinputs and outputs. Writing these (combining some steps) gives

e = r − yf generate the regulation erroru = Ce control strategyy = Gu+Hd process behaviorym = Sy + n sensor behavioryf = Fym filtering the measurement

(A.1)

Each block (or group of blocks) has a different 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. Theseinputs affect the output variable y. As users of the process, we would like to regulate yto a desired value. The relationship between (u, d) and y is y = Gu+Hd. G is usuallyconsidered known, but with some modest potential error. Since d is unknown, and Gis slightly uncertain, the relationship between u and y is not perfectly known.

Controller: The controller automatically determines the control input u, based on thedifference between the desired value of y, which is the reference input r, and thefiltered measurement of the actual value of y.

Sensor: Measured variable is the noisy output of another system, called the sensor. Like theprocess, the sensor is also subjected to external disturbances. Because these corruptthe 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) thenoise n from the signal ym.

The goal (unattainable) of feedback (the S, F and C) is: for all reasonable (r, d, n), makey ≈ r, independent of d and n, and this behavior should be resilent to modest/small changesin G (once C is fixed).

Note that there is a cycle in the cause/effect relationships - specifically, starting at yf wehave

r, yf cause ee causes u

u, d cause yy, n cause ym

ym causes yf

This is called a feedback loop, and can be beneficial and/or detrimental. For instance,

Page 159: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 151

• Note that d (and u) also affects y, and through the the feedback loop, ultimately affectsu, which in turn again affects y. So, although u explicitly only depends on e, throughthe feedback loop the control action, u, may in actuality compensate for disturbancesd.

• However, through the feedback loop, y is affected by the imperfection to which it ismeasured, n.

Eliminating the intermediate variables (such as e, yf and ym) yields the explicit dependenceof y on r, d, n. This is called the closed-loop relationship.

y =GC

1 +GCFS︸ ︷︷ ︸

(r→y)CL

r +H

1 +GCFS︸ ︷︷ ︸

(d→y)CL

d +−GCF

1 + GCFS︸ ︷︷ ︸

(n→y)CL

n (A.2)

Note that y is a linear function of the independent variables (r, d, n), but a nonlinear functionof the various component behaviors (the G, H , F , C, etc). Each term which multiplies oneof the external variables is called a closed-loop gain, and the notation for a closed-loop gainis given.

Now, in more mathematical terms, the goals are:

1. Make the magnitude of (d→ y)CL significantly smaller than the uncontrolled effectthat d has on y, which is H .

2. Make the magnitude of (n→ y)CL “small,” relative to 1S.

3. Make (r → y)CL gain approximately equal to 1

4. Generally, behavior should be insensitive to G.

Implications

• Goal 1 implies ∣∣∣∣

H

1 +GCFS

∣∣∣∣<< |H| ,

which is “equivalent” to ∣∣∣∣

1

1 +GCFS

∣∣∣∣<< 1

This, in turn, is “equivalent” to |GCFS| >> 1.

Page 160: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 152

• Goal 2 implies that any noise injected at the sensor output should be significantlyattenuated at the process output y (with proper accounting for unit changes by S).This requires ∣

∣∣∣

GCF

1 +GCFS

∣∣∣∣<<

1

|S| .

This is equivalent to requiring|GCFS| << 1.

So, Goals 1 and 2 are in direct conflict. Depending on which is followed, Goal 3 is accom-plished in different manners. By itself, goal 3 requires

GC

1 +GCFS≈ 1.

If Goal 1 is satisfied, then |GCFS| is large (relative to 1), so

GC

1 +GCFS≈ GC

GCFS=

1

FS.

Therefore, the requirement of Goals 1 and 3 are

1

FS≈ 1, |GC| >> 1. (A.3)

On the other hand, if Goal 2 is satisfied, then |GCFS| is small (relative to 1), so

GC

1 +GCFS≈ GC

Therefore, the requirement of Goals 2 and 3 are

|FS| << 1, GC ≈ 1 (A.4)

The requirements in (A.3) and (A.4) are completely different. Equation (A.3) represents afeedback 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 tointroduce 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 constrainsGCFS to satisfy |1 +GCFS| > 1

3. Note that if |GCFS| >> 1 or |GCFS| << 1, this

condition holds. However, if |GCFS| ≈ 1, then it is possible that GCFS ≈ −1, whichwould violate this goal.

We will revisit this type of goal/constraint many times in later sections.

Page 161: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 153

1 Tradeoffs

Several of the implications are at odds with each other. Let T (G,C, S, F ) denote the factorthat relates r to y

T (G,C, S, F ) =GC

1 + GCFSRecall that G represents the process behavior, how control action u influences the regulatedoutput y, and that S represents the sensor, which is a transducer (physical device) thatconverts the variable y into a measurable quantity ym. Typically both G and S are complexsystems, 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 toG, and sensitivity of T to S. Recall that for any variable X , the sensitivity of T to X isdefined as

STX :=∂T

∂X

X

TIt is unitless.

Simple calculation gives

STG =1

1 +GCFS, STS =

−GCFS1 +GCFS

Note that (always!)STG = 1 + STS

Hence, if one of the sensitivity measures is very small, then the other sensitivity measurewill be approximately 1. So, if T is very insensitive to G (for example

∣∣STG∣∣ = 0.01), then T

will be nearly “1-to-1” sensitive to S, since the relation shows that∣∣STS∣∣ ≈ 1.

Note that while it is impossible for both sensitivity measures to be small (relative to 1), itis possible for both sensitivity measures to be large. Generally this would represent a baddesign.

2 Signal-to-Noise ratio

Suppose r = 0, so the desired value of y is zero. Consider the effect of d and n on y. If nocontrol is used C = 0, then y = Hd. For notational purposes, call that yno control. Conversely,if control is used, then

ywith control =H

1 + GCFSd− GCF

1 +GCFSn

We want to compare the size of the disturbance d to the size of the noise n. However,they are in different units. By redrawing the block diagram, it is clear that Hd should becompared to 1

Sn.

Page 162: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 154

Let’s look at the ratio of ∣∣∣∣

ywith control

yno control

∣∣∣∣

as compared to the signal-to-noise ratio,

SNR :=HdnS

Dividing out givesywith control

yno control

= 11+GCFS

+ −GCFS1+GCFS

nS

Hd

= 11+GCFS

+ −GCFS1+GCFS

1SNR

The desired value of this ratio is 0, since we want y = 0. What are the limits (as related tothe noise-to-signal ratio)?

If Noise-to-Signal ratio is large, the quotient can be made only so small, namely about 1, bychoosing FC ≈ 0 (no feedback).

If Noise-to-Signal ratio is small, then by using high-gain (|GCFS| >> 1), the quotient madeabout equal to the Noise-to-Signal.

3 What’s missing?

The most important thing missing from the analysis above is that the relationships are notin 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 generalsetting.

Page 163: ME 132 Reader

ME 132, Fall 2012, 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 iscalled the triangle inequality. Draw a picture (in the complex plane) to illustratethis 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 + L

∣∣∣∣≤ ǫ ⇒ |L| ≥ 1

ǫ− 1

(b) Show that

|L| ≥ 1

ǫ+ 1 ⇒

∣∣∣∣

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 + L

∣∣∣∣≤ ǫ ⇔ |L| ≥ 1

ǫ

3. Suppose L is a complex number, and 0 < ǫ < 1.

(a) Show that ∣∣∣∣

L

1 + L

∣∣∣∣≤ ǫ ⇒ |L| ≤ ǫ

1− ǫ

(b) Show that

|L| ≤ ǫ

1 + ǫ⇒

∣∣∣∣

L

1 + L

∣∣∣∣≤ ǫ

Page 164: ME 132 Reader

ME 132, Fall 2012, 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

S1 : y(t) = [u(t)− y(t)]S2 : u(t) = 2 [y(t)− r(t)]

(A.5)

(a) Consider first S1 (input u, output y): Show that for any initial condition y0, ifu(t) ≡ u (a constant), then y(t) approaches a constant y, that only depends onthe 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 andy, only dependent on r. Draw a block-diagram showing how the limiting valuesare 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 allt ≥ 0. Eliminate u from the equations A.5, and determine y(t) for all t. Make asimple 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 analysisin part 4c is incorrect. That is why, for a closed-loop steady-state analysis to be basedon the separate component’s steady-state properties, we must know from other meansthat 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)]S2 : u(t) = 2 [r(t)− y(t)]

(A.6)

(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?

Page 165: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 157

(c) Suppose y(0) = y0 is given, and r(t) =: r for all t ≥ 0. Eliminate u from theequations 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 thevalue 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 feedbackwith S2, the overall closed-loop system does.

6. Consider a problem associated with the general block diagram of the section, involvingC, 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). Alsoassume the the overall interconnection has the SStG property as well (remember: asillustrated in problem 4, the SStG property of an interconnection does not necessarilyfollow from the SStG property of the individual systems, since the interconnection mayitself be unstable).

Below are the frequency-response functions of each component.

G(ω) =40

j1000ω + 60, H(ω) =

−98

j1000ω + 60, C(ω) =

j18.5ω + 6.25

F (ω) =1

j0.01ω + 1, S(ω) = 1

Plot the following:

(a) On a single axes, plot∣∣ 11+GCFS

∣∣,∣∣ −GCFS1+GCFS

∣∣. 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 (noiseinsensitivity) 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,let’s agree on a convention that 0.2 will be the limit for “significantly less than1.”

(c) Directly below the first plot, make a second plot, using the same frequency-range,showing |GCFS|. This plot relates to the first set of plots through problems 2and 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 isreference input tracking, which is that the contribution of r to y is about 1). Inother words, in the absence of d and n, y should behave like r. Plot

∣∣∣∣1− GC

1 +GCFS

∣∣∣∣

Mark the range of frequencies where this is less than 0.2.

Page 166: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 158

(e) Directly below the existing plots, make a plot of the important quantities reflectingboth Goal 1 and Goal 3. Specifically, plot |GC| and |1− FS|. Explain how theseplots are consistent with the plots of Goal 1 and Goal 3, looking at the plots inpart 6a and 6d.

(f) Is there a range of frequencies where Goal 2 and Goal 3 are obtained? We can alsocheck the separate conditions that would have to hold. Directly below the existingplots, make a plot of the important quantities reflecting both Goal 2 and Goal 3.Specifically, plot |1−GC| and |FS|. Explain how these plots are consistent withthe 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 modificationsto F , listed below.

F (ω) =1

j0.001ω + 1, and F (ω) =

1

j0.1ω + 1

Roughly, in the frequency ranges where F was already small, we have changed itsmagnitude. 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 additionallines to the plots for 2 modifications to C, listed below.

C(ω) =j18.5ω + 2

jω, and C(ω) =

j18.5ω + 0.625

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 theeffect of external disturbances and to reduce the sensitivity of the of the overall systemto changes in the plant itself. Feedback also has a linearizing effect, which is usedbeneficially in the design of amplifiers and actuators. In this problem, we study anon-dynamic analysis of this property.

Suppose that you can build a high-power amplifier, whose input/output characteristicis y = φ(u), as graphed below.

Page 167: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 159

−5 −4 −3 −2 −1 0 1 2 3 4 5−4

−3

−2

−1

0

1

2

3

4

5

φ(u)

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 amplifierthat 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.

K φ(·)g−+- - - -

6

r e u y

(a) Write down the relationship between y and r. Because we don’t have an exactformula for φ, you cannot solve for y in terms of r - instead, you can only writedown the relationship, which implicitly determines how r affects y. Make sureyour 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 onthe graph, for many different values of r, plot

r − 1

Ku versus u

Each one of these graphs (straight lines) should intersect the φ(u)-versus-u graphat one point. Explain why the intersection point gives the value y(r) (for thespecific 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, differentiate it with respect to r toget y′(r).

(d) What should be K be chosen as so that the slope of the closed-loop behaviorbetween y and r varies at most between 0.9 and 1.1.

Page 168: ME 132 Reader

ME 132, Fall 2012, 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, theremay 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 structuralstops

• 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 withother 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 tworeasons:

1. Ultimate response-times of the system are usually longer, since the actual inputs aregenerally 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 behaviorif there is any time interval where the input becomes saturated. This is potentiallymuch worse than the first reason, and must be remedied.

In all of these different cases, the control action (ie., u(t)) is limited, or constrained. Explicitlydesigning the control law to respect these limiting constraints is a very difficult mathematicalproblem. Often times, the constraints are dealt with using special tricks, and intuition, oftenon a problem-by-problem basis.

1 Saturation

We will consider a special case of the general problem. In the ideal situation, there are nolimits on the control action, and the block diagram of the closed-loop system appears asusual, as below

C P- - - -

6

i+

−r(t)

e(t) u(t)y(t)

Page 169: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 161

The nonideal, or real, scenario is that there is a “saturating” element in between the controllerand the plant, which limits the control action, regardless of the control system’s output.

C P- - - - -

6

i+

−r(t)

e(t) udes(t) u(t)y(t)

The behavior of the saturating element is simply

u(t) =Umax if udes(t) ≥ Umax

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 desiredcontrol 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 isin bounds, the performance is the ideal performance, and for scenarios where u reachesits limits, the presence of the saturating element should not wreak too much havoc on theperformance of the closed-loop system.

First, to see that this may cause problems, consider the cruise-control problem, from Section4, with PI control. The simulations are performed for several values of Umin and Umax. Forsimplicity, we take Umin := −Umax (so the saturating element is symmetric, which may ormay 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 whenthe simluation starts, with vdes(0) = 25 (which is the current speed), the value of zis the correct value so that speed of the car remains at 25 (until vdes changes, or adisturbance 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

Page 170: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 162

0 10 20 30 40 50 6025

26

27

28

29

30

31

32

33Velocity

0 10 20 30 40 50 6020

40

60

80

100

120

140Actual Control

0 10 20 30 40 50 604

6

8

10

12

14

16

18

20Controller Integrator

Page 171: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 163

Note that as Umax decreases, the closed-loop performance degrades quite ungracefully. Eventhough 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 thevariable z to keep increasing, since increases its value, which causes increases in u(t) =KP [vdes(t)− v(t)]+KIz(t) occur with no benefit – the maximum force, that associated withUmax is already being applied. In fact, not only is there no benefit to increasing the variable zin this scenario, there is actually a significant drawback. Once z is increased beyond a usefulvalue, decreasing it has no immediate effect, since the value of KP [vdes(t)− v(t)] +KIz(t)is still well above the threshold Umax. So, the control circuitry wastes valuable time gettingz back down to a useful level, at which changes in it actually lead to changes in the trueapplied force.

In this case, the accepted terminology is that “the integral controller wound up, causingunnecessary overshoot and oscillations.”

In order to avoid integral wind-up, we need some additional circuitry or software in thecontrol logic which essentially “turns off 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 ofthe plant output, and let y(t) denote the actual plant output. The PI controller equationsare

z(t) = r(t)− y(t)udes(t) = KP [r(t)− y(t)] + KIz(t)

(B.1)

The saturating element maps the desired control input into the actual control input,

u(t) =Umax if udes(t) ≥ Umax

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. Oneviable 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, atno benefit, only screwing up the ability to come off (since decreasing z would initiallythen have no benefit). So, stop integrator.

• If u is at Umax, and r − y < 0, continue integrating.

Page 172: ME 132 Reader

ME 132, Fall 2012, 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)] + KIz(t)if udes(t) ≥ Umax and r(t) ≥ y(t) ⇒ z(t) = 0elseif udes(t) ≥ Umax and r(t) ≤ y(t) ⇒ z(t) = r(t)− y(t)if udes(t) ≤ Umin and r(t) ≤ y(t) ⇒ z(t) = 0elseif udes(t) ≤ Umin and r(t) ≥ y(t) ⇒ z(t) = r(t)− y(t)

(B.2)

Doing so yields much better performance. The plots are shown on the next page.

Page 173: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 165

0 10 20 30 40 50 6025

26

27

28

29

30

31Velocity

0 10 20 30 40 50 6020

40

60

80

100

120

140Actual Control

0 10 20 30 40 50 604

4.5

5

5.5

6

6.5

7

7.5

8

8.5Controller Integrator

Page 174: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 166

3 Alternate architecture for AntiWindup Logic

Shown below is an alternate architecture, that uses traditional feedback to approximatelyprevent windup.

KP

∫KI

KPSAT

G

KAW

- - - - - - - --

-f f ff f

f

?

?

6

??

6− −

−uact,measη1

f

If we look at the inner-loop, where the antiwindup loop is, we see

∫KI

KP

KAW

- e - - - e -

?e

6

?· · ·−

· · ·udes

uact−

Note that the response from uact to udes is a first-order system, with steady-state gain equalto 1, and time constant equal to KP

KIKAW. So, this logic attempts to keep the value of the

output of the integrator (using feedback to the integrator’s input) such that the desired valueof 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 labnext week.

4 Problems

1. In simple mathematical models for actuators (like the motor/aileron control surface onan 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 otherwiseresponds 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 outputis limited.

Page 175: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 167

satγ(·)∫g

−+- - - - -

6

r v y y

satγ(v) =γ if v > γv if −γ ≤ v ≤ γ

−γ if v < −γ

There are actually three (3) different regimes in which this model behaves differ-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 dueto a step input r(t) = r, where r is some fixed real number. Think carefully howy 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 resultingoutput y(t), starting from initial condition y(0) = 0. Do this using your resultsin 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 roughlyhow things look, use the top axes to sketch your ideas. As you finalize youranswer, please make your final (neat) graphs on the bottom axes.

Page 176: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 168

0 1 2 3 4 5 6 7 8 9 100

0.5

1

1.5

2

2.5

3

0 1 2 3 4 5 6 7 8 9 100

0.5

1

1.5

2

2.5

3

Page 177: ME 132 Reader

ME 132, Fall 2012, 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.

C P- - - -

6

i+

−r(t)

e(t) u(t)y(t)

We assume that both P and C are governed by linear, ordinary differential equations, andthat 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 .

C γ P

delay, T

- - - - -

6

i+

−r(t)

e(t) u(t)y(t)

f(t) = y(t− T )

Note that if T = 0, γ = 1 and P = P , then the perturbed system is simply the nominalclosed-loop system.

The time-delay margin is characterized by the minimum time delay T > 0 such that theclosed-loop system becomes unstable, with γ set equal to its nominal value, γ = 1, andP = 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

Page 178: ME 132 Reader

ME 132, Fall 2012, 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ω)

P (jω)

∣∣∣∣∣< α(ω) for all ω.

assuming γ = 1, T = 0.

Two viewpoints can be taken regarding the interpretation of these margins:

1. We are explicitly concerned about the destabilizing effects of time-delays, gain changesand percentage changes in frequency responses, and these margins give exact answerswith respect to those variations.

2. While not being explicitly concerned with time-delays and/or gain changes and/orpercentage changes in frequency response functions, we are cognizant of the fact thatthe model differential equation we use for the plant is not entirely accurate. In thatvein, we would like some easily computable information concerning the sensitivity (orinsensitivity) of the stability of the closed-loop system to unmodeled variations. Weuse the computed margins as indications of the potential for instability brought on byvariations in the plant’s behavior.

In any case, the goal of this section is to learn how to compute such margins and do examplesto 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

γ C P

L

delay, T

- - - - -

6

i+

−r(t)

e(t) v(t)y(t)

f(t) = y(t− T )

By convention, if P denotes the nominal plant, then P (s) will denote the transfer functionof the nominal plant. Similar convention for controller and in fact, any dynamical system. Acapital letter denotes the system itself while the “hatted” capital letter denotes the system’stransfer function.

For certain computational purposes, we denote the cascade of C and P as the system L. Interms of transfer functions, we have L(s) = P (s)C(s) (see section 9). Assume L is of theform

L(s) =b1s

n−1 + · · ·+ bn−1s+ bnsn + a1sn−1 + · · ·+ an−1s+ an

Page 179: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 171

This is equivalent to the differential equation relating v to y as

y[n](t) + a1y[n−1](t) + · · ·+ an−1y

[1](t) + any(t) = b1v[n−1](t) + · · ·+ bn−1v

[1](t) + bnv(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-differential equation

y[n](t) + a1y[n−1](t) + · · ·+ an−1y

[1](t) + any(t)+ γ

[b1y

[n−1](t− T ) + · · ·+ bn−1y[1](t− T ) + bny(t− T )

]

= γ[b1r

[n−1](t) + · · ·+ bn−1r[1](t) + bnr(t)

](C.1)

It is from this equation that we begin our analysis, though most of our computations willultimately 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 plantand controller are in closed-loop along with a gain γ at the plant input. We assume thatthe 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 differential equation (C.1) becomes an ordinary differentialequation,

y[n](t) + (a1 + γb1) y[n−1](t) + · · ·+ (an−1 + γbn−1) y

[1](t) + (an + γbn) y(t)= γ

[b1r

[n−1](t) + · · ·+ bn−1r[1](t) + bnr(t)

]

Clearly, the closed-loop characteristic polynomial is a function of γ, namely

pγ(λ) = λn + (a1 + γb1)λn−1 + (a2 + γb2)λ

n−2 + · · ·+ (an−1 + γbn−1)λ+ (an + γbn)

It is a fact from mathematics that the roots of the characteristic polynomial are continuousfunctions 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 planeinto the right-half plane is to cross the imaginary axis, either at 0, or at somejβ, with β > 0 (since complex roots come in conjugate pairs, if they cross theimaginary axis, one will cross positively, and one negatively - we can focus onone or the other, and for no specific reason, we look at the positive crossing).

Page 180: ME 132 Reader

ME 132, Fall 2012, 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β)n−1 + (a2 + γb2)(jβ)

n−2 + · · ·+ (an−1 + γbn−1)(jβ) + (an + γbn) = 0

Rearranging gives

[(jβ)n + a1(jβ)n−1 + a2(jβ)

n−2 + · · ·+ an−1(jβ) + an]+ γ [b1(jβ)

n−1 + b2(jβ)n−2 + · · ·+ bn−1(jβ) + bn] = 0

. (C.2)

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 to1.

First, we can look for solutions to (C.2) by looking for imaginary-axis roots (ie., real β) topγ=0(jβ) = 0, namely

(jβ)n + a1(jβ)n−1 + a2(jβ)

n−2 + · · ·+ an−1(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 γ 6= 0, which are described below.

We can also look for solutions to (C.2) with (jβ)n+a1(jβ)n−1+a2(jβ)

n−2+ · · ·+an−1(jβ)+an 6= 0, so that after dividing, we manipulate equation (C.2) into

−1 = γb1(jβ)

n−1 + b2(jβ)n−2 + · · ·+ bn−1(jβ) + bn

(jβ)n + a1(jβ)n−1 + a2(jβ)n−2 + · · ·+ an−1(jβ) + an

But, this is recognized as

−1 = γ L(s)∣∣∣s=jβ

This can be solved graphically, finding values of β for which L(s)∣∣∣s=jβ

is a real number (and

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β)n−1 + a2(jβ)

n−2 + · · ·+ an−1(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 ofL(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?).

Page 181: ME 132 Reader

ME 132, Fall 2012, 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 terminologyphase-crossover frequencies only refers to frequencies where where L(jβ) is a negativereal number.

4. At each phase crossover point, βk, determine the associated value of γ by computing

γk :=−1

L(s)∣∣∣s=jβk

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 allsolutions with γk > 1, find the one closest to 1. Label this γ. In the event that thereare no solutions less than 1, then γ = −∞. Similarly, if there are no solutions greaterthan 1, then γ = ∞.

Graphically, we can determine the quantity γ easily. Find the smallest number > 1 suchthat if the plot of L(jβ) were scaled by this number, it would intersect the −1 point. Thatis γ. 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 theinterval [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 plotof 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 thenegative real axis is associated with two numbers:

1. The location (in the complex plane) of the intersection, of which the negative reciprocaldetermines the gain γ that would cause instability.

2. The value of β at which the intersection takes place, which determines the crossingpoint (on the imaginary axis) where the closed-loop root migrates from the left-halfplane into the right-half plane, and hence determines the frequency of oscillations justat the onset of instability due to the gain change.

Page 182: ME 132 Reader

ME 132, Fall 2012, 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) + a1y[n−1](t) + · · ·+ an−1y

[1](t) + any(t)+ b1y

[n−1](t− T ) + · · ·+ bn−1y[1](t− T ) + bny(t− T ) = 0

(C.3)

Recall that we assume that for T = 0, the system is stable, and hence all homogeneoussolutions decay exponentially to 0 as t → ∞. It is a fact (advanced) that as T increasesthe system may eventually become unstable, and if it does, then at the criticalvalue 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 purelysinusoidal homogeneous solutions. The frequency of this sinusoidal solution is not knowna-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 thequestion: what is the minimum T and corresponding frequency ω such that a sinusoidalsolution to (C.3) of the form yH(t) = ejωt exists? If such a solution exists, then by pluggingit into (C.3), and canceling the common ejωt term, which is never 0, we get a necessaryalgebraic condition

(jω)n + a1 (jω)n−1 + · · ·+ an−1jω + an

e−jωT[b1 (jω)

n−1 + · · ·+ bn−1jω + bn]= 0

Rearranging gives

−1 = e−jωTb1(jω)

n−1 + b2(jω)n−2 + · · ·+ bn−1(jω) + bn

(jω)n + a1(jω)n−1 + a2(jω)n−2 + · · ·+ an−1(jω) + an

But, this is recognized as

−1 = e−jωT 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

that∣∣e−jωT

∣∣ = 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, andthe 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

∠e−jωT L(jω) = −ωT + ∠L(jω)

Page 183: ME 132 Reader

ME 132, Fall 2012, 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(jωi)

∣∣∣ = 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 e−jωiT L(jωi) = −1. Recall that multiplication of anycomplex number by e−jωiT simply rotates the complex number ωiT radians in theclockwise (negative) direction. Hence, each T can be determined by calculating theangle from L(jω) to −1, measured in a clockwise direction, and dividing this angleby ω. 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 ofall 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.

C P- k - - k? - -

6u1

e1 e2y1 y2

u2

Hence all of the closed-loop transfer functions (from ui to ej and from ui to yk) have polesin the open-left-half plane.

Suppose that due to uncertainty, the actual plant transfer function is

Pactual = P (1 + ∆(s))

Page 184: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 176

where ∆ is an unknown, stable system, representing the uncertainty in P . In block-diagramform, Pactual looks like

P- - -e-

?

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

C P

- - - - - -6e

-

?e?e

Note that ∆ is effectively in positive feedback with the transfer function −PC1+PC

. In otherwords, the perturbed closed-loop system can be thought of as the feedback interconnectionof two stable systems, namely ∆ and −PC

1+PC. Since the nominal closed-loop is stable, PC

1+PCis

stable, and hence the addition of the stable transfer function ∆ can only lead to instabilityif the loop introduced by that ∆ introduces is unstable.

C P

- - - - - -6e

6

-

?

?

e?e−PC1+PC

Therefore, stability of the perturbed closed-loop can be assessed by studying the stability of

Page 185: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 177

−PC1+PC

∆- - -

?

6e

e

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 GainTheorem. We introduce it in its simplest form, and then derive a test for establishingstability in the presence of uncertain components.

Small Gain Theorem: Suppose G is a stable system. Let G(s) be its transfer function. If

maxω∈R

∣∣∣G(jω)

∣∣∣ < 1 (C.4)

then the unity feedback connection of G, shown below, is stable.

G- d - -6

ru

y++

Derivation: Let the transfer function of G be

G(s) =N(s)

D(s)=b0s

n + b1sn−1 + · · ·+ bn−1s+ bn

sn + a1sn−1 + · · ·+ an−1s + an

where the N and D are polynomials. By assumption of stability of G, we know that theroots 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)s

n−1 + · · ·+ (τbn − an)

Page 186: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 178

For every value of τ in between 0 and 1, this is an n’th 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 onthe imaginary axes (ie., no roots with zero real-parts), then it must be that p0 and p1 havethe same number of roots in the left-half-plane (since as τ varied from 0 to 1, no roots crossthe imaginary axes).

So, pick any τ in between 0 and 1, and any ω. By assumption

|τG(jω)| =∣∣∣∣

τN(jω)

D(jω)

∣∣∣∣≤ |G(jω)| < 1

Hence τN(jω)−D(jω) 6= 0. This shows that for every τ in between 0 and 1, the polynomialpτ has no roots on the imaginary axes, completing the proof.

Small Gain Theorem #2: Suppose G and H are both stable systems. If

maxω∈R

∣∣∣G(jω)H(jω)

∣∣∣ < 1

then the feedback connection of G and H , shown below, is stable.

H

G- - -

?

6e

e

Derivation: The cascade of G and H is itself a stable system, and the frequency responsefunction of the cascade is the product of the individual frequency responses.

Corollary: Suppose G and H are both stable systems. If

maxω∈R

∣∣∣G(jω)

∣∣∣maxω∈R

∣∣∣H(jω)

∣∣∣ < 1

then the feedback connection of G and H is stable.

Page 187: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 179

3.2 Necessary and Sufficient Version

Theorem NS1: Suppose G is a given, stable system. Given any γ > 0, if

maxω∈R

∣∣∣G(jω)

∣∣∣ > γ,

then there is a stable system H such that

maxω∈R

∣∣∣H(jω)

∣∣∣ <

1

γ

such that the feedback connection of G and H is unstable.

Theorem NS2: Suppose G is a given, stable system. Assume G(jω) 6= 0 for all ω ∈ R.For any frequency ω ∈ R with ω > 0, there exists a stable system Hω such that

1. for all ω ∈ R, ω 6= ω

|Hω(jω)| <∣∣∣∣

1

G(jω)

∣∣∣∣

2. at ω,

|Hω(jω)| =∣∣∣∣

1

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 (δ) 6= 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ω) = δ.

The proof is as follows (details provided in class): For a positive β, the plot ofs− β

s+ βas s

takes on values of jω, with ω ranging from 0 to +∞, traverses a circular arc in the complexplane, from −1 (at ω = 0) to 1 (as ω → +∞) clockwise, centered at 0, and in the top-half of

the complex plane. Similarly, the plot of −s− β

s + βas s takes on values of jω, with ω ranging

from 0 to +∞, traverses from 1 (at ω = 0) to −1 (as ω → +∞) clockwise, in the bottom-halfplane. Therefore, the choice of + or − sign depends on the imaginary part of δ. Here is aconstructive procedure for the case Imag(δ) > 0 (verify that this is indeed correct).

Page 188: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 180

1. Write δ as δ = |δ| ejφ for a real number φ.

2. Pick β := ω√

1−cosφ1+cosφ

If Imag(δ) < 0, use above procedure with −δ replacing δ. Then, add the (−) sign to thetransfer function.

Fact 2: For any ω > 0 and any 0 < ξ < 1, define the transfer function

I(s) :=2ξωs

s2 + 2ξωs+ ω2

Then

1. for all ω ∈ R, ω 6= ω

|I(jω)| <∣∣∣∣

1

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ω∈R

∣∣∣G(jω)

∣∣∣ > γ,

Pick ω > 0 so that∣∣∣G(jω)

∣∣∣ > γ. Next, construct H using the “∆” construction above, with

δ := −1

G(jω). It follows that

maxω∈R

∣∣∣H(jω)

∣∣∣ =

1∣∣∣G(jω)

∣∣∣

<1

γ

and(

1 + G(s)H(s))∣∣∣s=jω

= 0, implying that 1

1+GHhas a pole at s = jω.

Alternatively, for Theorem NS2, since G(jω) is never 0, it follows that you can write

G(s) =nL(s)nR(s)

d(s)

where the roots of nL(s) = 0 are in the open left-half plane, and the roots of nR(s) = 0 arein the open right-half plane. Define

Ω(s) :=d(s)

nL(s)nR(−s)There are two relevant facts about the polynomial nR(−s), which are:

Page 189: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 181

1. since the roots of nR(s) = 0 are in the open right-half plane, it follows that the rootsof nR(−s) = 0 are in the open left-half plane;

2. since the coefficients of nR(s) are real, it follows that nR(−jω) is the complex conjugateof nR(jω) and consequently the magnitudes are the same.

Therefore Ω is stable, and for all ω

|Ω(jω)| = 1

|G(jω)|

Now pick β > 0, and the proper choice of ± so that

±s− β

s+ βΩ(s)

∣∣∣∣s=jω

=1

G(jω)

Finally with any 0 < ξ < 1, define H as

H(s) := (±)2ξωs

s2 + 2ξωs+ ω2

s− β

s+ βΩ(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 stabilityof

−PC1+PC

∆- - -

?

6e

e

We can now apply the various small-gain theorems, with −PC1+PC

playing the role of G, and ∆playing the role of H .

The first small gain theorem implies that if ∆ is stable, and satisfies

|∆(jω)| < 1−PC(jω)1+PC(jω)

=

∣∣∣∣

1 + PC(jω)

PC(jω)

∣∣∣∣

for all ω, then stability is assured.

By contrast, Theorem NS2 implies that for any ω, there exists a stable ∆ such that

Page 190: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 182

1. for all ω ∈ R, ω 6= ω

|∆(jω)| <∣∣∣∣

1 + PC(jω)

PC(jω)

∣∣∣∣

2. at ω,

|∆(jω)| =∣∣∣∣

1 + PC(jω)

PC(jω)

∣∣∣∣

3. The feedback connection of −PC1+PC

and ∆ is unstable, with a closed-loop pole at s = jω.

Hence, the function

MPV (ω) :=

∣∣∣∣

1 + PC(jω)

PC(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 different 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 byfrequency; while the Percentage-Variation margin quantifies the distance in a more absolutemanner. All 3 margins are easy to compute, knowing the loop-gain, and should be computedand compared when understanding tradeoffs between multiple competing control systemdesigns.

Page 191: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 183

5 Examples

5.1 Generic

Consider a system with

L(s) =4

(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.

100

101

10−2

10−1

100

101

Loop Gain

−1 −0.5 0 0.5 1 1.5 2 2.5 3 3.5 4−3

−2.5

−2

−1.5

−1

−0.5

0

0.5

1Nyquist Plot

100

101

−250

−200

−150

−100

−50

0Loop Phase

Page 192: ME 132 Reader

ME 132, Fall 2012, 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 atail-fin controlled missile is

P (s) =−0.5(s2 − 2500)

(s− 3)(s2 + 50s+ 1000)

A PI controller, with transfer function

C(s) =10(s+ 3)

s

is used. This results in a stable closed-loop system, with closed-loop roots at

−8.1 ± j14.84,−18.8,−6.97

Plots of the L are shown below, along with some time responses.

Page 193: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 185

100

101

102

100

101

102

Lo

g M

ag

nitu

de

Frequency (radians/sec)

100

101

102

80

100

120

140

160

180

200

220

Ph

ase

(d

eg

re

es)

Frequency (radians/sec)

Page 194: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 186

−5 −4 −3 −2 −1 0 1−2

−1.5

−1

−0.5

0

0.5

1

1.5

2Nyquist Plot

0 0.05 0.1 0.15 0.2 0.25 0.3−0.1

0

0.1

0.2

0.3

0.4

0.5

Time: seconds

G’s

Open−Loop Missile Step Response

Page 195: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 187

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

0

0.5

1

1.5

2Missile Acceleration Response

Time: Seconds

Yaw

Acc

eler

atio

n: G

’s

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

−6

−4

−2

0

2

4

6

8

10

12Fin Deflection

Time: Seconds

Deg

rees

Page 196: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 188

5.3 Application to percentage variation margin

Take the missile example from Section 17,

P (s) =−0.5(s2 − 2500)

(s− 3)(s2 + 50s+ 1000), C(s) =

10(s+ 3)

s

We will also try

Pperturbed(s) = P (s)1

τs+ 1

Note this is the same as

P (s)1

τs+ 1= P (s)

[

1 +−τsτs+ 1

]

Hence, the percentage variation in going from P to Pperturbed is

Pperturbed − P

P=

−τsτs + 1

Let’s plot the magnitude of this versus the percentage-variation margin for different valuesof τ .

Page 197: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 189

100

101

102

103

10−3

10−2

10−1

100

101

102

103

100

101

102

103

80

100

120

140

160

180

200

220

Page 198: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 190

100

101

102

103

10−5

10−4

10−3

10−2

10−1

100

101

102

103

Step Response

Time (sec)

Ampl

itude

0 0.5 1 1.5

0

0.5

1

1.5

2

Page 199: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 191

100

101

102

103

10−3

10−2

10−1

100

101

102

103

Step Response

Time (sec)

Ampl

itude

0 0.5 1 1.5

0

0.5

1

1.5

2

Page 200: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 192

6 Problems

1. Consider the multiloop interconnection of 4 systems shown below.

d d d6

? ?

G

E H

F

- - - - - -

?

6−++r y

qzp

(a) What is the transfer function from q to z? Denote the transfer function as Gq→z

(b) What is the transfer function from q to p? Denote the transfer function as Gq→p

(c) Verify that 1 +Gq→p = Gq→z.

2. Suppose C(s) = 4sand 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 theself-sustaining (ie., unstable) oscillations occur?

(f) Verify your answers with Simulink, using time delays of 0, 110Td,

310Td,

510Td,

710Td,

910Td,

9.910Td.

3. Suppose C(s) = Ksand 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-delaymargin? Note that this ratio is not a function of β and/or K.

Page 201: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 193

4. The transfer functions of several controller/process (C/P ) pairs are listed below. LetL(s) := P (s)C(s) denote the loop transfer function. For each pair, consider the closed-loop system

C P- - - -

6

i+

−r(t)

e(t) u(t)y(t)

• determine the closed-loop characteristic polynomial;

• compute the roots of the closed-loop characteristic polynomial, and verify thatthe closed-loop system is stable;

• for the gain-margin problem, find all of the phase-crossover frequencies, and thevalue 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, andthe 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 thesame plot for comparison purposes later.

The systems are:

(a) C(s) = 2.4s+1s

, P (s) = 1s−1

(b) C(s) = 0.4s+1s

, P (s) = 1s+1

(c) C(s) = 10(s+3)s

, P (s) = −0.5(s2−2500)(s−3)(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 different stabilitymargins. In one case, the plant P is unstable, and in the other case it is stable. Checkwhich case has better stability margins in each of the different measures. Make a con-clusion (at least in the case) that all other things being equal, it is “harder” to reliablycontrol an unstable plant than it is a stable one. This is a similar conclusion to whatwe reached in problem 9 of Section 7.

6. Find Leff for determining time-delay and/or gain margins at the locations marked by1, 2 and 3.

Page 202: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 194

d dC1 A G1 G2

C2

- - - - - -6

6− −1

2

3

7. A closed-loop feedback system consisting of plant P and controller C is shown below.

C P- - - -

6

i+

−r(t)

e(t) u(t)y(t)

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 changesto

C γ P

delay, T

- - - - -

6

i+

−r(t)

e(t) u(t)y(t)

f(t) = y(t− T )

In this particular system, there is both an upper and lower gain margin - that is, forno time-delay, if the gain γ is decreased from 1, the closed-loop system becomesunstable at some (still positive) value of γ; and, if the gain γ is increased from 1, theclosed-loop system becomes unstable at some value of γ > 1. Let γl and γu denotethese 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 plotbelow.

Page 203: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 195

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.5GAMMA

Min

Tim

e−D

elay

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 toread. Use these graphs to compute the time-delay margin at many fixed values of γsatisfying γl < γ < γu.

10−1

100

101

102

10−1

100

101

102

Frequency, RAD/SEC

Mag

nitu

de

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

0.5

0.75

1

1.25

1.5

1.75

2

2.25

2.5

2.75

3

3.25

3.5

3.75

4

Frequency, RAD/SEC

Mag

nitu

de

Page 204: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 196

10−1

100

101

102

100

110

120

130

140

150

160

170

180

190

200

210

220

Frequency, RAD/SEC

Pha

se (

DE

GR

EE

S)

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 30170

172.5

175

177.5

180

182.5

185

187.5

190

192.5

195

197.5

200

202.5

205

207.5

210

Frequency, RAD/SEC

Pha

se (

DE

GR

EE

S)

8. An unstable plant, P , with differential 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 isstable.

KP Pe−+- - - -

6

r e u y

(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 theclosed-loop system is stable. Using any method you like, show that the closed-loop system shown below, is unstable for all values of KI .

∫KI Pe

−+- - - - -

6

r e u y

(d) Find a PI controller, that results in a stable closed-loop system.

Page 205: ME 132 Reader

ME 132, Fall 2012, 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 beforeinstability occurs. Find the equation (quadratic in ω2) that ω must satisfy forthere to exist homogeneous solutions yH(t) = ejωt for some ω. The equationshould involve ω, KP , and the parameters in the plant, but not the time delay, T .

KP P

delay, T

e−+- - - -

6

r e u y

(f) For two cases of proportional control: KP = 20 and KP = 30; determine in eachcase the time delay T that will just cause instability and the frequency of theoscillations as instability is reached.

9. Let L be the transfer function of a system. Consider the diagram below.

d - d - L6−

6?

6zq

p

Let N denote the transfer function from q to z. Let S denote the transfer functionfrom q to p. Derive N and S in terms of L.

10. In the diagram below,

d dPI∫ ∫

KD

- - - - -6

6− −1

2

3

derive S, N and L at each marked location. In each case, verify (after the derivation)that

L = − N

1 +N=

1− S

S

D Nonlinear Systems

Page 206: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 198

1 Input-output Differential Equation Models

So far, we have focused our study on linear time invariant (LTI) systems. But, a greatmany 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 nonlinearsystems. Essentially, feedback control algorithms make small adjustments to the inputs basedon 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 effects 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 differential equations that relate the inputsu to the outputs y like:

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

When we have many inputs and many outputs, we will still have differential equations butthere will be more of them. We will have one differential equation for each output.

We cannot use transfer function methods for nonlinear systems. Transfer functions makesense only of linear time-invariant differential equations.

2 State-space Realizations

We can rewrite nth nonlinear differential equation models as a set of n coupled first-orderdifferential equations. For example, consider the differential equation model

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

Define the states byx1 = y, x2 = y

We can then re-write this differential equation model as

x1 = y = x2

x2 = y = −3yy − 7 cos(y) + 4u2 + uy = −3x1x2 − 7x1 + 4u2 + ux1

y = x1

We cannot write these equations in matrix form as we did for LTI differential equations. Butnote the form of these equations:

x1 = f1(x1, x2, u) = x2

x2 = f2(x1, x2, u) = − 3x1x2 − 7x1 + 4u2 + ux1

y = h(x1, x2, u) = x1

Page 207: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 199

More generally, for a m input, p output nonlinear differential equation model, we would getequations like

x1 = f1(x1, · · · , xn, u1, · · · , um)...

...

xn = 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 thatthere 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 ofa ball of mass m suspended by an electromagnet as shown below. Let y be the positionof the ball, measured down from the base of the electromagnet. If a current u is injectedinto the coils of the electromagnet, it will produce a magnetic field which in turn exerts anupward force on the ball given by Fup = −cu2/y2. Note that the force decreases as the 1/y2

because the effect of the magnet weakens when the ball is further away, and that the forceis 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 opticallyusing light-emitting diodes with photocells.

We can then write a simple model for the motion of the ball from Newton’s second law as

my = mg − cu2

y2(D.1)

Note that this is a single-input, single-output nonlinear model. The input and output of thismodel are

Page 208: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 200

u the current injected into the magnet coilsy the position of the ball

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

m 0.15 Kg mass of ballc 0.01 Kg-m3/Coul2 magnetic coupling constant

We can convert this nonlinear input-output differential equation model to state-space bydefining the states:

x1 = y, x2 = y

We get the state-space equations:

x1 = f1(x1, x2, u) = x2

x2 = f2(x1, x2, u) = g − cu2

mx21= 10−

(u

3.87x1

)2

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 conditionx(0) = xeq and apply the constant input u(t) = ueq, t ≥ 0, then the state trajectory remainsat the equilibrium point, i.e.

x(0) = xeq, u(t) = ueq =⇒ x(t) = xeq

y

mg

upF

Figure 41: Magnetically suspended ball.

Page 209: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 201

Notice that the output function h(x, u) plays no role in finding equilibrium points. Also, weshould 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 differential 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 equilibriumpoints 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 theequilibrium value xeq. Corresponding to this equilibrium point, y(t) stays at its equilibriumvalue

yeq = h(xeq, ueq)

Example 2 Returning to the magnetically suspended ball example, we calculate the equi-librium points:

f(xeq, ueq) = 0 =⇒ f1(xeq1 , x

eq2 , u

eq) = 0 and f2(xeq1 , x

eq2 , u

eq) = 0

=⇒ xeq2 = 0 and 10−(

ueq

3.87xeq1

)2

= 0

=⇒ xeq2 = 0, xeq1 = 0.082ueq

The equilibrium points are:

xeq1 = 0.082ζ, xeq2 = 0, ueq = ζ

The resulting value of output is

yeq = h(xeq, ueq) = xeq1 = 0.082ζ

Note that here we have many equilibrium points. in this case, we have parameterized theseequilibrium points by the free variable ueq = ζ .

We could also parameterize these equilibrium points by the free variable yeq = ξ as follows:

xeq1 = ξ, xeq2 = 0, ueq = 12.195ξ, yeq = 0.082ζ = ξ

This parametrization is sometimes more convenient when we study gain-scheduling to controlnonlinear systems.

Page 210: ME 132 Reader

ME 132, Fall 2012, 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 φ isthe row vector

∇φ(x1, · · · , xn) =[

∂φ∂x1

· · · ∂φ∂xn

]

For example for the function φ(x1, x2, x3) of three variables,

φ(x1, x2, x3) = x1x22 − 1/x1 + sin(x3)

the Jacobian is

∇φ =[

∂φ∂x1

∂φ∂x2

∂φ∂x3

]

=[x22 + 1/x21 2x1x2 cos(x3)

]

The Jacobian is a function of the variables x1, x2, x3. We can evaluate the Jacobian ata 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

φ(x) = φ(x1, x2, · · · , xn) =

φ1(x1, · · · , xn)...

φm(x1, · · · , xn)

The Jacobian of φ is the m× n matrix of functions

∇φ =

∂φ1∂x1

· · · ∂φ1∂xn

... · · · ...∂φ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

· · · ∂φ1∂xn

... · · · ...∂φm∂x1

· · · ∂φm∂xn

For example, consider the function

φ(x1, x2, x3) =

[φ1(x1, x2, x3)φ2(x1, x2, x3)

]

=

[x1 sin(x2)x22 cos(x3)

]

Page 211: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 203

The Jacobian of φ(x) evaluated at (1, 1, 0) is

∇φ(x1, x2, x3) =[sin(x2) x1 cos(x2) 0

0 2x2 cos(x3) x22 sin(x3)

]

@(1,π/2,0)

=

[1 1 00 π 0

]

Analogous to the classical Taylor series expansion of a scalar function of one variable, wecan 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 thereforeapproximate φ 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 plantmodel. This approximation is called the Jacobian Linearization and is good as long as theapplied 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 differential equation modelrealized as

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

Let ξ = (xeq, ueq) be an equilibrium point of this model, and define yeq = h(xeq, ueq).Define the deviation variables

δx = x− xeq

δu = u− ueq

δy = y − yeq

and compute the matrices

A =

∂f1∂x1

· · · ∂f1∂xn

... · · · ...∂fn∂x1

· · · ∂fn∂xn

B =

∂f1∂u1

· · · ∂f1∂um

... · · · ...∂fn∂u1

· · · ∂fn∂um

C =

∂h1∂x1

· · · ∂h1∂xn

... · · · ...∂hp∂x1

· · · ∂hp∂xn

D =

∂h1∂u1

· · · ∂h1∂um

... · · · ...∂hp∂u1

· · · ∂hp∂um

Page 212: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 204

Then, we can approximate the nonlinear system in the vicinity of the equilibrium point bythe linear time-invariant state space realization

˙δx(t) = Aδx(t) +Bδu(t)δy(t) = Cδx(t) +Dδu(t)

Proof: The basic tool we use to prove this result is the Taylor theorem. We can approximatef in a neighborhood of ξ as

f(x, u) ≈ f(xeq, ueq) +∇f(ξ)([

xu

]

−[

xeq

ueq

])

=

∂f1∂x1

· · · ∂f1∂xn

... · · · ...∂fn∂x1

· · · ∂fn∂xn

(x− xeq) +

∂f1∂u1

· · · ∂f1∂um

... · · · ...∂fn∂u1

· · · ∂fn∂um

(u− ueq)

= A(x− xeq) +B(u− ueq)

In a similar fashion we can approximate g in a neighborhood of ξ as

h(x, u) ≈ h(xeq, ueq) +∇h(ζ)([

xu

]

−[xeq

ueq

])

= yeq +

∂h1∂x1

· · · ∂h1∂xn

... · · · ...∂hp∂x1

· · · ∂hp∂xn

(x− xeq) +

∂h1∂u1

· · · ∂h1∂um

... · · · ...∂hp∂u1

· · · ∂hp∂um

(u− ueq)

= yeq + C(x− xeq) +D(u− ueq)

Let us now define the deviation variables δx = x − xeq, δu = u − ueq, and δy = y − yeq.Observe that

˙δx = x = f(x, u) ≈ Aδx+ Bδu, δy = h(x, u)− yeq ≈ Cδx+Dδu

Thus, the original nonlinear system can be approximated by a linear time-invariant system.This approximation is good provided we remain sufficiently 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 dynamicsabout the equilibrium point

xeq =

[ξ0

]

ueq = 12.195ξ yeq = ξ

Page 213: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 205

ueq yeq

u NonlinearPlant

y u LinearizedPlant

y+− δu δy+−

Figure 42: Nonlinear Plant and its Linearized Approximation.

Define the deviation variables x = x− xeq, u = u − ueq, and y = y − yeq. We calculate thematrices

A =

[∂f1∂x1

∂f1∂x2

∂f2∂x1

∂f2∂x2

]

@eq

=

[0 1

76.86ξ

0

]

B =

[∂f1∂u∂f2∂u

]

@eq

=

[0

6.31ζ

]

C =[

∂h∂x1

∂h∂x2

]

@eq= [ 1 0 ] D =

[∂h∂u

]

@eq= 0

Then, the nonlinear system can be approximated by the linear time-invariant state spacerealization

˙δx(t) = Aδx(t) +Bδu(t)δy(t) = Cδx(t) +Dδu(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 locallythe nonlinear system is unstable. Small deviations from the equilibrium point will send theball 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 thisplant model, and find the Jacobian linearization H(s) of the plant about this equilibriumpoint. Now we have a LTI “plant” model, and we can use the state-space methods or PIDmethods to design a controller K(s) for the linearized plant model H(s). This feedbacksystem is shown in Figure 43. The command for this feedback system is δr(t). This signalis what we want the linearized plant output δy(t) to track, and this is what the controllerK(s) is designed to do.

Let us figure out what δr(t) should be. We want the output of the nonlinear plant y(t) totrack 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) − yeq, this implies that we wanty(t) to track r(t)− yeq. Therefore, we should choose

r(t) = r(t)− yeq

Page 214: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 206

H(s) δy(t)

K(s) δr(t)

δu

−+

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 modelH(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 nonlinearphysical plant P . If we examine the controller K(s) in isolation, its input is r(t)− yeq. Theoutput of the controller is u(t). Notice that δu(t) = u(t)−ueq. so we can generate the inputto 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 equilibriumpoint (ueq, xeq). The linearized model is a good approximation of the plant as long as westay close to this equilibrium point. This means that the controller will work well as long asthe 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.

Page 215: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 207

8 Gain Scheduling

In many situations, we cannot be assured that we will stay close to a particular equilibriumpoint of a nonlinear plant during control maneuvers. To effectively control the nonlinearplant we will need to design controllers at many equilibrium points (also called operatingpoints) and switch between these controller in an intelligent way. This control strategy iscalled 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 parameterizeequilibrium points of the nonlinear system to be controlled using the free variable yeq = ξ.So the equilibrium points look like:

xeq = a(ξ), ueq = b(ξ), yeq = ξ

Here a and b are functions of the variable ξ. We will refer to the equilibrium point abovesimply as ξ.

Next, we can linearize the nonlinear plant about the equilibrium point ξ. We will get alinearized model

˙δx(t) = Aδx(t) +Bδu(t)δy(t) = Cδx(t) +Dδu(t)

The matrices A,B,C,D clearly depend on the equilibrium point and so they are functionsof ξ. Now we can design controllers based on these linearized models. This is just whatwe did in the previous section, only this time we have a continuous family of equilibriumpoint parameterized by ξ. So the controller designed at the equilibrium point ξ might havea state-space realization

K(s) ∼[F ξ Gξ

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)

Page 216: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 208

This implementation of controller K(s) for the nonlinear plant is shown in Figure 45. Nowlet us write this more carefully. Let z(t) denote the state of the controller. We can write(D.3) as

z(t) = F ξz(t) +Gξ(r(t)− y(t))u(t) = Hξz(t) + ueq(ξ)

Again, we stress that the matrices F,G,H depend on ξ. Recall that ξ is the equilibriumpoint used to design the controller. A natural choice for ξ is to set ξ = y(t) which is thecurrent output of the nonlinear plant. This is the closest equilibrium point to where theplant is now. So our final controller implementation is

z(t) = F yz(t) +Gy(r(t)− y(t))

u(t) = Hyz(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 magneticallysuspended ball, if we gave a command that attempted to change the position of the ballabruptly from 0.25 meters to 0.5 meters, we are asking the ball to move very fast (largespeed) from one position to the other. At no point would the ball be anywhere “near” anequilibrium point. This is because at all the equilibria, the speed of the ball is zero. Byslowing down the command, we are allowing the ball to move slowly from one position tothe other, and it stays close to equilibrium points.

9 Feedback Linearization

A powerful technique for treating nonlinear systems in the context of control problems isfeedback 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 wehave studied earlier. These ideas are illustrated in Figure 47.

By setting u = φ(v, y), we are essentially building an “input-redefining box” that has newinputs 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.

Page 217: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 209

vStatic Nonlinear-ityφ(v, y)

u NonlinearPlant

y

feedback linearized system

Figure 47: Feedback Linearization.

Example 5 Consider again the magnetically suspended ball. If we set

u = φ(y, v) = y

m(g + v)

c

we obtain the linear time-invariant model

x1 = x2, x2 = v, y = x1

Many nonlinear systems are not output feedback linearizable. Sometimes, if we have thestates (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 thismodel is inaccurate, the nonlinearity will not “cancel” exactly. It is therefore critical tounderstand the robustness of this technique with respect to plant modeling errors.

Page 218: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 210

E Complex Arithmetic

1 Basic Stuff

The set of real numbers is written R, and the set of complex numbers is written as C. Fora complex number z = a + jb, a is called the real part of z, written Re(z), and b is calledthe imaginary part of z, written Im(z). The complex-conjugate of z is the complex numberz = 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 fourthquadrant (i.e. a > 0), its phase is ∠z = Tan−1(b/a). Here Tan−1 is the principal branch ofthe inverse tangent function, i.e. the branch whose range is restricted to −π/2 < Tan−1(y) ≤π/2.

For products of complex numbers we have

|z1z2| = |z1||z2| ∠(z1z2) = ∠z1 + ∠z2

For ratios of complex numbers we have (if z1 6= 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 writtenin polar form as

z = |z| exp(j∠z)

Once we write a nonzero complex number z in polar form as above, we can naturally defineits (natural) logarithm as

ln z = ln |z|+ j∠z

Page 219: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 211

Note that because z 6= 0, the logarithm ln |z| is well-defined. We can also define square-rootsof a complex number z as √

z =√

|z| exp(j∠z)/2)

4 Polynomials

We shall also need the following fact: any polynomial of degree n

p(s) = pnsn + pn−1s

n−1 + · · ·+ p1s+ p0

has exactly n roots in the complex plane. This is called the Fundamental Theorem ofAlgebra. While it has become common knowledge, it is actually quite difficult to prove.

If the coefficients of the polynomial are all real, i.e. pi ∈ R, then the roots of p(s) occur inconjugate-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) < 0the 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 writtenS. 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

Page 220: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 212

2) Plot the log-magnitude and phase of the complex number

H(jω) =a

jω + b

versus logω as ω varies from 0 to ∞ in the following cases.

(a) a = 1, b = 3

(b) a = −1, b = 3

(a) a = 1, b = −3

(b) a = 1, b = 3

3) Plot the log-magnitude and phase of the complex number

H(jω) = exp(−jωT )

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 ?

Page 221: ME 132 Reader

ME 132, Fall 2012, 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 areintimately familiar. As we shall see, Linear Algebra allows us to generalize these conceptsto 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. Weadd vectors component-wise.

The set of all m× n rectangular matrices of real numbers is written Rm×n. The element inthe ith row and jth column of a matrix M is written as mij . Similarly, we have the set Cm×n.The n × n matrix whose diagonal elements are 1 and whose other elements are all 0 is theidentity 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 6= BA. So we must be careful to respect theorder in expressions with matrices. Indeed, if v ∈ Cn, v∗v is a real number, while vv∗ is ann× n matrix.

It is very useful to think of matrices in terms of their columns (or rows). For example, theproduct

Av =

[a11 a12 a13a21 a22 a23a31 a32 a33

][v1v2v3

]

= v1

[a11a21a31

]

+ v2

[a12a22a32

]

+ v3

[a13a23a33

]

=3∑

i=1

via[i]

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

A =

a11 a12 a13 b12 b13a21 a22 a23 a12 a13a31 a32 a33 a12 a13a31 a32 a33 a12 a13

=

[A11 A12

A21 A22

]

Multiplication of block-partitioned matrices is as one would expect.

AB =

[A11 A12

A21 A22

] [B11 B12

B21 B22

]

=

[A11B11 + A12B21 A11B12 + A12B22

A21B11 + A22B21 A21B12 + A22B22

]

This, of course, requires A and B to be partitioned conformably, i.e. so that the variousproducts make sense. For example, in the equation above we would need A11 to have asmany columns as B11 has rows.

Page 222: ME 132 Reader

ME 132, Fall 2012, 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 explicitlystate the dimensions of the matrices involved. The reader should assume that the resultshold only when the matrices have appropriately sensible dimensions. For example supposewe write A−1 in the statement of some Theorem. It will imply we are assuming that A issquare and invertible. Or if we write the expression I + AB in some lemma, it must implythat 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 = 43x2 − 4x3 = 85x1 − 6x2 = 9x3 = −1

⇐⇒

1 2 70 3 −45 −6 00 0 1

[x1x2x3

]

=

489−1

⇐⇒ Ax = b

Any collection of linear equations can be written as

Ax = b A ∈ Cm×n

Here x is the vector of n unknowns, and A, b are constructed from the coefficients of the mequations. 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 ∈ Cm×n.

The transpose of A written AT is an n×m matrix whose i, jth 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∗

Page 223: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 215

4 Determinants and Inverses

Definition 3 Let A ∈ Cn×n.

The inverse of A is the unique matrix A−1 such that AA−1 = 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) AA−1 = A−1A = I

(b) (AB)−1 = B−1A−1

(c) (A∗)−1 = (A−1)∗

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

[X Y0 Z

]−1

=

[X−1 −X−1Y Z−1

0 Z−1

]

(b) If A and D are square, and D is invertible, then[A BC D

]

=

[

A− BD−1C BD−1

0 I

] [I 0C D

]

(c) Suppose A and D are square. If D and ∆ = A− BD−1C are invertible, then

[A BC D

]−1

=

[∆−1 −∆−1BD−1

−D−1C∆−1 D−1C∆−1BD−1 +D−1

]

Page 224: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 216

Corollary 7 (Determinants for Block-partitioned Matrices.)

(a) If X and Z are square, then

det

[

X Y0 Z

]

= det(X) det(Z)

(b) If A and D are square, and D is invertible, then

det

[A BC D

]

= det(A−BD−1C

)det(D)

5 Eigenvalues and Eigenvectors

Definition 8 Let A ∈ Cn×n. The characteristic polynomial of A written

χA(s) = det(sI −A) = sn + αn−1s

n−1 + · · ·+ α1s1 + α0s

0

The roots of χA(s) of which there are n are called the eigenvalues of A.

Lemma 9 Let A ∈ Cn×n and λ be an eigenvalue of A. Then, there exists a vector v 6= 0such 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 6= 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 sameeigenvalue. We view an eigenvector as a vector whose direction is invariant under the actionof A. In the context of this interpretation, we regard all (nonzero) scalar multiples of aneigenvector 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 apathology may arise in that we are unable to find a full set of eigenvectors.

Page 225: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 217

6 Simple-case of the Jordan form

Let A ∈ Cn×n be a (square!) matrix. We can think of A as a box. Vectors u ∈ Cn go in, andvectors y = Au ∈ Cn come out. For example, the box could mean “rotate vector coming inby 30 clockwise to produce a new vector”.

We can change coordinates by the transformation

xT x or x = T−1x

where T ∈ Cn×n is an invertible matrix. The box does the same thing – it hasn’t changed.

But in these new coordinated, the matrix describing the box changes as follows to A. Wecan find this new matrix easily:

y = Au =⇒ y = T−1y = T−1Au = T−1ATu

So the action of the matrix A in the new coordinates is represented by the matrix

A = T−1AT

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 hasparticularly lucid structure. Equivalently, we wish to select a nonsingular matrix T in orderthat T−1AT 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 ∈ Cn×n be simple with eigenvalues λi and corresponding eigenvectorsvi, for i = 1, · · · , n. Define the n× n matrices

T = [ v1 · · · vn ] , Λ =

λ1 0 · · · 00 λ2 · · · 0...

... · · · ...0 0 · · · λn

Then,

(a) The eigenvectors v1, · · · , vn are linearly independent, i.e. T is invertible.

(b) T−1AT = Λ

Proof. (a) We will use contradiction. Suppose v1, · · · , vn are linearly dependent. Then oneof these vectors can be expressed as a linear combination of the remaining vectors. Withoutloss of generality, we can write

v1 =

n∑

2

αkvk (F.1)

Page 226: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 218

Suppose Av = λv. Define the matrix

M = (λ2I −A)(λ3I −A) · · · (λnI −A)

and consider the expression:

Mv = (λ2I −A)(λ3I −A) · · · (λn−1I −A)(λn − λ)v

= (λ2I −A)(λ3I −A) · · · (λn−2I −A)(λn−1 − λ)(λn − λ)v

= (λ2 − λ)(λ3 − λ) · · · (λn−2 − λ)v

Using the fact that A has distinct eigenvalues, we have

Mv1 = (λ2 − λ1)(λ3 − λ1) · · · (λn−2 − λ1)v1 6= 0

For k = 2, 3, · · · , n, we have

Mvk = (λ2 − λk)(λ3 − λk) · · · (λn−2 − λk)vk = 0

It now follows from (F.1) that

0 6=Mv1 =M

(n∑

2

αkvk

)

=n∑

2

αkMvk = 0

This is a contradiction, proving that the eigenvectors v1, · · · , vn are linearly independent.Equivalently, the matrix

T = [ v1 v2 · · · vn ] ∈ Cn×n

is invertible.

(b) Observe that

AT = [ Av1 Av2 · · · Avn ] = [ λ1v1 λ2v2 · · · λnvn ] = TΛ

Pre-multiplying by T−1 yields T−1AT = Λ, completing the proof.

Essentially, Theorem (10) states that simple matrices can be diagonalized using similaritytransformations. The matrix Λ above is called the Jordan form of A. Observe that thismatrix is diagonal and its diagonal entries are the eigenvalues of A.

Example 11 Let

A =

[

2 −31 −2

]

This matrix is simple and has eigenvalues at 1,−1 with associated eigenvectors [ 3 1 ]′and

[ 1 1 ]′. It then follows that

T−1AT =

[1 00 −1

]

, where T =

[3 11 1

]

Page 227: ME 132 Reader

ME 132, Fall 2012, UC Berkeley, F. Borrelli 219

7 Matrix Exponentials

Matrix exponentials are particularly important and arise in connection with systems of cou-pled linear ordinary differential equations. Since the Taylor series

est = 1 + st+s2t2

2!+s3t3

3!+ · · ·

converges everywhere, we can define the exponential of any matrix A ∈ Cn×n by

eAt = I + At +A2t2

2!+A3t3

3!+ · · ·

Theorem 12 (Properties of Matrix Exponentials)

(a) eA0 = I

(b) eA(t+s) = eAteAs

(c) If AB = BA then e(A+B)t = eAteBt = eBteAt

(d) det[eAt]= etrace(A)t

(e) eAt is nonsingular for all −∞ < t <∞ and[eAt]−1

= e−At

(f) eAt is the unique solution X of the linear system of ordinary differential equations

X = AX, subject to X(0) = I

Example 13 Consider the matrix

A =

[σ ω−ω σ

]

You should be able to check that

eAt = eσt[

cos(ωt) sin(ωt)− sin(ωt) cos(ωt)

]