Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering...

236
ME 132, Dynamic Systems and Feedback Class Notes by Andrew Packard, Kameshwar Poolla & Roberto Horowitz Spring 2005 Instructor: Prof. A Packard Department of Mechanical Engineering University of California Berkeley CA, 94720-1740

Transcript of Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering...

Page 1: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Dynamic Systems and Feedback

Class Notes

by

Andrew Packard, Kameshwar Poolla & Roberto Horowitz

Spring 2005

Instructor:

Prof. A Packard

Department of Mechanical Engineering

University of California

Berkeley CA, 94720-1740

Page 2: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 1

1 Introduction

In this course we will learn how to model and control engineering systems. Some examplesof systems which benefit from well-designed control systems are

• Airplanes, helicopters, rockets, missiles: flight control systems including autopilot, pilotaugmentation

• Cruise control for automobiles. Lateral/steering control systems for future automatedhighway systems

• Position and speed control of mechanical systems:

1. AC and/or DC motors, for machines, including Disk Drives/CD, robotic manip-ulators, assembly lines.

2. Elevators

3. Magnetic bearings, MAGLEV vehicles, etc.

• Pointing control (telescopes)

• Chemical and Manufacturing Process Control: temperature; pressure; flow rate; con-centration of a chemical; moisture content; thickness.

The two most basic objectives of a control system are:

• The automatic regulation (or tracking) of certain variables in the controlled plant todesired values (or trajectories), in the presence of unforseen disturbances

• The stabilization or improved stability of the controlled plant.

A key realization is the fact that most of the systems that we will attempt to model andcontrol are dynamic. We will later develop a formal definition of a dynamic system. However,for the moment it suffices to say that dynamic systems “have memory”, i.e. the presentoutput of the system is generally a function of previous inputs, as well as the current inputto the system. This means that the control actions have impact both when they are applied,and later.

Another key concept idea in this course is the use of feedback to control engineering systems.Let us briefly compared two types of control systems: open loop and closed loop.

1. Open-loop control systems: In an open-loop system, the input to the “plant” doesnot in any way depend on the current and past values of the output of the plant.

The design of the open-loop controller is based on “inversion.” In some sense, thecontroller should be an (usually electrical) inverse of the plant. The biggest problem

Page 3: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 2

with open-loop control systems is that they rely totally on calibration, and cannoteffectively deal with exogenous disturbances. Moreover, they cannot effectively dealwith changes in the process, due to various effects, such as aging components. Theyrequire recalibration. Essentially, they cannot deal with uncertainty. Another disad-vantage of open-loop control systems is that they cannot stabilize an unstable system,such as balancing an inverted pendulum.

2. Closed-loop control systems: In order to make the control system robust to un-certainty and disturbances, we design control systems which sense the output of thesystem, and adjust the control input, using feedback rules, which are based on how thesystem output deviates from its desired value. These feedback “rules” are based on amodel of how the system behaves. If the system behaves slightly differently than themodel, usually the feedback helps compensate for these differences. However, if thesystem actually behaves significantly different than the model, then feedback mighteven cause instability. This is a drawback of feedback systems.

1.1 Structure of a closed-loop control system

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.

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.

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.

The controlled variables are the physical quantities we are interested in controlling and/orregulating.

The reference or command is an electrical signal that represents what we would like theregulated variable to behave like.

Disturbances are phenomena that affect the behavior of the plant being controlled. Distur-bances are often induced by the environment, and often cannot be predicted in advance ormeasured directly.

The controller is a device that processes the measured signals from the sensors and thereference signals and generates the actuated signals which in turn, affects the behavior of

Page 4: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 3

the plant. Controllers are essentially “strategies” that prescribe how to process sensed signalsand reference signals in order 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 attempt to consistently use the following symbols:

P plant K controlleru input y outputd disturbance n noiser reference

Based on our discussion above, we can draw the block diagram of Figure 1 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).

Controller

SensorsPlantActuators

Disturbances

Commands

Measurement noise

Controller noise

Actuator noise

Figure 1: Basic structure of a control system.

1.2 Example: Temperature Control in Shower

A simple, slightly unrealistic example of some important issues in control systems is theproblem of temperature control in a shower.

The components which make up the plant in the shower are

Page 5: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 4

• Hot water supply (constant temperature, TH)

• Cold water supply (constant temperature, TC)

• Adjustable valve that mixes the two; use θ to denote the angle of the valve, with θ = 0meaning equal amounts of hot and cold water mixing. In the units chosen, assumethat −1 ≤ θ ≤ 1 always holds.

• 1 meter (or so) of piping from valve to shower head

If we assume perfect mixing, then the temperature of the water just past the valve is

Tv(t) := TH+TC

2+ TH−TC

2θ(t)

= c1 + c2θ(t)

The temperature of the water hitting your skin is the same (roughly) as at the valve, butthere is a time-delay based on the fact that the fluid has to traverse the piping, hence

T (t) = Tv(t− ∆)= c1 + c2θ(t− ∆)

where ∆ is the time delay, about 1 second.

Let’s assume that the valve position only gets adjusted at regular increments, every ∆seconds. Similarly, lets assume that we are only interested in the temperature at thoseinstants as well. Hence, we can use a discrete notion of time, indexed by a subscript k, sothat for any signal, v(t), write

vk := v(t)|t=k∆

In this notation, the model for the Temperature/Valve relationship is

Tk = c1 + c2θk−1 (1)

Now, taking a shower, you have a desired temperature, Tdes, which may even be a functionof time Tdes,k. How can the valve be adjusted so that the shower temperature approachesthis?

Open-loop control: pre-solve for what the valve position should be, giving

θk =Tdes,k − c1

c2(2)

and use this – basically calibrate the valve position for desired temperature. This gives

Tk = Tdes,(k−1)

which seems good, as you achieve the desired temperature one ”time-step” after specifyingit. However, if c1 and/or c2 change (hot or cold water supply temperature changes, or valve

Page 6: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 5

gets a bit clogged) there is no way for the calibration to change. If the plant behavior changesto

Tk = c1 + c2θk−1 (3)

but the control behavior remains as (2), the overall behavior is

Tk+1 = c1 +c2c2

(Tdes,k − c1)

which isn’t so good. Any percentage variation in c2 is translated into a similar percentageerror in the achieved temperature.

How do you actually control the temperature when you take a shower: Again, the behaviorof the shower system is:

Tk+1 = c1 + c2θk

Closed-loop Strategy: If at time k, there is a deviation in desired/actual temperatureof Tdes,k − Tk, then since the temperature changes c2 units for every unit change in θ, thevalve angle should be increased by an amount 1

c2(Tdes,k − Tk). That might be too aggressive,

trying to completely correct the discrepancy in one step, so choose a number λ, 0 < λ < 1,and try

θk = θk−1 +λ

c2(Tdes,k − Tk) (4)

(of course, θ is limited to lie between −1 and 1, so the strategy should be written in a morecomplicated manner to account for that - for simplicity we ignore this issue here, and returnto it later in the course). Substituting for θk gives

1

c2(Tk+1 − c1) =

1

c2(Tk − c1) +

λ

c2(Tdes,k − Tk)

which simplifies down toTk+1 = (1 − λ)Tk + λTdes,k

Starting from some initial temperature T0, we have

T1 = (1 − λ)T0 + λTdes,0

T2 = (1 − λ)T1 + λTdes,1

= (1 − λ)2T0 + (1 − λ)λTdes,0 + λTdes,1... =

...Tk = (1 − λ)kT0 +

∑k−1n=0(1 − λ)nλTdes,k−1−n

If Tdes,n is a constant, T , then the summation simplifies to

Tk = (1 − λ)kT0 +[

1 − (1 − λ)k]

T

= T + (1 − λ)k[

T0 − T]

which shows that, in fact, as long as 0 < λ < 2, then the temperature converges (convergencerate determined by λ) to the desired temperature.

Page 7: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 6

Assuming your strategy remains fixed, how do unknown variations in TH and TC affect theperformance of the system? Shower model changes to (3), giving

Tk+1 =(

1 − λ)

Tk + λTdes,k

where λ := c2c2λ. Hence, the deviation in c1 has no effect on the closed-loop system, and the

deviation in c2 only causes a similar percentage variation in the effective value of λ. As longas 0 < λ < 2, the overall behavior of the system is acceptable. This is good, and showsthat small unknown variations in the plant are essentially completely compensated for bythe feedback system.

On the other hand, large, unexpected deviations in the behavior of the plant can causeproblems for a feedback system. Suppose that you maintain the strategy in equation (4),but there is a longer time-delay than you realize? Specifically, suppose that there is extrapiping, so that the time delay is not just ∆, but m∆. Then, the shower model is

Tk+m−1 = c1 + c2θk−1 (5)

and the strategy (from equation 4) is θk = θk−1 + λc2

(Tdes,k − Tk). Combining, gives

Tk+m = Tk+m−1 + λ (Tdes,k − Tk)

This has some very undesirable behavior, which is explored in problem 4 at the end of thesection.

1.3 Problems

1. In this class, we will deal with differential equations having real coefficients, and realinitial conditions, and hence, real solutions. Nevertheless, it will be useful to usecomplex numbers in certain calculations, simplifying notation, and allowing us to writeonly 1 equation when there are actually two. Recall that if γ is a complex number,

then |γ| =√

γ2R + γ2

I , where γR := Real(γ) and γI := Imag(γ). If γ 6= 0, then the angleof γ, denoted 6 γ, satisfies

cos 6 γ =γR

|γ| , sin 6 γ =γI

|γ|

and is uniquely determinable from γ (only to within an additive factors of 2π).

(a) Draw a 2-d picture (horizontal axis for Real part, vertical axis for Imaginary part)

(b) Suppose A and B are complex numbers. Using the numerical definitions above,carefully derive that

|AB| = |A| |B| , 6 (AB) = 6 A + 6 B

Page 8: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 7

2. For any β ∈ C and integer N , consider the summation

α :=N∑

k=0

βk

If β = 1, show that α = N + 1. If β 6= 1, show that

α =1 − βN+1

1 − β

If |β| < 1, show that∞∑

k=0

βk =1

1 − β

3. Consider the difference equation

pk+1 = αpk + βuk (6)

with the following parameter values, initial condition and terminal condition:

α =(

1 +R

12

)

, β = −1, uk = M for all k, p0 = L, p360 = 0 (7)

where R,M and L are constants.

(a) In order for the terminal condition to be satisfied (p360 = 0), the quantities R,Mand L must be related. Find that relation. Express M as a function of R and L,M = f(R,L).

(b) Is M a linear function of L (with R fixed)? If so, express the relation as M =g(R)L, where g is a function you can calculate.

(c) Note that the function g is not a linear function of R. Calculate

dg

dR

∣∣∣∣∣R=0.065

(d) Plot g(R) and a linear approximation, defined below

gl(R) := g(0.065) + [R − 0.065]dg

dR

∣∣∣∣∣R=0.065

for R is the range 0.01 to 0.2. Is the linear approximation relatively accurate inthe range 0.055 to 0.075?

(e) On a 30 year home loan of $250,000, what is the monthly payment, assuming aninterest rate of 6.75%. Hint: The amount owed on a fixed-interest-rate mortgagefrom month-to-month is represented by the difference equation in equation (6).The parameters in (7) all have appropriate interpretations.

Page 9: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 8

4. Consider the shower example. Suppose that there is extra delay in the shower’s re-sponse, but that your strategy is not modified to take this into account. We derivedthat the equation governing the closed-loop system is

Tk+m = Tk+m−1 + λ (Tdes,k − Tk)

where the time-delay from the water passing through the mixing value to the watertouching your skin is m∆. Using calculators, spreadsheets, computers (and/or graphs)or analytic formula you can derive, determine the values of λ for which the systemis stable for the following cases: (a) m = 2, (b) m = 3, (c) m = 5. Remark1: Remember, for m = 1, the allowable range for λ is 0 < λ < 2. Hint: Fora first attempt, assume that the water in the piping at k = 0 is all cold, so thatT0, T1, . . . , Tm−1 = TC , and that Tdes,k = 1

2(TH + TC). Compute, via the formula, Tk

for k = 0, 1, . . . , 100 (say), and plot the result.

5. Given a complex number G, and a real number θ, show that (here, j :=√−1)

Re(

Gejθ)

= |G| cos (θ + 6 G)

6. Given a real number ω, and real numbers A and B, show that

A sinωt+B cosωt =(

A2 +B2)1/2

sin (ωt+ φ)

for all t, where φ is an angle that satisfies

cos φ =A

(A2 +B2)1/2, sinφ =

B

(A2 +B2)1/2

Note: you can only determine φ to within an additive factor of 2π. How are theseconditions different from saying just

tanφ =B

A

7. For a function F of a many variables (say two, for this problem, labled x and y), the“sensitivity of F to x” is defined as “the percentage change in F due to a percentagechange in x.” Denote this by SF

x . Show that for infinitesimal changes in x, thesensitivity is

SFx =

x

F (x, y)

∂F

∂x

Let F (x, y) = xy1+xy

. What is SFx .

8. Draw the block diagram for temperature control in a refrigerator. What disturbancesare present in this problem?

Page 10: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 9

2 Block Diagrams

Name Diagram Info Continuous

Gainγ- -u y

γ ∈ R y(t) = γu(t), ∀t

(example)7.2- -u y

γ = 7.2 y(t) = γu(t), ∀t

Integrator

∫- -u y

y0, t0 given y(t) = y0 +∫ tt0u(τ)dτ, ∀t ≥ t0

Integrator

∫- -u y

y0, t0 given y(t0) = y0; y(t) = u(t) ∀t ≥ t0

Static Non-linearity

Ψ- -u y

Ψ : R → R y(t) = Ψ(u(t)), ∀t

(example)sin- -u y

Ψ(·) = sin(·) y(t) = sin(u(t)), ∀t

Delaydelay, T- -u y

T ≥ 0 y(t) = u(t− T ), ∀t

Page 11: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 10

2.1 Problems

1. This question extends the example we discussed in class. Recall that the process wasgoverned by the differential equation

θ(t) = θ(t) + u(t) − d(t).

The proportional control strategy u(t) = 5 [θdes(t) − θ(t)] did a good job, but there wasroom for improvement. Consider the following strategy

u(t) = p(t) + a(t)p(t) = Ke(t)a(t) = Le(t) (with a(0) = 0)e(t) = θdes(t) − θmeas(t)

where K and L are constants. Note that the control action is made up of two termsp and a. The term p is proportional to the error, while term a’s rate-of-change isproportional to the error.

(a) Convince yourself (and me) that a block diagram for this strategy is as below (allmissing signs on summing junctions are + signs). Note: There is one minor issueyou need to consider - exchanging the order of differentiation with multiplicationby a constant...

L

K

f f- - - - -

-

?θdes

6

θmeas

u

(b) Create a Simulink model of the closed-loop system (ie., process and controller,hooked up) using this new strategy. The step functions for θdes and d should benamely

θdes(t) =0 for t ≤ 11 for 1 < t ≤ 71.4 for t > 7

, d(t) =0 for t ≤ 6−0.4 for 6 < t ≤ 110 for t > 11

Make the measurement perfect, so that θmeas = θ.

(c) Simulate the closed-loop system for K = 5, L = 9. The initial condition for θshould be θ(0) = 0. On three separate axis (using subplot, stacked vertically,all with identical time-axis so they can be “lined” up for clarity) plot θdes and dversus t; θ versus t; and u versus t.

Page 12: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 11

(d) Comment on the “performance” of this control strategy with regards to the goalof “make θ follow θdes, even in the presence of nonzero d.” What aspect of thesystem response/behavior is insensitive to d? What signals are sensitive to d,even in the steady-state?

(e) Suppose the process has up to 30% “variablity” due to unknown effects. By that,suppose that the process ODE is

θ(t) = γθ(t) + βu(t) − d(t).

where γ and β are unknown numbers, known to satisfy 0.7 ≤ γ ≤ 1.3 and 0.7 ≤β ≤ 1.3. Using for loops, and rand (this generates random numbers uniformlydistributed between 0 and 1, hence 0.7 + 0.6*rand generates a random numberuniformly distributed between 0.7 and 1.3. Simulate the system 50 times (usingdifferent random numbers for both γ and β, and plot the results on a single 3-axis (using subplot) graph (as in part 1c above). What aspect of the closed-loopsystem’s response/behavior is sensitive to the process variability? What aspectsare insensitive to the process variability?

(f) Return to the original process model. Simulate the closed-loop system for K = 5,and five values of L, 1, 3.16, 10, 31.6, 100. On two separate axis (using subplot

and hold on), plot θ versus t and u versus t, with 5 plots (the different values ofL) on each axis.

(g) Discuss how the value of the controller parameter L appears to affect the perfor-mance.

(h) Return to the case K = 5, L = 9. Now, use the “transport delay” block (foundin the Continuous Library in Simulink) so that θmeas is a delayed (in time)version of θ. Simulate the system for 3 different values of time-delay, namelyT = 0.001, 0.01, 0.1. On one figure, superimpose all plots of θ versus t for thethree cases.

(i) Comment on the effect of time-delay in the measurement in terms of affecting theregulation (ie., θ behaving like θdes.

(j) Return to the case of no measurement delay, and K = 5, L = 9. Now, use the“quantizer” block (found in the Nonlinear Library in Simulink) so that θmeas isthe output of the quantizer block (with θ as the input). This captures the effectof measuring θ with an angle encoder. Simulate the system for 3 different levels ofquantization, namely 0.001, 0.005, 0.025. On one figure, make 3 subplots (onefor each quantization level), and on each axis, graph both θ and θmeas versus t.On a separate figure, make 3 subplots (one for each quantization level), graphingu versus t.

(k) Comment on the effect of measurement quantization in terms of limiting theaccuracy of regulation (ie., θ behaving like θdes, and on the “jumpiness” of thecontrol action u).

NOTE: All of the computer work (parts 1c, 1e, 1f, 1h and 1j) should be automatedin a single, modestly documented script file. Turn in a printout of your Simulink

Page 13: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 12

diagrams (3 of them), and a printout of the script file. Also include nicely formattedfigure printouts, and any derivations/comments that are requested in the problemstatement.

Page 14: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 13

3 Modeling and Simulation

3.1 Systems of 1st order, coupled differential equations

Consider an input/output system, with m inputs (denoted by d), q outputs (denoted by e),and governed by a set of n, 1st order, coupled differential equations, of the form

x1(t)x2(t)

...xn(t)e1(t)e2(t)

...eq(t)

=

f1 (x1(t), x2(t), . . . , xn(t), d1(t), d2(t), . . . , dm(t), t)f2 (x1(t), x2(t), . . . , xn(t), d1(t), d2(t), . . . , dm(t), t)

...fn (x1(t), x2(t), . . . , xn(t), d1(t), d2(t), . . . , dm(t), t)h1 (x1(t), x2(t), . . . , xn(t), d1(t), d2(t), . . . , dm(t), t)h2 (x1(t), x2(t), . . . , xn(t), d1(t), d2(t), . . . , dm(t), t)

...hq (x1(t), x2(t), . . . , xn(t), d1(t), d2(t), . . . , dm(t), t)

(8)

where the functions fi, hi are given functions of the n variables x1, x2, . . . , xn, the m variablesd1, d2, . . . , dm and also explicit functions of t.

For shorthand, we write (79) as

x(t) = f (x(t), d(t), t)e(t) = h (x(t), d(t), t)

(9)

Given an initial condition vector x0, and a forcing function d(t) for t ≥ t0, we wish to solvefor the solutions

x(t) =

x1(t)x2(t)

...xn(t)

, e(t) =

e1(t)e2(t)

...eq(t)

on the interval [t0 , tF ], given the initial condition

x (t0) = x0.

and the input forcing function d(·).

simulink solves for this using numerical integration techniques, such as 4th and 5th orderRunge-Kutta formulae. You can learn more about numerical integration by taking Math

128. We will not discuss this important topic in detail in this class.

However, to understand in a very crude manner how ODE solvers work, consider the Eulermethod of solution. If the functions f and u are “reasonably” well behaved in x and t, thenthe solution exists, is continuous, and differentiable at all points. Hence, it is reasonablethat a Taylor series for x at a given time t will be predictive of the values of x around t.

Page 15: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 14

If we do a Taylor’s expansion on a function x, and ignore the higher order terms, we get anapproximation formula

x(t + δ) ≈ x(t) + δx(t)= x(t) + δf(x(t), d(t), t)

Roughly, the “smaller” δ is, the closer the left-hand-side is to the actual value of x(t + δ).Euler’s method propogates a solution to (79) by using this approximation repeatedly for afixed δ, called “the stepsize.” Hence, Euler’s method gives that for any integer k >= 0, thesolution to (79) approximately satisfies

x((k + 1)δ)︸ ︷︷ ︸

n×1

= x(kδ)︸ ︷︷ ︸

n×1

+ δ f(x(kδ), d(kδ), kδ)︸ ︷︷ ︸

n×1

Writing out the first 4 time steps (ie., t = 0, δ, 2δ, 3δ, 4δ) gives

x(δ) = x(0) + δf (x(0), d(0), 0)x(2δ) = x(δ) + δf (x(δ), d(δ), δ)x(3δ) = x(2δ) + δf (x(2δ), d(2δ), 2δ)x(4δ) = x(3δ) + δf (x(3δ), d(3δ), 3δ)

(10)

and so on. So, as long as you have a subroutine that can evaluate f(x, d, t), given x and t,you can quickly propogate an approximate solution simply by calling the subroutine oncefor every timestep.

Computing the output, e(t) simply involves evaluating the function h(x(t), d(t), t) at thesolution points.

In the Runge-Kutta method, a more sophisticated approximation is made, which resultsin more computations (4 function evaluations of f for every time step), but much greateraccuracy. In effect, more terms of the Taylor series are used, involving matrices of partialderivatives, and even their derivatives,

df

dx,d2f

dx2,d3f

dx3

but without actually requiring explicit knowledge of these derivatives of the function f .

3.2 Remarks about Integration Options in simulink

The Simulation → SimulationParameters → Solver page is used to set additional op-tional properties, including integration step-size options, and may need to be used to obtainsmooth plots. Additional options are

Page 16: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 15

Term Meaning

RelTol Relative error tolerance, default 1e-3, probably leave italone, though if instructions below don’t work, try mak-ing it a bit smaller

AbsTol Absolute error tolerance, default 1e-6, probably leave italone, though if instructions below don’t work, try mak-ing it a bit smaller

MaxStep maximum step size. I believe the default is (StopTime-StartTime)/50. In general, make it smaller than(StopTime-StartTime)/50 if your plots are jagged.

3.3 Problems

1. A sealed-box loudspeaker is shown below.

Voice CoilFormer

Subwoofer Electrical LeadsBasket

Sealed Enclosure

From Amplifier

Spider

Surround

Vent

Back Plate

Top Plate

Magnet

Pole Piece

Voice Coil

Woofer Cone

Dust Cap

Signal From Accelerometer

Ignore the wire marked “accelerometer mounted on cone.” We will develop a modelfor accoustic radiation from a sealed-box loudspeaker.

The equations are

• Speaker Cone: force balance,

mz(t) = Fvc(t) + Fk(t) + Fd(t) + Fb + Fenv(t)

• Voice-coil motor (a DC motor):

Vin(t) − LI(t) − RI(t) −Bl(t)z(t) = 0Fvc(t) = Bl(t)I(t)

• Magnetic flux/Length Factor:

Bl(t) =BL0

1 +BL1z(t)4

Page 17: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 16

• Suspension/Surround:

Fk(t) = −K0z(t) −K1z2(t) −K2z

3(t)Fd(t) = −RS z(t)

• Sealed Enclosure:

Fb(t) = P0A

(

1 +Az(t)

V0

)−γ

• Environment (Baffled Half-Space)

x(t) = Aex(t) +Bez(t)Fenv(t) = −AP0 − Cex(t) −Dez(t)

where x(t) is 6 × 1, and

Ae :=

−474.4 4880 0 0 0 0−4880 −9376 0 0 0 0

0 0 −8125 7472 0 00 0 −7472 −5.717 0 00 0 0 0 −3515 111240 0 0 0 −11124 −2596

Be :=

−203.4−594.2601.615.51213.6140.4

Ce :=[

203.4 −594.2 −601.6 15.51 213.6 −140.4]

De = 46.62

This is an approximate model of the impedance “seen” by the face of the loud-speaker as it radiates into an “infinite half-space.”

The values for the various constants are

Page 18: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 17

Symbol ValueA 0.1134 meters2

V0 0.17 meters3

P0 1.0133 × 105 Pam 0.117 kgL 7 × 10−4 HR 3 ΩBL0 30.7 Tesla · metersBL1 107 meters−4

K0 5380 N/meterK1 0

K3 2 × 108 N/meter3

RS 12.8 N · sec/meter

(a) Build a Simulink model for the system. Use the Subsystem grouping capabilityto manage the complexity of the diagram. Each of the equations above shouldrepresent a different subsystem. Make sure you think through the question “whatis the input(s) and what is the output(s)?” for each subsystem.

(b) Write a function that has two input arguments (denoted V and Ω) and two outputarguments, zmax,pos and zmax,neg. The functional relationship is defined as follows:Suppose Vin(t) = V sin Ω · 2πt, where t is in seconds, and V in volts. In otherwords, the input is a sin-wave at a frequency of Ω Hertz. Simulate the loudspeakerbehavior for about 25/Ω seconds. The displacement z of the cone will becomenearly sinusoidal by the end of the simulation. Let zmax,pos and zmax,neg be themaximum positive and negative values of the displacement in the last full cycle(i.e., the last 1/Ω seconds of the simulation, which we will approximately decreeas the “steady-state response to the input”).

(c) Using bisection, determine the value (approximately) of V so that the steady-state maximum (positive) excursion of z is 0.007meters if the frequency of theexcitation is Ω = 25. What is the steady-state minimum (negative) excursion ofz?

Page 19: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 18

4 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 labled “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 20: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 19

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 behavior

ym = Sy + n sensor behavioryf = Fym filtering the measurement

(11)

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 petential 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.

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,

• 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.

Page 21: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 20

• 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 (12)

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.

• 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.

Page 22: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 21

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 Goal 3 is that

1

FS≈ 1, |GC| >> 1. (13)

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 Goal 3 is that

|FS| << 1, GC ≈ 1 (14)

The requirements in (13) and (14) are completely different. Equation (13) represents afeedback strategy, and equation (14) an open-loop, calibration strategy.

4.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 +GCFS

Use T to denote T (G,C, F, S) for short, and consider two sensitivities: sensitivity of T toG, and sensitivity of T to the product FS (since F and S only enter T as a product).

Simple calculation gives

STG =

1

1 +GCFS, ST

FS =−GCFS

1 +GCFS

Note that (always!)ST

G = 1 + STFS

Hence, if one of the sensitivity measures is very small, then the other sensitivity measurewill be approximately 1. So, if T is insensitive to G, it will be sensitive to FS.

Page 23: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 22

4.2 Signal-to-Noise ratio

Ignore r, and compute the fraction y/d, as a function of d and n. Denote |n/d| as theNoise-to-Signal ratio. After simple division, we get

y

d=

1

1 + PC+

−PC1 + PC

n

d

If Noise-to-Signal ratio is large, the quotient can be made only so small, namely about 1, bychoosing C ≈ 0 (no feedback).

If Noise-to-Signal ratio is small, then by using high-gain (|PC| >> 1), the quotient madeabout equal to the Noise-to-Signal.

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

4.4 Problems

1. Use elementary algebra to derive (12) from equation (11).

2. 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.

−5 −4 −3 −2 −1 0 1 2 3 4 5−4

−3

−2

−1

0

1

2

3

4

5

φ(u)

u

Page 24: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 23

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 2a, 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 25: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 24

5 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. 2.

controllercar &

air resistance

speedometer

road

incline

desengine

pedal

actuator +

desired

measured

speed

speed

actualspeed

f

d

controlinput

u

Controlled Plant

vv

Figure 2: Cruise Control System

Page 26: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 25

5.1 Control System

5.1.1 Open-Loop Control

As stated previously, in the case of open-loop control, the control system is designed to bean inverse of the plant. For example, if the relationship between the control input u and thecar velocity v is given by a static nonlinearity P (·), so that at every t

v(t) = P (u(t))

and the desired velocity is vdes(t), then the open-loop control actions will be

u(t) = P−1(vdes(t)) ,

where P−1(·) is the inverse of the function P (·). For a level road,

v(t) = P (u(t)) = P(

P−1(vdes(t)))

= vdes(t)

which is perfect.

The biggest problem with an open-loop control systems is that it relies totally on calibration,and cannot effectively deal with external disturbances (road grade) or plant uncertainties(aerodynamic variations, condition of engine system, tire inflation). We will elaborate onthese points later.

5.1.2 Closed-Loop Control

In closed-loop control, the voltage generated by the control system depends on the measuredspeed, in addition to the desired speed. A block diagram is shown below. Note that throughfeedback, the effect of the hill is somewhat compensated for. For instance, if the system isoperating correctly on a flat road, with v(t) = vdes(t) = v, then if the car encounters a hillthe following occurs:

• Because of the hill, the speed of the car changes

• The controller, measuring the actual speed, and the desired speed, detects an error inthe speed regulation

• The controller compensates for the error by adjusting the output voltage, which movesthe throttle into a new position, compensating for the speed error

In a fully automated system, the brakes would also have to be used.

Page 27: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 26

controllercar &

air resistance

speedometer

road

incline

mes

enginepedal

actuator +

desired

measured

speed

speed

actualspeed

f

d

controlinput

u

Controlled Plant

vvdes

v

Figure 3: Cruise Control System

5.2 Steady State Conditions

In this example, we want to look at the cruise control system in the steady state. We willassume the following (all of which are realistic, but not guaranteed - see problem 10, for acounterexample, and problem 11 for a converse point-of-view) for each of the subsystems(car and controller) as well as a similar assumption for the closed-loop behavior.

For the car: If the voltage (to accelerator position device) is held constant and the slope ofthe hill is constant, the car eventually reaches a steady-state speed. This steady-statespeed is only a function of the voltage and hill-grade. It is not dependent on the pasthistory.

For the controller: If the signals into the controller go to constant values, the output volt-age of the controller eventually reaches a steady-state value. Again, this steady-statevalue depends only on the steady-state values of the signals going into the controller.

For the closed-loop: If the desired-velocity input to the controller is held fixed and theslope of the hill is fixed, the car eventually reaches a steady-state speed, and theoutput-voltage from the controller goes to a steady-state value.

In this subsection, we will see how the steady-state behavior of the controlled system can bedetermined in terms of the steady-state properties of each individual subsystem.

For simplicity, we are going to assume that the steady-state value of the car’s speed hasthe following properties

1. On a flat road, if u = 0, then v = 0

Page 28: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 27

2. A unit change in u causes P change in v. If the units of u are volts and the units of vare mph, then the units of the number P are mph/volt. For example, P = 10mph/volt.

3. Using γ to denote the road-grade angle, the force due to gravity along the directionof travel is −mg sin γ(t). Define w(t) := 100 sin γ(t) so that w represents the “percentinclination” which could vary between -100 and 100 (more realistically between -10and 10). So, w = 1 corresponds to an uphill with 1 meter rise for every 100 metersdriven. We assume that each unit change in w causes −5 mph change in v.

4. Superposition holds.

5. The measured speed is numerically equal to the actual speed, i.e. vmeas = v.

Hence, our steady-state model for the actuator/engine/drivetrain/car/hill is simply

v = Pu+Dw , (15)

where P = 10 mph/volt and D = −5 mph.

5.2.1 Open-Loop Control

Assuming a level road (i.e. w = 0), we need to design a controller which will invert theplant, without measuring v.

inputactualspeed

control

G

v

w

desiredspeed

vdes

controller

K

Controlled Plant

u

+

P+

Figure 4: Cruise Control System

We assume that the controller steady-state behavior is given by a linear relationship, u =Kvdes, as shown in Fig. 4. Using w = 0 as the design point, a good choice for the constantK is K := P−1 = 1/10, which results in the controlled system behavior

v = vdes +Dw .

Notice that if we have a 1% grade (i.e. w = 1), then

e = vdes − v = −D = 5 mph

The open-loop controller does not compensate for the hill in any manner.

Page 29: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 28

5.2.2 Closed-Loop Control

For the controller, we will assume that the steady-state behavior of the control system logicis

u = Kffvdes −Kfbv (16)

as shown in Fig. 5. What is the steady-state behavior of the controlled (closed-loop) sys-

input+

P+

desiredspeed

vdes

actualspeed

control

Gw

Controlled Plant

u

K

ff

fb

controller

v+

K-

Figure 5: Cruise Control System

tem? To determine this, we need to eliminate u from equations (15) and (16), and derive arelationship between vdes, w and v. This is simple to do. Note that

v = Pu+Dw

= P [Kffvdes −Kfbv] +Dw .

Moving all v terms to one side gives

[1 + PKfb] v = PKffvdes +Dw ,

which can be solved for v simply by dividing. This yields

v =PKff

1 + PKfb

vdes +D

1 + PKfb

w . (17)

We need to find adequate values for the control gains Kff and Kfb. To do this, recall thatthe goal is v ≈ vdes, in spite of the road grade, and possible variations in the car (P ) itself..From Eq. (17) we see that the control gains should be adjusted so that

PKff

1 + PKfb

≈ 1 (18)

and∣∣∣∣∣

D

1 + PKfb

∣∣∣∣∣< |D| . (19)

Page 30: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 29

From Eq. (19) we see that we need |1 + PKfb| > 1. In fact (from this steady state point ofview) the larger |1 + PKfb|, the better. This can be accomplished by setting

|PKfb| >> 1 . (20)

which is referred to as a high feedback loop gain. Assuming that equation (20) applies,equation (18) will be satisfied if Kff ≈ Kfb. In our numerical example, P = 10. Thus, usingKfb = 1 and Kff = 1.1, we obtain

v = vdes +−5

11w .

In this case, a 1% grade (i.e. w = 1) will cause e = vdes − v = 511

≈ 0.5 mph velocity error,which is much smaller than the 5 mph error obtained with the open-loop controller.

5.2.3 Sensitivity Analysis

We now consider the sensitivity of both open-loop and close-loop control to small changesin the plant parameters. Assume that the control system is designed for a nominal plantvalue of Pnom but that the actual plant is

P = Pnom + ∆.

Let us now define the transfer function T (P ) which relates the actual velocity v to the desiredvelocity vdes, for a given plant P . For closed-loop control, the transfer function is given by

Tcl(P ) :=PKff

1 + PKfb.

For open-loop control, the transfer function is given by

Tol(P ) := PK .

Now defining the fractional uncertainty change %P by

%P :=P − Pnom

Pnom=

Pnom,

define and calculate the sensitivity function,

S :=%T (P )

%P=

T (P )−T (Pnom)T (Pnom)

∆Pnom)

=Pnom

T (Pnom)

T (Pnom + ∆) − T (Pnom)

∆. (21)

for both the open-loop and closed-loop cases. In the limit of small deviations ∆, equation(21) becomes

S =%T (P )

%P=

Pnom

T (Pnom)

dT (P )

dP

∣∣∣∣∣P=Pnom

.

Page 31: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 30

For the open-loop system we obtain:

dTol(P )

dP

∣∣∣∣∣P=Pnom

= K Tol(Pnom) = KPnom

Sol =Pnom

KPnomK = 1 . (22)

For the closed-loop system we obtain:

dTcl(P )

dP

∣∣∣∣∣P=Pnom

=Kff

1 + PnomKfb− PnomKffKfb

(1 + PnomKfb)2

=Kff

(1 + PnomKfb)2(23)

and

Scl =Pnom

KffPnom

1+PnomKfb

Kff

(1 + PnomKfb)2

=1

1 + PnomKfb

. (24)

Thus, comparing both the open-loop with the closed-loop sensitivity transfer functions, wesee that we can make the closed-loop sensitivity much smaller by having a high feedback loopgain.

As an example, assume that Pnom = 10, P = 9, so %P = 10%. Then we have

Sol = 1 =⇒ %Tol ≈ 10%

while

Scl ≈1

11=⇒ %Tcl = Scl%P ≈ 1% .

From the discussion in these two sections, it is apparent that in order to have a small closed-loop control sensitivity to external disturbances and plant uncertainties, it is necessary tohave high feedback loop gains. Unfortunately, high feedback loop gain can lead to instability,when the control plant is dynamic. To understand the effect of dynamics in the response ofthe control system, we will now use a simple dynamic model for the car.

5.3 Dynamic Model

There are 3 forces acting on the car

Page 32: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 31

• 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 = Gw, with G = −0.01mg, where w is the percent inclination, defined asbefore, w(t) := 100 sin γ(t).

We will model the engine and aero forces as follows:

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) +Gw(t)

(25)

Eq. (25) is a first order, Linear, Time Invariant (LTI) Ordinary Differential Equation(ODE). In order to continue our discussion, we will first review the solution of first orderLTI ODEs.

5.4 Solution of a First Order LTI ODE

Consider the following system

x(t) = a x(t) + b u(t) (26)

where u is the input, x is the dependent variable, and a and b are constant coefficients.Given the initial condition x(0) = xo and an arbitrary input function u(t) defined on [0,∞),the solution of Eq. (26) is given by

xs(t) = eat xo︸ ︷︷ ︸

free resp.

+∫ t

0ea(t−τ) b u(τ) dτ

︸ ︷︷ ︸

forced resp.

. (27)

Page 33: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 32

You can derive this with the integrating factor method. We can also easily just checkthat (27) is indeed the solution of (26) by verifying two facts: the function xs satisfies thedifferential equation for all t ≥ 0; and xs satisfies the given initial condition at t = 0. Thetheory of differential equations tells us that there is one and only one function that satisfiesboth (uniqueness of solutions). To verify, first check the value of xs(t) at t = 0:

xs(0) = ea0 xo +∫ 0

0ea(t−τ) b u(τ) dτ = xo .

Taking the time derivative of (27) we obtain

xs(t) = a eat xo +d

dt

eat∫ t

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

= a eat xo + a eat∫ t

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

︸ ︷︷ ︸

axs(t)

+eate−at b u(t)

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

as desired.

5.4.1 Free response

Fig. 6 shows the normalized free response (i.e. u(t) = 0) of the solution Eq. (27) of ODE(26) when a < 0. Notice that the slope at time zero is x(0) = axo and T = 1/|a| is the time

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 50

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Nor

mal

ized

Sta

te [x

/xo]

Normalized Time [t/|a|]

Figure 6: Normalized Free response of first order system (a < 0)

Page 34: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 33

that x(t) would cross 0 if the initial slope is continued, as shown in the figure. The time

T :=1

|a|is called the time constant of a first order asymptotically stable system ( a < 0). T is anindication of how fast is the response of the system. The larger |a|, the smaller T and thefaster the response of the system.

Notice that

xfree(T )

xo

=1

e≈ .37 = 37%

xfree(2T )

xo=

1

e2≈ .13 ≈ 10%

xfree(3T )

xo=

1

e3≈ .05 = 5%

If a > 0 the free response of ODE (26) is unstable, i.e. limt→∞ |x(t)| = ∞. When a = 0,x(t) = xo and we say that this system is limitedly stable.

5.4.2 Forced response

We first consider the system response to a step input. In this case, the input u(t) is given by

u(t) = umµ(t) =

0 if t < 0um if t ≥ 0

where um is a constant and x(0) = 0. The solution (27) yields

x(t) =b

−a(

1 − eat)

um .

If a < 0, the steady state output xss is xss = b−a

um.

It is easy to show that when a < 0, then if u(t) is uniformly (in time) bounded by a positivenumber M , then the resulting solution x(t) will be uniformly bounded by bM

|a| . To derive

this, suppose that |u(τ)| ≤ M for all τ ≥ 0. Then for any t ≥ 0, we have

|x(t)| =

∣∣∣∣

∫ t

0ea(t−τ) b u(τ) dτ

∣∣∣∣

≤∫ t

0

∣∣∣ea(t−τ) b u(τ)

∣∣∣ dτ

≤∫ t

0ea(t−τ) b M dτ

≤ bM

−a(

1 − eat)

≤ bM

−a .

Page 35: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 34

Thus, if a < 0, x(0) = 0 and u(t) ≤ M , the output is bounded by x(t) ≤ |bM/a|. This iscalled a bounded-input, bounded-output (BIBO) system. If the initial condition is non-zero,the output x(t) will still be bounded since the magnitude of the free response monotonicallyconverges to zero, and the response x(t) is simply the sum of the free and forced responses.Note: The system is not bounded-input/bounded-output when a ≥ 0.

5.4.3 Sinusoidal Response

Consider the linear dynamical system

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

(28)

We assume that A,B,C and D are scalars (1 × 1).

If the system is stable, (ie., A < 0) it is “intuitively” clear that if u is a sinusoid, then y willapproach a steady-state behavior that is sinusoidal, at the same frequency, but with differentamplitude and phase. In this section, we make this idea precise.

Take ω ≥ 0 as the input frequency, and (although not physically relevant) let u be a fixedcomplex number and take the input function u(t) to be

u(t) = uejωt

for t ≥ 0. Then, the response is

x(t) = eAtx0 +∫ t0 e

A(t−τ)Bu(τ)dτ= eAtx0 + eAt

∫ t0 e

−AτBuejωτdτ= eAtx0 + eAt

∫ t0 e

(jω−A)τdτBu(29)

Now, since A < 0, regardless of ω, (jω − A) 6= 0, and we can solve the integral as

x(t) = eAt

[

x0 −Bu

jω − A

]

+B

jω − Aejωt (30)

Hence, the output y(t) = Cx(t) +Du(t) would satisfy

y(t) = CeAt

[

x0 −Bu

jω − A

]

+

[

D +CB

jω − A

]

uejωt

In the limit as t → ∞, the first term decays to 0 exponentially, leaving the steady-stateresponse

yss(t) =

[

D +CB

jω − A

]

uejωt

Hence, we have verified our initial claim – if the input is a complex sinusoid, then the steady-state output is a complex sinusoid at the same exact frequency, but “amplified” by a complexgain of

[

D + CBjω−A

]

.

Page 36: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 35

The function G(jω)

G(jω) := D +CB

jω − A(31)

is called the frequency response of the system in (99). Hence, for stable, first-order systems,we have proven

u(t) := uejωt ⇒ yss(t) = G(jω)uejωt

G can be calculated rather easily using a computer, simply by evaluating the expression in(100) at a large number of frequency points ω ∈ R.

What is the meaning of a complex solution to the differential equation (99)? Suppose thatfunctions u, x and y are complex, and solve the ODE. Denote the real part of the functionu as uR, and the imaginary part as uI (similar for x and y). Then, for example, xR and xI

are real-valued functions, and for all t x(t) = xR(t) + jxI(t). Differentiating gives

dx

dt=dxR

dt+ j

dxI

dt

Hence, if x, u and y satisfy the ODE, we have (dropping the (t) argument for clarity)

dxR

dt+ j dxI

dt= A (xR + jxI) +B (uR + juI)

yR + jyI = C (xR + jxI) +D (uR + juI)

But the real and imaginary parts must be equal individually, so exploiting the fact that thecoefficients A,B,C and D are real numbers, we get

dxR

dt= AxR +BuR

yR = CxR +DuR

anddxI

dt= AxI +BuI

yI = CxI +DuI

Hence, if (u, x, y) are functions which satisfy the ODE, then both (uR, xR, yR) and (uI , xI , yI)also satisfy the ODE.

Finally, we need to do some trig/complex number calculations. Suppose that H ∈ C is notequal to zero. Recall that 6 H is the real number (unique to within an additive factor of 2π)which has the properties

cos 6 H =ReH

|H| , sin 6 H =ImH

|H|

Page 37: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 36

Then,

Re(

Hejθ)

= Re [(HR + jHI) (cos θ + j sin θ)]

= HR cos θ −HI sin θ

= |H|[

HR

|H| cos θ − HI

|H| sin θ]

= |H| [cos 6 H cos θ − sin 6 H sin θ]= |H| cos (θ + 6 H)

Im(

Hejθ)

= Im [(HR + jHI) (cos θ + j sin θ)]

= HR sin θ +HI cos θ

= |H|[

HR

|H| sin θ + HI

|H| cos θ]

= |H| [cos 6 H sin θ + sin 6 H cos θ]= |H| sin (θ + 6 H)

Now consider the differential equation/frequency response case. Let G(ω) 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) = |G(ω)| cos (ωt+ 6 G(ω))

A similar calculation holds for sin, and these are summarized below.

Input Steady-State Output1 G(0) = D − CB

A

cosωt |G(ω)| cos (ωt+ 6 G(ω))sinωt |G(ω)| sin (ωt+ 6 G(ω))

5.5 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 (25). Suppose that u(t)is constant, at u, and w(t) is constant, w. The steady-state velocity of the car is just

v =E

αu +

G

αw

which is of the simple form (with P := Eα, D := G

α) as proposed back in equation (15).

5.5.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

Page 38: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 37

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) +

G

mw(t) . (32)

5.5.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 similar to Eq. (16) , which was used for the steady state model.

u(t) = Kffvdes(t) −Kfbv(t)

The block diagram of the control system is shown in Fig. 7

inputdesiredspeed

vdes

+

actualspeed

v

control

Vehiclew

u

K

ff

fb

controller

+

K-

G

+

E1

+

-dt

α

m

m

df

Figure 7: Cruise Closed-Loop Control System

Plugging this control law into the car model (25) gives

v(t) = − α

mv(t) +

E

m[Kffvdes(t) −Kfbv(t)] +

G

mw(t)

= −α + EKfb

mv(t) +

EKff

mvdes(t) +

G

mw(t) . (33)

Page 39: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 38

5.5.3 Open/Closed Loop Comparison

Equations (32) and (33) 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, similar to equation (26).

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

α+ EKfb

vdes +1

α + EKfb

dF

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.

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 andG = −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

Page 40: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 39

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

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

5.6 Integral Control

The car is governed bymv(t) = −αv(t) + Eu(t) +Gw(t)

Page 41: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 40

For a given constant value of vdes, w, the ideal steady-state input u is

u :=α

Evdes −

G

α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 instantaneousdesired 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:

u(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

u(t) = u(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 on the board.

Page 42: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 41

Copy it here for further reference.

The equation for the car is as before

v(t) =1

m[−αv(t) + Eu(t) +Gw(t)]

The equations for the controller are

z(t) = vdes(t) − v(t)u(t) = KIz(t)

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 u and z from the equations.This is done as follows - differentiate the car equation model, yielding

v(t) =1

m[−αv(t) + Eu(t) +Gw(t)] (34)

Now u appears, but this is known from the controller equations. In fact

u(t) = KI z(t)= KI [vdes(t) − v(t)]

Substitute this into (34) to yield

v(t) =1

m[EKI (vdes(t) − v(t)) − αv(t) +Gw(t)]

which can be manipulated into the form

v(t) +α

mv(t) +

EKI

mv(t) =

EKI

mvdes(t) −

G

mw(t) (35)

Page 43: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 42

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, G = 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.

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

Page 44: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 43

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.

Why is the response so sluggish and/or oscillatory? We need to study differential equationsmore carefully, as these types of responses were not possible with 1st order systems.

5.7 Problems

1. Work out the integral in the last line of equation (29), deriving equation (30).

2. Use the integrating factor method to derive the solution given in equation (27) to thedifferential equation (26).

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

y(t) = ay(t) + bu(t)

where a and b are some fixed numbers.

(a) If the time constant is τ > 0, and the steady-state gain is γ, solve for a and b interms of τ and γ, Also solve for τ and γ in terms of a and b.

(b) Suppose τ = 1, γ = 2. Give the initial condition y(0) = 4, and the input signal u

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 <∞.

Sketch a reasonably accurate graph of y(t) for t ranging from 0 to 20. The sketchshould be based on your understanding of a first-order system’s response, not bydoing any particular integration.

(c) Now suppose τ = 0.001, γ = 2. Give the initial condition y(0) = 4, and the inputsignal 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 y(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” aspart b?

Page 45: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 44

4. Consider the car model, equation (25). 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)

5. For the first-order linear system (constant coefficients a, b, and c)

x(t) = ax(t) + bu(t)y(t) = cx(t)

find the output y(t) for t ≥ 0 starting from the initial condition x(0) = 0, subject toinput

• u(t) = 1 for t ≥ 0

• u(t) = sin(ωt) for t ≥ 0

Plot y(t) versus t for the following cases:

(a) a = −1, b = 1, c = 1, x(0) = 0, u(t) = 1 for t ≥ 0

(b) a = −10, b = 10, c = 1, x(0) = 0, u(t) = 1 for t ≥ 0

(c) a = −1, b = 1, c = 1, x(0) = 0, u(t) = sin(0.1 ∗ t) for t ≥ 0

(d) a = −10, b = 10, c = 1, x(0) = 0, u(t) = sin(0.1 ∗ t) for t ≥ 0

(e) a = −1, b = 1, c = 1, x(0) = 0, u(t) = sin(t) for t ≥ 0

(f) a = −10, b = 10, c = 1, x(0) = 0, u(t) = sin(t) for t ≥ 0

(g) a = −1, b = 1, c = 1, x(0) = 0, u(t) = sin(10 ∗ t) for t ≥ 0

(h) a = −10, b = 10, c = 1, x(0) = 0, u(t) = sin(10 ∗ t) for t ≥ 0

Page 46: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 45

Put cases (a), (b) on the same graph, cases (c), (d) on the same graph, cases (e), (f)on the same graph and cases (g), (h) on the same graph. Also, on each graph, alsoplot u(t). Pick duration so that the limiting behavior is clear, but not so large thatthe graph is cluttered. Be sure and get the steady-state magnitude and phasing of theresponse y (relative to u) correct.

6. With regards to your answers in problem 5,

(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?

7. 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 47: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 46

ω 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(ω))

(h) Let G denote the complex function representing the frequency response (forcing-frequency-dependent amplitude magnification A and phase shift φ, combined into

Page 48: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 47

a complex number) of the cascaded system. How is G related to G1 and G2?Hint: Remember that for complex numbers G and H,

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

8. The closed-loop cruise control system equations are given in equation (33). Modify theequations 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 Section5.5.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?

(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 8f 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.

Page 49: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 48

|Gvdes→u|

6 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 graphsconverge 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”

Page 50: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 49

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 8o?

One aspect to understanding the performance of closed-loop systems is getting com-fortable with the relations between frequency responses and time responses.

9. 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∫ t

0a(ξ)dξxo +

∫ t

0e∫ t

τa(ξ)dξb(τ)u(τ)dτ

10. 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)]

(36)

(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.

Page 51: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 50

(d) Now check your answer in part 10c. Suppose y(0) = 0, and r(t) = 1 =: r for allt ≥ 0. Eliminate u from the equations 36, and determine y(t) for all t. Make asimple graph. Does the result agree with your answer in part 10c?

Lesson: since the assumption we made in part 10c was actually not valid, the analysisin part 10c 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.

11. 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)]

(37)

(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 37, 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.

Page 52: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 51

12. 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)

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 := 1

G, 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 12(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 12(d)iv surprising?

vi. Comment on the steady-state gain from n to both y and u.

Page 53: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 52

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.

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.

Page 54: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 53

6 Linear Differential Equations with forcing

The governing equations for the car, with integral controller can be expressed in two dis-tinct, but equivalent, forms. By writing down the governing equations for each componentindividually, and then eliminating the interconnection variable u gives

v(t) = 1m

[−αv(t) + EKIz(t) +Gw(t)]z(t) = vdes(t) − v(t)

This is two 1st order (only first derivative occurs), coupled (z affects v and v affects z) lineardifferential equations, with (in this case) two external inputs, vdes and w. The general caseof this situation has n dependent variables, x1, x2, . . . , xn, and m inputs, d1, d2, . . . , dm. Thedifferential equations governing the evolution of the xi variables is

x1(t) = a11x1(t) + a12x2(t) + · · ·+ a1nxn(t) + b11d1(t) + b12d2(t) . . .+ b1mdm(t)x2(t) = a21x1(t) + a22x2(t) + · · ·+ a2nxn(t) + b21d1(t) + b22d2(t) . . .+ b2mdm(t)

... =...

xn(t) = an1x1(t) + an2x2(t) + · · ·+ annxn(t) + bn1d1(t) + bn2d2(t) . . .+ bnmdm(t)

In matrix notation, this appears much simpler

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

where x, A, B, and d are vectors and matrices

x(t) :=

x1(t)x2(t)

...xn(t)

, d(t) :=

d1(t)d2(t)

...dm(t)

, A =

a11 a12 · · · a1n

a21 a22 · · · a2n...

.... . .

...an1 an2 · · · ann

, B =

b11 · · · b1m

b21 · · · b2m...

. . ....

bn1 · · · bnm

This is called a linear, state-space representation. For the cruise-control equations, it appearsas [

v(t)z(t)

]

︸ ︷︷ ︸

x(t)

=

[ −αm

EKI

m

−1 0

]

︸ ︷︷ ︸

A

[

v(t)z(t)

]

︸ ︷︷ ︸

x(t)

+

[

0 Gm

1 0

]

︸ ︷︷ ︸

B

[

vdes(t)w(t)

]

︸ ︷︷ ︸

d(t)

On the other hand, we also eliminated z from the original equations, to yield

v(t) +α

mv(t) +

EKI

mv(t) =

EKI

mvdes(t) −

G

mw(t) (38)

So, now the closed-loop system behavior is described with one 2nd order (2 derivatives)differential equation, with two external inputs, vdes and w, although for w, only w explicitlyappears. This is mathematically equivalent to the state-space form above, but of a differentform.

Page 55: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 54

First some notation, if y denotes a function (of a variable t, say), then y [k] or y(k) denotesthe k’th derivative of the function y,

y[k] =dky

dtk.

Then, for a system with (say) two inputs (u, w) and one output (y), the n’th order differentialequation relating the inputs to outputs is

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)+c0w

[n](t) + c1w[n−1](t) + · · · + cn−1w

[1](t) + cnw(t)

We will refer to this as the SLODE (single, linear ODE) representation.

Both representations are useful, and in certain situations, advantageous over each other. Wewill study each in detail, starting with the SLODE.

In section 7, we cover much of the mathematics to analyze the behavior of systems governedby the SLODE representation.

In section 8, we revisit the cruise control with integral control, and analyze the dynamicproperties we had observed. We also propose a more complex control architecture which hasmore desirable properties.

Page 56: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 55

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

7.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) (39)

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 (39) is called a forced, linear, time-invariant differential equation.For now, associate the fact that the ain

i=1 are constants with the term time-invariant, andthe fact that the left-hand side (which contains all y terms) is a linear combination of y andits 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 (40)

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

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

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 (41). Then, there exists a unique function ywhich satisfies the initial conditions and the differential equation (39).

Page 57: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 56

7.2 Importance of Linearity

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

y(n)P (t) + a1y

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

and yH is a function which, for all t satisfies

y(n)H (t) + a1y

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

yH is called a homogeneous solution of (39), and the differential equation in (43) is calledthe homogeneous equation. The function yP is called a particular solution to (39), 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 (39). 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 (39). 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 (39) 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.

7.3 Solving Homogeneous Equation

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

yH(t) = ert

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

gives (

rn + a1rn−1 + · · · + an

)

ert = 0

Page 58: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 57

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

rn + a1rn−1 + · · ·+ an = 0 (44)

Thus, if ert is a solution to the homogeneous equation, it must be that the scalar r satisfies(44).

Conversely, suppose that r is a complex number which satisfies (44), 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 thehomogeneous 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 (39).

Fact 1 (requires proof): If the λini=1 are all distinct from one another , then yH satisfies

(43) if and only if there exist complex constants c1, c2, . . . , cn such that

yH(t) =n∑

i=1

cierit

Fact 2 (requires proof): If the λini=1 are not distinct from one another, then group the

roots r1, r2, · · · , rn as

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

l1

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

l2

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

lf

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

satisfies (43) 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

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.

Basic idea: Suppose there are m 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 initial

Page 59: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 58

conditions,

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.

7.4 General Solution Technique

The general technique (conceptually, at least) for finding particular solutions of (39) 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.

7.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 give

Page 60: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 59

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

• 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 = ∞

Since all homogeneous solutions are (essentially) of the form ert where r is a root of thecharacteristic polynomial, we see that the roots of the characteristic polynomial determinethe qualitative nature of the homogeneous solutions.

We summarize this 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 which do not decay to 0 as t→ ∞

7.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)

Page 61: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 60

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 62: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 61

7.7 Example

Consider the differential equation

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

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 (45) is simply yP (t) = 1 for all t ≥ 0. Note that this choice of yP

does not satisfy the initial conditions, but it does satisfy the differential equation.

As we have learned, all solutions to (45) 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 63: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 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.

7.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 64: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 63

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

y(t) +a1

a0y(t) +

a2

a0y(t) = 0

Call b1 := a1

a0, b2 := a2

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

λ1 =−b1 +

b21 − 4b2

2, λ2 =

−b1 −√

b21 − 4b2

2

Consider 4 cases:

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

•√

b21 − 4b2 is imaginary

•√

b21 − 4b2 is real, but√

b21 − 4b2 < b1.

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

2. b1 ≤ 0: Again, the square-root is either real or imaginary. If it is imaginary, 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: 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 (positiveor 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: 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, that is only necessary, not sufficient, as an example illustrates: theroots of λ3 + λ2 + λ+ 3 are −1.575, 0.2874± j1.35.

Page 65: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 64

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

2 + b3λ+ b4 = 0, all of theroots have negative real parts if and only if b1 > 0, b4 > 0, b1b2 > b3 and (b1b2 − b3)b3 > b21b4.

7.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)

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)

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

Page 66: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 65

• 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]

For a general problem, use the initial conditions to determine c1 and c2. Usually,the initial conditions, y(0), y(0), are real numbers, the 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 are linearly 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 thecomplex conjugate 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 homogeneoussolution 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.

The solution is made up of two terms:

1. An exponentially decaying envelope, e−ξωnt. Note that this decays to zero inapproximately 3

ξωn

2. sinosoidal oscillation terms, sinωn

√1 − ξ2t and cosωn

√1 − ξ2t. The period of

oscillation is 2π

ωn

√1−ξ2

.

Page 67: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 66

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 aremany oscillations in the homogeneous solutions, and the system associated with thedifferential equation is called “lightly damped.” The quantity ξ is called the dampingratio.

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

Page 68: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 67

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

Typical Moderately Damped Response

Time

Res

pons

e

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

a2

v + 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 homoge-neous solutions connect the initial conditions to the final conditions. In this case,

limt→∞

y(t) =b

a2v, lim

t→∞y(t) = 0

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

between 0.1 and 10.

Page 69: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 68

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

Page 70: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 69

7.10 Problems

1. 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.

2. Consider the example equation from Section 7.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

(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 71: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 70

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.

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

Page 72: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 71

(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. In section 7.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

a2

v + 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).

6. Suppose that 0 < ξ < 1, and ω > 0. Let λ be the complex number

λ := −ξωn + jωn

1 − ξ2

(a) Show that |λ| = ωn, regardless of 0 < ξ < 1.

(b) The complex number λ is plotted in the complex plane, as shown below.

-

6λ×

AA

AA

Re

Im C

ψ

Express sinψ in terms of ξ and ωn.

7. 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)

Page 73: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 72

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)

8. 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).

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.

9. 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 (8)(a)(i) into the cas-cade 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 (8)(a)(ii)? Are thetwo plots in (8)(a) consistent with your decomposition?

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

Page 74: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 73

8 Revisiting the Integral Controller

As we saw in section 5.6, 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 7.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)

(46)

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) +

G

mw(t) (47)

The differential equation governing the closed-loop system is obtained eliminating z and ufrom the equations (46) and (47). This is obtained by differentiating equation (47) andsubstituting from (46) for u. This yields

v(t) +α + EKP

mv(t) +

EKI

mv(t) =

EKI

mvdes(t) +

EKP

mvdes(t) +

G

mw(t) (48)

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 7.8 that the conditions forstability are

α+ 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

Page 75: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 74

• ω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 5.6), then the observationssimplify:

• ωn increases with increasing KI

• the damping ratio, ξ, decreases with increasing KI

This is exactly consistent with our time-domain simulations from section 5.6.

The roots of the characteristic equation are at

λ1,2 =−(α + EKP ) ±

(α + EKP )2 − 4EKIm

2m

This is simple enough to study how the roots depend on the values of KP and KI .

1. Fix KP > −αE

. At KI = 0, the roots are real, at

−α+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 the imaginary part simply increases with increasing KI . This is sketched on theblackboard.

Page 76: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 75

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 issketched on the blackboard.

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).

8.1 Problems

1. 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 77: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 76

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)

(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.

Page 78: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 77

(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 1f, 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.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.

2. Use Simulink to reproduce the plots at the end of section 2.6, concerning the responseof the car using integral control.

Page 79: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 78

3. Read the help information on the following commands: plot, semilogx, semilogy,loglog, linspace, logspace, sin, cos, exp, abs, size, plus, times and mtimes. Runthe following commands (in the order shown) and explain what occurs in each case:

(a) >> t = linspace(0,4,500);

(b) >> size(t)

(c) >> a = cos(4*t);

(d) >> b = sin(4*t);

(e) >> c = exp(-t);

(f) >> d = b*c;

(g) >> size(b)

(h) >> size(c)

(i) >> d = b.*c;

(j) >> size(d)

(k) >> plot(t,d,’:b’,t,a,’r--’,t,a+d,’k-.’);

(l) >> semilogy(t,c)

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

(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 θ.

Page 80: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 79

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), with Md(t) ≡ 0,θdes(t) = 10. Also plot the aileron deflection δ(t) during the manuever.

(g) On an airplane, there are rate gyros which directly measure the roll rate, θ(t).Draw a block diagram of the closed-loop system with the control law

δ(t) = KP (θdes(t) − θ(t)) −KDθ(t)

(h) What is the characteristic equation of the closed-loop system?

(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.

Page 81: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 80

(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 4l. 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.

5. 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 82: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 81

9 More on ODEs

Recall the equations from the cruise control system

v(t) = − αmv(t) + E

mu(t) + G

mw(t)

z(t) = vdes(t) − v(t)vmeas(t) = v(t) + n(t)

u(t) = KIz(t) +Kffvdes(t) −Kfbv(t)

(49)

Note that these are well defined, whether or not w, n and vdes are differentiable functions. Astwo coupled 1st order differential equations, (49) is in the appropriate form for a numericaldifferential equation solver, such as Simulink. Unfortunately, based on what knowledge wehave now, the characteristic equation is not evident, and for that we need to eliminatevariables, and obtain one 2nd order differential equation. We assume all of the inputs (w, nand vdes) are differentiable, and we differentiate the first equation, substituting for u, yielding

v(t)+α + EKfb

mv(t)+

EKI

mv(t) =

EKI

mvdes(t)+

EKff

mvdes(t)+

G

mw(t)−EKI

mn(t)−EKfb

mn(t)

(50)Question: It appears that w, n and vdes must be differentiable for this relationship to hold.That would mean that this is not suitable for determining the response to step changes inw and/or vdes. In this and the next section, we learn about distributions, and how to makesense of differential equations when the right hand side is not classically defined.

Another issue arises when we simulate this system with gains set to appropriate values.Suppose that with the usual values for E, α,m and G, the controller gains Kfb and KI arechosen so that ξ = 0.707, ωn = 0.7. Disregard w and n, leaving

v(t) +α + EKfb

mv(t) +

EKI

mv(t) =

EKI

mvdes(t) +

EKff

mvdes(t) (51)

Further, suppose we chose Kff = 0 ∗Kfb, 0.5Kfb, Kfb, 2Kfb. Step-responses (vdes startsat 0, and abruptly changes to 1) with all initial conditions (v and v set to 0) for these casesare shown. Note that the overshoot is a function of Kff , even though Kff has no effect onthe roots of the characteristic equation.

Page 83: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 82

0 5 10 150

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

Step Response

Time (sec)

Am

plitu

de

This difference must be due to the presence of the vdes term on the right=hand side of thedifferential equation. This section will uncover exactly how this term affects the response.

9.1 Introduction

Suppose that through manipulation, we derive a relationship between the input (u) andoutput (y) of a system to be

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

Next, suppose that we are given initial conditions y0 and y0, and are asked to computethe response to a unit-step input, applied just after the system is released from the initialconditions. Note that the input is not differentiable at t = 0, and hence the right-hand sideof the differential equation is not well defined. How do we get a solution in that case? Inorder to study this, we first consider particular solutions to a special class of nonconstantforcing functions.

9.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.

Page 84: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 83

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

α =γ1

an

, β =γ0 − an−1α

an

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

k=0 γktk.

9.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) (52)

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 (52) 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 (ε ∞).

Page 85: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 84

• 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.

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

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

b1ε

A particular solution (using the method we derived in Section 9.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 (53)

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 (54)

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

[

1 1λ1 λ2

] [

c1c2

]

=

[

Y0 − β

Y0 − α

]

Page 86: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 85

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 (53 and 54))

[

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 − α

]

+

[

αε+ βα

]

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ε

[

Y0

Y0

]

+

(

−Mε +

[

1 ε0 1

]) [

βα

]

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

[

yε(ε)yε(ε)

]

= Mε

[

Y0

Y0

]

+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

]

Page 87: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 86

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,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 (52) plays a role in the solution. So, both the left andright sides of an input/output ODE have qualitative and quantitative effects of the solution.We will formalize this as we proceed...

9.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.

Page 88: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 87

(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 89: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 88

10 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 9 in a less tedious fashion.

10.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)(55)

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 (55) 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 90: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 89

4. For t > 0, the right hand side of the ODE in (55) 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 91: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 90

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

ε2for ε < 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.

10.2 Procedure to get step response

Consider our general system differential equation (55), and suppose that u(t) = µ(t). Then,the highest order singularity in the right-hand side is associated with the u[n] term, whichhas δ[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 additional

Page 92: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 91

differentiation 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µ + fn

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

...y[1] = e1δ + e2µ + f2

y[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

(56)

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

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

Page 93: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 92

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]

10.3 Problems

1. 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 on page 82, handling the 7cases

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.

2. 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 94: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 93

11 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)(57)

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] ejω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

(58)

Moreover, since actual solution differs from this particular solution by some homogeneoussolution, we must have

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

In the limit, the homogeneous solution decays, regardless of the initial conditions, and wehave

limt→∞

y(t) − yP (t) = 0

Page 95: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 94

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 (58) 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

(59)

This function is called the “frequency response” of the linear system in (57). Sometimes it isreferred to as the “frequency response from u to y,” written as Hu→y(ω). For stable systems,we have proven for fixed value u and fixed ω

u(t) := uejωt ⇒ yss(t) = H(ω)uejωt

11.1 Complex and Real Particular Solutions

What is the meaning of a complex solution to the differential equation (57)? 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)

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.

Page 96: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 95

11.2 Response due to real sinusoidal inputs

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

cos 6 H =ReH

|H| , sin 6 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 6 H cos θ − sin 6 H sin θ]= |H| cos (θ + 6 H)

Im(

Hejθ)

= Im [(HR + jHI) (cos θ + j sin θ)]

= HR sin θ +HI cos θ

= |H|[

HR

|H| sin θ + HI

|H| cos θ]

= |H| [cos 6 H sin θ + sin 6 H cos θ]= |H| sin (θ + 6 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+ 6 H(ω))

A similar calculation holds for sin, and these are summarized below.

Input Steady-State Output

1 H(0) = bn

an

cosωt |H(ω)| cos (ωt+ 6 H(ω))sinωt |H(ω)| sin (ωt+ 6 H(ω))

11.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)

Page 97: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 96

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 8(a)(i) in Section 7.10. On the samegraph, plot the frequency response function for the 1st order system in problem 8(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 8(b)(i) in Section 7.10. On the same graph,plot the frequency response function for the 2nd order system in problem 8(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.

(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ω

Page 98: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 97

(e) What is 6 H(ω) for ω << ωn?

(f) What is 6 H(ω) for ω >> ωn?

(g) What are |H(ω)| and 6 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 φ := 6 H(ωcrit). What is tanφ?

(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 6 |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 99: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 98

12 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)(60)

we write “in transfer function form”

Y =b0s

n + b1sn−1 + · · ·+ bn−1s+ bn

sn + a1sn−1 + · · · + an−1s+ anU (61)

The expression in (61) is interpreted to be equivalent to the ODE in (60), just a differentway of writing the coefficients. The notation in (61) 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 (61),

Y = Gu→y(s)U

is nothing more than a new notation for the differential equation in (60). The differentialequation has a well-defined meaning, and we understand what each term represents, and themeaning of the equality sign, =. In the transfer function expression, (61), there is no specificmeaning to the individual terms, or the equality symbol. The expression, as a whole, simplymeans the differential equation it is associated with.

In this section, we will see that, in fact, we can assign proper equality, and make algebraicsubstitutions and manipulations of transfer function expressions, which will aid our manipu-lation of linear differential equations. But all of that requires proof, and that is the purposeof this section.

12.1 Linear Differential Operators (LDOs)

Note that in the expression (61), 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

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]

Page 100: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 99

Using this shorthand notation, we can write the original ODE in (64) 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).

12.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

]

Page 101: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 100

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).

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.

Page 102: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 101

12.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

S- d - -6

ru

y−+

Assume that system S is described by the LDO L(y) = D(u). The feedback interconnectionyields u(t) = r(t)− y(t). Eliminate u by substitution, yielding an LDO relationship betweenr and y

L(y) = D(r − y) = D(r) −D(y)

This is rearranged to the closed-loop LDO

(L +D)(y) = D(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 =pD(s)

p[L+D](s)R

=pD(s)

pL(s) + pD(s)R.

Additional manipulation leads to further interpretation. Let G(s) denote the transfer func-

tion of S, so G = pD(s)pL(s)

. Then

Y =pD(s)

pL(s) + pD(s)R

=

pD(s)pL(s)

1 + pD(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.

Page 103: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 102

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!

12.4 Cascade 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

]

Page 104: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 103

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)

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.

Page 105: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 104

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)

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.

12.5 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).

Page 106: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 105

Apply the differential operation L2 to the governing equation for S1, yielding

L2 (L1(y1)) = L2 (R1(u)) (62)

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 (R2(u)) (63)

Add the expressions in (62) and (63), 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.

12.6 General Connection

The following steps are used for a general interconnection of systems, wach governed by alinear differential equation relating the inputs and outputs.

Page 107: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 106

• Redraw the block diagram of the interconnection. Change signals (lower-case) to uppercase, and replace each system with its transfer function.

• 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.

12.7 Systems with multiple inputs

Associated with the multi-input, single-output linear ODE

L(y) = R1(u) +R2(w) +R3(v) (64)

we write

Y =pR1

(s)

pL(s)U +

pR2(s)

pL(s)W +

pR3(s)

pL(s)V (65)

This may be manipulated algebraically

12.8 Problems

1. 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)

2. (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 2a above is a “proof” of this fact.

Page 108: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 107

3. (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 3a above is a “proof” of this fact.

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

+

5. 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

What is the transfer function from r and d to x? Call your answers G1 and G2.

Page 109: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 108

(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?

6. (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 (6b),

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.

7. Find the transfer function from e to u for the PI controller equations

z(t) = e(t)u(t) = KP e(t) +KIz(t)

Page 110: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 109

8. 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.

9. 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?

10. Recall that if systems are connected in parallel (same input, and outputs add together)then the transfer function of the parallel connection is the sum of the transfer functions.

Consider the three different, complicated transfer functions

G1(s) =0.05s4 + 0.394s3 + 7.868s2 + 14.43s+ 64

0.04s5 + 1.184s4 + 7.379s3 + 73.19s2 + 95.36s+ 64

G2(s) =0.05s4 + 2.536s3 + 64.36s2 + 87.87s+ 64

0.04s5 + 1.184s4 + 7.379s3 + 73.19s2 + 95.36s+ 64

G3(s) =0.9s4 + 4.27s3 + 65.97s2 + 88.42s+ 64

0.04s5 + 1.184s4 + 7.379s3 + 73.19s2 + 95.36s+ 64

The step responses of all three systems are shown on the next page. The frequencyresponses (Magnitude and Phase) are also shown.

Although it may not be physically motivated, mathematically, each Gi can be decom-posed additively as as (you do not need to verify this)

G1(s) = 0.91

s2 + 1.4s+ 1+ 0.05

64

s2 + 3.2s+ 64+ 0.05

1

0.04s+ 1

Page 111: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 110

G2(s) = 0.051

s2 + 1.4s+ 1+ 0.9

64

s2 + 3.2s+ 64+ 0.05

1

0.04s+ 1

G3(s) = 0.051

s2 + 1.4s+ 1+ 0.05

64

s2 + 3.2s+ 64+ 0.9

1

0.04s+ 1

Based on this information, match up each Gi to its step response, frequency responsemagnitude, and frequency response phase.

0 1 2 3 4 5 60

0.5

1

1.5

Time

Out

put R

espo

nse

Step Response of G1, G

2, G

3

100

101

102

10−2

10−1

100

101

Frequency

Mag

nitu

de

Frequency Response of G1, G

2, G

3

Page 112: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 111

100

101

102

−160

−140

−120

−100

−80

−60

−40

−20

0

Frequency

Phas

e (d

egre

es)

Frequency Response of G1, G

2, G

3

11. 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

−+

−+

(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.

12. 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).

13. 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).

14. Execute the following commands

Page 113: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 112

>> 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 2 on page 78 which you recently did and turned in.

15. Execute the commands

>> sys1.den

>> class(sys1.den)

>> sys1.den1

>> class(sys1.den1)

>> size(sys1.den1)

>> roots(sys1.den1)

>> pole(sys1)

Explain what is being referenced and displayed. Recall that the “poles” of a transferfunction are the roots of the associated characteristic polynomial.

16. Read about the command frd in Matlab. Use the HTML help (available from themenubar, under Help, as well as the command-line (via >> help frd).

>> OMEGA = logspace(-2,2,200);

>> G1 = frd(sys1,OMEGA);

>> G2 = frd(sys2,OMEGA);

>> G3 = frd(sys3,OMEGA);

17. Read about the commands bode and bodemag in Matlab.

18. Execute

>> figure(1); bode(G1,G2,G3);

>> figure(2); bode(sys1,sys2,sys3);

Explain what is being plotted.

19. Read about the command feedback in Matlab. Use the HTML help (available fromthe menubar, under Help, as well as the command-line (via >> help feedback).

20. Scenario: Suppose process model is an integrator. Design a PI controller so that the

closed-loop roots have ωn = 1, ξ = 0.707. Suppose that, in reality, the process is not

just an integrator, but also has a first-order response, with time constant τ . Plot the

effect on the closed-loop for τ between 0.01 and 0.5(≈ 10−0.3).

Execute the following commands, and explain, in detail, what is being computed andplotted and how it relates to the scenario described above.

Page 114: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 113

wndes = 1; xides = 0.707;

C = tf([2*xides*wndes wndes*wndes],[1 0]);

tauvec = logspace(-2,-.3,5);

for i=1:length(tauvec)

P = tf([1],[1 0])*tf([1],[tauvec(i) 1]);

clp = feedback(P*C,1);

figure(1)

step(clp,8);

hold on

clp = feedback(C,P);

figure(2)

step(clp,8);

hold on

clp = feedback(P,C);

figure(3)

step(clp,8);

hold on

figure(4)

bode(clp);

hold on

end

figure(1); hold off; figure(2); hold off;

figure(3); hold off; figure(4); hold off;

Explain, in detail, what is being computed and plotted.

Page 115: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 114

13 Connection between Frequency Responses and Trans-

fer functions

Consider the standard linear system

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)(66)

with y the dependent variable (output), and u the independent variable (input).

Assuming that the system is stable, we know that the steady-state response to a sinusoidalinput is also a sinusoid, with magnitude and phase determined by the system-dependentfrequency response function

H(ω) :=b0(jω)n + b1(jω)n−1 + · · ·+ bn−1(jω) + bn(jω)n + a1(jω)n−1 + · · ·+ an−1(jω) + an

(67)

For stable systems, we have proven for fixed value u and fixed ω ∈ R

u(t) := uejωt ⇒ yss(t) = H(ω)uejωt

Recall that the transfer function from u to y is the rational function G(s) given by

G(s) :=b0s

n + b1sn−1 + · · ·+ bn−1s+ bn

sn + a1sn−1 + · · ·+ an−1s+ an

Note that H(ω) = G(s)|s=jω.

So, we can immediately write down the frequency response function once we have derived thetransfer function. We often do not use different letters to distinguish the transfer functionand frequency response, typically writing G(s) to denote the transfer function and G(jω) todenote the frequency response function.

13.1 Interconnections

Frequency Responses are a useful concept when working with interconnections of linear sys-tems. Since the frequency response function turned out to be the transfer function evaluatedat s = jω, frequency response functions of interconnections follow the same rules as transferfunctions of interconnections.

This is extremely important. The frequency response of a stable interconnectionof systems (which are individually possibly unstable) is simply the algebraicgain of the closed-loop systems, treating individual subsystems as complex

Page 116: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 115

gains, with their “gain” taking on the value of the frequency responsefunction. This is true, even if some of the subsystems are not themselvesstable.

The frequency response of the parallel connection, shown below

S2

S1-

-

?

6d -u

y1

y2

y++

is simply G(jω) = G1(jω)+G2(jω), where G1(s) and G2(s) are the transfer functions of thedynamic systems S1 and S2 respectively.

For the cascade of two stable systems,

S1 S2- - -u v y

the frequency response is G(jω) = G2(jω)G1(jω).

The other important interconnection we know of is the basic feedback loop. Consider thesimple unity-feedback system shown below

S- d - -6

ru

y−+

Again, using the transfer function derived earlier, we see that

Gr→y(jω) =Gu→y(jω)

1 +Gu→y(jω)

Page 117: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 116

14 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 118: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 117

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 perccentage 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.

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 PL

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 12). Assume L is of theform

L(s) =b1s

n−1 + · · ·+ bn−1s+ bnsn + a1sn−1 + · · ·+ an−1s+ an

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)

Page 119: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 118

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 theclosed-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)]

(68)

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ω.

14.1 Gain Margin

The setup for the gain margin problem is shown in Figure 14, with T = 0. Here, a plantand controller are in closed-loop along with a gain γ at the plant input. We assume that theclosed-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 isstable for γ = 1, it is clear that γ < 1 < γ.

With the time-delay T = 0, the differential equation (68) 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, theonly way for a root to move into the right-half plane is to cross the imaginary axis, eitherat 0, or at some jβ, with β > 0 (since complex roots come in conjugate pairs, if they crossthe imaginary axis, one will cross positively, and one negatively - we can focus on one or theother, and for no specific reason, we look at the positive crossing). Hence, we are lookingfor values γ and β, with close to 1, and β ≥ 0 such that λ = jβ is a root of pγ. Plugging ingives

(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

. (69)

Page 120: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 119

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 (69) by looking for solutions (ie., real β) to

(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 solutions to equation (69). Therelikely are others, which are described below.

We can also look for solutions to (69) with (jβ)n+a1(jβ)n−1+a2(jβ)n−2+· · ·+an−1(jβ)+an 6=0, so that after dividing, we manipulate equation (69) 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 reciprical to find the associated γ value).

Summarizing, a simple method to determine all solutions to equation (69) 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 69.

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?).

3. Mark all of the locations where L(jβk) is a real number. The frequencies βk are calledthe phase-crossover frequencies.

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).Of all solutions less than 1, find the one closest to 1. Label this γ. Similarly, Of allsolutions greater than 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 γ = ∞.

Page 121: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 120

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 chosing theclosest 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 intersect 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 chosing the closest intersection, α is “close” to 1, and hence γ := 1α

is thedesired 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 recipricaldetermines 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.

14.2 Time-Delay Margin

The homogeneous equation, with γ = 1, but T > 0 of equation (68) 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

(70)

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 critical value of Tfor which stability is violated, sinusoidal solutions to the homogeneous equation exist. Inother words, the system “goes unstable” by first exhibiting purely sinusoidal homogeneoussolutions. The frequency of this sinusoidal solution is not known apriori, and needs to bedetermined, along with the critical value of the time-delay.

Page 122: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 121

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 (70) of the form yH(t) = ejωt exists? If such a solution exists, then by plugging itinto (70), and canceling the common ejωt term, which is never 0, we get a necessary algebraiccondition

(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ωT 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 = 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

6 ejθΨ = θ + 6 Ψ

Hence, at any value of ω, we have

6 e−jωT L(jω) = −ωT + 6 L(jω)

Also, 6 (−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 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 downward direction(negative) to get to the closest odd-multiple of π (or 180).

Page 123: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 122

4. Repeat this calculation for each gain-crossover frequency, and choose the smallest ofall of the T ’s obtained.

Page 124: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 123

14.3 Examples

14.3.1 Generic

Consider a system with

L(s) =4

(0.5s+ 1)3

The plots of∣∣∣L(jω)

∣∣∣ , 6 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 125: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 124

14.3.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 126: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 125

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 127: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 126

−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 128: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 127

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

14.4 Problems

1. Consider the multiloop interconnection of 4 systems shown below.

Page 129: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 128

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) = 4s

and P (s) = 2 in a standard Controller/Plant feedback architecture,with negative feedback.

(a) Is the closed-loop system stable?

(b) What is the closed-loop transfer function from r to y.

(c) What is the steady-state gain from r → y?

(d) What is the time-constant of the closed-loop system.

(e) What is the time-delay margin? Denote it by Td. At what frequency will 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) = Ks

and P (s) = β in a standard Controller/Plant feedback architecture,with negative feedback. Assume both β and K are positive.

(a) Is the closed-loop system stable?

(b) What is the closed-loop transfer function from r to y.

(c) What is the steady-state gain from r → y?

(d) What is the time-constant of the closed-loop system.

(e) What is the time-delay margin?

(f) What is the ratio of the time-constant of the closed-loop system to the time-delaymargin? Note that this ratio is not a function of β and/or K.

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)

Page 130: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 129

• 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.

6. Find Leff for determining time-delay and/or gain margins at the locations marked by1, 2 and 3.

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)

Page 131: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 130

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.

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.

Page 132: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 131

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

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 .

Page 133: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 132

KI Pe−+- - - - -

6

r e u y

(d) Find a PI controller, that results in a stable closed-loop system.

(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

Page 134: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 133

derive S, N and L at each marked location. In each case, verify (after the derivation)that

L = − N

1 +N=

1 − S

S

Page 135: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 134

15 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 behaviorat instances when the inputs are limited. This is much 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.

15.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 136: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 135

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, with PIcontrol. A new m-file carpis.m is given below. It has 5 extra parameters. They are, inorder, m,KP , KI, Umin, Umax. This file simply limits the actual throttle signal to the car. Itis written to clearly separate the car equations from the controller equations.

Page 137: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 136

file: carpis.m

function [out1,out2] = carpis(t,x,d,flag,p1,p2,p3,p4,p5)

% Interpretations x = [v;z], d = [v des;w], e = [v;u];

E = 40; alpha = 60; G = -98;

m = p1; kp = p2; ki = p3; umin = p4; umax = p5;

x10 = 25; x20 = (alpha*x10)/(E*ki);

if flag==0

out1 = [2;0;2;2;0;1];

out2 = [x10;x20];

elseif flag==1

udes = kp*(d(1)-x(1)) + ki*x(2);

if udes>umax

u = umax;

elseif udes<umin

u = umin;

else

u = udes;

end

vdot = -alpha*x(1)/m + E*u/m + G*d(2)/m;

zdot = d(1) - x(1);

out1 = [vdot;zdot];

elseif flag==3

udes = kp*(d(1)-x(1)) + ki*x(2);

if udes>umax

u = umax;

elseif udes<umin

u = umin;

else

u = udes;

end

out1 = [x(1);u];

end

Suppose that we choose as a nominal design ωn := 0.6, ξ := 0.7, and choose gains KP and KI

in terms of the design equations in section 8. A simulation of the system without saturationcan be done using inf and -inf gives a decent response, as we have seen earlier, as shownbelow. Suppose that a saturating element is actually in place. Take Umin := −Umax (so thesaturating element is symmetric, which may or may not be realistic in a car example...), andsimulate the system for several different values of Umax.

The code below will do everything just described. It is best to put this in a file, say carsim.m.

Page 138: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 137

E = 40; alpha = 60; m = 1000; wn = 0.6; xi = 0.7;

TF = 80;

timespan = [T0 TF];

simopts = simset(’solver’,’ode45’);

kp = (2*xi*wn*m - alpha)/E;

ki = m*wn*wn/E;

umax = inf; umin = -inf;

dt = [0 25 0; 9.9 25 0;10 30 0;39.9 30 0;40 30 2.5;80 30 2.5];

intopt = [1e-3;0.001;.1;1;0;2];

[tdata,xdata,edata] = sim(’carpis’,timespan,simopts,dt,m,kp,ki,umin,umax);

figure(1)

plot(tdata,edata(:,1),’-.’); title(’Velocity’)

hold on

figure(2)

plot(tdata,edata(:,2),’-.’); title(’Actual Control’)

hold on

figure(3)

plot(tdata,xdata(:,2),’-.’); title(’Controller Integrator’)

hold on

satvec = [110 100 90 80 70 60];

for i=1:length(satvec)

umin = -satvec(i);

umax = satvec(i);

[tdata,xdata,edata] = sim(’carpis’,timespan,simopts,dt,m,kp,ki,umin,umax);

figure(1); plot(tdata,edata(:,1)); hold on

figure(2); plot(tdata,edata(:,2)); hold on

figure(3); plot(tdata,xdata(:,2)); hold on

end

figure(1); grid; hold off

figure(2); grid; hold off

figure(3); grid; hold off

Page 139: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 138

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 140: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 139

Note that as Umax decreases, the closed-loop performance degrades quite ungracefully. Even

though the maximum acceleration is limited, and the slope is decreased, the overshoot ac-

tually gets worse!.

The problem is that once the controller output u(t) exceeds Umax, it is of no use for 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.

15.2 Anti-Windup PI control action

For a general PI controller, let r(t) denote the reference signal, which is the desired value of

the plant output, and let y(t) denote the actual plant output. The PI controller equationsare

z(t) = r(t) − y(t)udes(t) = KP [r(t) − y(t)] + KIz(t)

(71)

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 141: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 140

• 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)

(72)

Doing so yields much better performance. The plots are shown on the next page.

Page 142: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 141

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 143: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 142

15.3 Problems

Page 144: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 143

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.

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 145: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 144

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 146: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 145

16 State Variables

For any system (mechanical, electrical, electromechanical, economic, biological, acoustic,thermodynamic, etc.) a collection of variables q1, q2, . . . , qn are called state variables, if theknowledge of

• the values of these variables at time t0, and

• the external inputs acting on the system for all time t ≥ t0, and

• all equations describing relationships between the variables qi and the external inputs

is enough to determine the value of the variables q1, q2, . . . , qn for all t ≥ t0.

In other words, past history (before t0) of the system’s evolution is not important in de-termining its evolution beyond t0 – all of the relevant past information is embedded in thevariables value’s at t0.

Example: The system is a point mass, mass m. The point mass is acted on by an externalforce f(t). The position of the mass is measured relative to an inertial frame, with coordinatew, velocity v, as shown below.

Claim #1: The collection w is not a suitable choice for state variables. Why? Note thatfor t ≥ t0, we have

w(t) = w(t0) +∫ t

t0

[

v(t0) +∫ τ

t0

1

mf(η)dη

]

Hence, in order to determine w(t) for all t ≥ t0, it is not sufficient to know w(t0) and theentire function f(t) for all t ≥ t0. You also need to know the value of v(t0).

Claim #2: The collection v is a legitimate choice for state variables. Why? Note thatfor t ≥ t0, we have

v(t) = v(t0) +∫ t

t0

1

mf(τ)dτ

Hence, in order to determine v(t) for all t ≥ t0, it is sufficient to know v(t0) and the entirefunction f(t) for all t ≥ t0.

Page 147: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 146

Claim #3: The collection w, v is a legitimate choice for state variables. Why? Note thatfor t ≥ t0, we have

w(t) = w(t0) +∫ tt0v(η)dη

v(t) = v(t0) +∫ tt0

1mf(τ)dτ

Hence, in order to determine v(t) for all t ≥ t0, it is sufficient to know v(t0) and the entirefunction f(t) for all t ≥ t0.

In general, it is not too hard to pick a set of state-variables for a system. The next fewsections explains some rule-of-thumb procedures for making such a choice.

16.1 Legitimate choice by writing down first order evolution equa-tions

Suppose for a system we choose some variables (x1, x2, . . . , xn) as a possible choice of statevariables. Let d1, d2, . . . , df denote all of the external influences (ie., forcing functions) actingon the system. Suppose we can derive the relationship between the x and d variables in theform

x1 = f1 (x1(t), x2(t), . . . , xn(t), d1(t), . . . , df(t))x2 = f2 (x1(t), x2(t), . . . , xn(t), d1(t), . . . , df(t))

......

xn = fn (x1(t), x2(t), . . . , xn(t), d1(t), . . . , df(t))

(73)

Then, the set x1, x2, . . . , xn is a suitable choice of state variables. Why? Ordinary differ-ential equation (ODE) theory tells us that given

• an initial condition x(t0) := x0, and

• the forcing function d(t) for t ≥ t0,

there is a unique solution x(t) which satisfies the initial condition at t = t0, and satisfies thedifferential equations for t ≥ t0. Hence, the set x1, x2, . . . , xn constitutes a state-variabledescription of the system.

The equations in (73) are called the state equations for the system.

16.2 Choice of states from a block diagram

Given a block diagram, consisting of an interconnection of

• integrators,

• gains, and

Page 148: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 147

• static-nonlinear functions,

driven by external inputs d1, d2, . . . , df , a suitable choice for the states is

• the output of each and every integrator

Why? Note that

• if the outputs of all of the integrators are labled x1, x2, . . . , xn, then the inputs to theintegrators are actually x1, x2, . . . , xn.

• The interconnection of all of the base components (integrators, gains, static nonlinearfunctions) implies that each xk(t) will be a function of the values of x1(t), x2(t), . . . , xn(t)along with d1(t), d2(t), . . . , df(t).

• This puts the equations in the form of (73).

We have already determined that that form implies that the variables are state variables.

16.3 Problems

1. Shown below is a block diagram of a DC motor connected to an load inertia via aflexible shaft. The flexible shaft is modeled as a rigid shaft (inertia J1) inside themotor, a massless torsional spring (torsional spring constant Ks) which connects tothe load inertia J2. θ is the angular position of the shaft inside the motor, and ψ isthe angular position of the load inertia.

−γ

β∫ ∫

−1J1

Ks

1J2

∫ ∫

- - - -

6

6

-

?

- - - -

?

e

e

u(t)

y(t)

−+

++ +

θ(t)

ψ(t)

Choose state variables (use rule given in class for block diagrams that do not containdifferentiators). Find matrices A, B and C such that the variables x(t), y(t) and u(t)are related by

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

Page 149: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 148

Hint: There are 4 state variables.

2. Using op-amps, resistors, and capacitors, design a circuit to implement a PI controller,with KP = 4, KI = 10. Use small capacitors (these are more readily available) andlarge resistors (to keep currents low).

Page 150: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 149

17 Mechanical Modeling

In this section we explore some simple translational mechanical models.

17.1 Ideal Translational Elements

We consider 3 ideal translational, mechanical elements:

1. A point mass, with mass m

2. An ideal linear spring, with unstretched length L0, and spring constant k. The modelfor the spring is that it is massless, hence the forces at the opposite ends must alwaysbe equal. Also, it is modeled as linear, so that to stretch it by length ∆, a force k∆must be applied.

3. An ideal linear damper, with damping coefficient c. The model for the damper is thatit is massless, hence the forces at opposite ends must always be equal. Also, it ismodeled as linear, so that the applied force f(t) is proportional to the rate-of-changeof the length of the device, f(t) = cL(t) = c∆(t).

One suitable choice for state variables in mechanical systems is

• positions of all masses

• velocities of all masses

Why: The forces acting on each point mass are functions of the relative positions andvelocities of all of the point masses in the system, along with the external forces. Hence, viaNewton’s laws, state equations can be easily written.

Another choice of state variables in a mechanical system is

• velocities of all masses

• stretches in all springs

Why: The forces acting on each point mass are functions of the stretches in each spring(relative positions of masses) and relative velocities of all of the point masses in the system,along with the external forces. Hence, via Newton’s laws, state equations can be easilywritten. Note that under this choice, the scalar quantity xT (t)x(t) is very close to theenergy in the mechanical system.

Page 151: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 150

17.2 Multiple degree-of-freedom Oscillator

As an example, consider a two degree-of-freedom mass/spring/damper with external forcesacting on each mass. This is shown below.

The coordinates we use are

• w1(t), position of mass 1, measured from the equilibrium position of mass 1. Hence,when w1 = 0, spring #1 is unstretched.

• w2(t), position of mass 2, measured from the equilibrium position of mass 2. Hence,when w1 = w2, spring #2 is unstretched.

The coordinate system is shown below.

So, w1 is the stretch in spring #1, and w2−w1 is the stretch in spring #2. The rate-of-changeof length of damper #1 is w1, and the rate-of-change of length of damper #2 is w2 − w1.Finally, the accelerations, relative to inertial frame (ground) of mass #1 and #2 are w1 andw2 respectively.

Page 152: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 151

Free body diagrams of each mass are shown below:

Newton’s law gives

m1w1(t) = k2 [w2(t) − w1(t)] − k1w1(t) + c2 [w2(t) − w1(t)] − c1w1(t) + d1(t)m2w2(t) = −k2 [w2(t) − w1(t)] − c2 [w2(t) − w1(t)] + d2(t)

There are two obvious choices for state variables. These are detailed in the next two sections.

17.2.1 Positions and Velocities

One choice is positions and velocities of each mass. Hence

x1(t) := w1(t)x2(t) := w1(t)x3(t) := w2(t)x4(t) := w2(t)

In this case, the state equations are easily written as

x1(t)x2(t)x3(t)x4(t)

=

0 1 0 0−(k1+k2)

m1

−(c1+c2)m1

k2

m1

c2m1

0 0 0 1k2

m2

c2m2

− k2

m2− c2

m2

x1(t)x2(t)x3(t)x4(t)

+

0 01

m10

0 00 1

m2

[

d1(t)d2(t)

]

17.2.2 Velocities and Stretches

Another choice for state variables is the velocities of each mass, and the stretch in eachspring. Hence

ξ1(t) := w1(t)ξ2(t) := w1(t)ξ3(t) := w2(t)

ξ4(t) := w2(t) − w1(t)

Page 153: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 152

The state equations are easily written in matrix form as

ξ1(t)

ξ2(t)

ξ3(t)

ξ4(t)

=

−(c1+c2)m1

− k1

m1

c2m1

k2

m1

1 0 0 0c2m2

0 − c2m2

− k2

m2

−1 0 1 0

ξ1(t)ξ2(t)ξ3(t)ξ4(t)

+

1m1

0

0 00 1

m2

0 0

17.3 Example: Quarter-Car active suspension

A practical example of translational modeling is a 14-Car model for an active suspension

system in an automobile. A diagram is shown below:

The model consists of four main components: wheel, car, active element, and passive sus-pension system.

The wheel is modeled as three lumped elements: a spring, representing the tire’s flexibility;a damper, representing the internal damping present in the rubber tire material; and a mass,which represents the combination of the mass of the wheel and tire. Note, just as in theDC motor, we have lumped the stiffness, damping and inertia into three separate elements,though in reality, the tire’s mass, stiffness and dissipation are distributed throughout thetire.

Mounted on the wheel mount are three components which support the weight of the car.These three devices are not lumped approximations of a more complex device – they actuallyeach exist, and can be pointed to in a real car: the passive spring kS; the passive dampercS (called the shock strut); and the active element. The active element can exert a desiredforce, u(t), between the wheel mount and the car.

Mounted on top of these three devices is the car body.

Page 154: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 153

The road deviations are measured relative to a flat reference line.

The variables we use to describe the position of the masses are shown in the figure below:They are

1. The vertical displacement of the road, xg(t). Note that this is actually y(h(t)), wherey is the vertical displacement of the road as a function of horizontal displacement, andh(t) is the horizontal coordinate of the car, due to driving along the road).

2. The vertical displacement of the center of the wheel measured from an inertial equilib-rium location, xw(t).

3. The vertical displacement of the car measured from an inertial equilibrium position,xc(t).

Free-body diagrams of each mass are shown below

mw

?kw [xw − xg] ?cw [xw − xg]

?

kS [xc − xw] 6u

6cS [xc − xw]

mc

?kS [xc − xw] ?cS [xc − xw]

6

u

The equations of motion for the two masses are

mwxw(t) = kS [xc(t) − xw(t)] + cS [xc(t) − xw(t)] − kw [xw(t) − xg(t)] − cw [xw(t) − xg(t)] − u(t)mcxc(t) = −kS [xc(t) − xw(t)] − cS [xc − xw] + u(t)

Page 155: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 154

17.4 State-variable choice #1

The first option is to take positions and velocities of each mass. Define

x1(t)x2(t)x3(t)x4(t)

:=

xw(t)xw(t)xc(t)xc(t)

This results in

x1(t)x2(t)x3(t)x4(t)

=

0 1 0 0

− (kS+kw)mw

− (cS+cw)mw

kS

mw

cS

mw

0 0 0 1kS

mc

cS

mc− kS

mc− cS

mc

x1(t)x2(t)x3(t)x4(t)

+

0 0 0−1mw

kw

mw

cw

mw

0 0 01

mc0 0

u(t)xg(t)xg(t)

Note that both xg and xg appear explicitly in the state-equations.

17.5 State-variable choice #2

The second option for state-variables is velocities of masses, and stretches in springs. Thissuggests defining

ξ1(t)ξ2(t)ξ3(t)ξ4(t)

:=

xw(t)xw(t) − xg(t)

xc(t)xc(t) − xw(t)

which results in

ξ1(t)

ξ2(t)

ξ3(t)

ξ4(t)

=

− (cS+cw)mw

− kw

mw

cS

mw

kS

mw

1 0 0 0cS

mc0 − cS

mc− kS

mc

−1 0 1 0

ξ1(t)ξ2(t)ξ3(t)ξ4(t)

+

−1mw

0 cw

mw

0 0 −11

mc0 0

0 0 0

u(t)xg(t)xg(t)

Note that xg does not explicitly appear as an external input in this form of the equations.

Page 156: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 155

17.6 Problems

1. A model for a tightrope walker is the two-link mechanism shown below

There is an internal moment, u(t), which is exerted between the two links.

(a) Verify that the equations of motion are

(

IPO +mBL

2)

θ(t) = g(

mBL+mpL)

sin θ(t) − u(t)

IGB

[

θ(t) + ψ(t)]

= u(t)

(b) Choose states x1 := θ, x2 := θ, x3 := ψ, x4 := ψ. Find a function f (which maps 5numbers into 4 numbers) such that the equations of motion, in state-space form,are

x(t) = f (x(t), u(t))

Hint: The cleanest way to write the f2 and f4 is of the form

[

f2(x, u)f4(x, u)

]

= [2 × 2constant matrix ] [messy 2 × 1vectorinvolving x, u]

2. A ideal linear spring, and point mass are shown below. The mass slides without frictionin the guide. The unstretched length of the spring is L0. The external force d(t) actsas shown.

(a) Derive a differential equation governing the relationship between w and d.

Page 157: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 156

(b) Choose state variables, and write down the state equations. Note: the stateequations are not linear.

(c) Let the normal force N(t) (exerted by the guide) be denoted an output. Writedown an expression for the N(t) as an explicit function of w(t) and d(t).

Page 158: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 157

18 Jacobian Linearizations, equilibrium points

In modeling systems, we see that nearly all systems are nonlinear, in that the differentialequations governing the evolution of the system’s variables are nonlinear. However, mostof the theory we have developed has centered on linear systems. So, a question arises: “Inwhat limited sense can a nonlinear system be viewed as a linear system?” In this sectionwe develop what is called a “Jacobian linearization of a nonlinear system,” about a specificoperating point, called an equilibrium point.

18.1 Equilibrium Points

Consider a nonlinear differential equation

x(t) = f(x(t), u(t)) (74)

where f is a function mapping Rn × Rm → Rn. A point x ∈ Rn is called an equilibriumpoint if there is a specific u ∈ Rm (called the equilibrium input) such that

f (x, u) = 0n

Suppose x is an equilibrium point (with equilibrium input u). Consider starting the system(74) from initial condition x(t0) = x, and applying the input u(t) ≡ u for all t ≥ t0. Theresulting solution x(t) satisfies

x(t) = x

for all t ≥ t0. That is why it is called an equilibrium point.

18.2 Deviation Variables

Suppose (x, u) is an equilibrium point and input. We know that if we start the system atx(t0) = x, and apply the constant input u(t) ≡ u, then the state of the system will remainfixed at x(t) = x for all t. What happens if we start a little bit away from x, and we applya slightly different input from u? Define deviation variables to measure the difference.

δx(t) := x(t) − xδu(t) := u(t) − u

In this way, we are simply relabling where we call 0. Now, the variables x(t) and u(t) arerelated by the differential equation

x(t) = f(x(t), u(t))

Substituting in, using the constant and deviation variables, we get

δx(t) = f (x + δx(t), u+ δu(t))

Page 159: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 158

This is exact. Now however, let’s do a Taylor expansion of the right hand side, and neglectall higher (higher than 1st) order terms

δx(t) ≈ f (x, u) +∂f

∂x

∣∣∣∣∣x=xu=u

δx(t) +∂f

∂u

∣∣∣∣∣x=xu=u

δu(t)

But f(x, u) = 0, leaving

δx(t) ≈∂f

∂x

∣∣∣∣∣x=xu=u

δx(t) +∂f

∂u

∣∣∣∣∣x=xu=u

δu(t)

This differential equation approximately governs (we are neglecting 2nd order and higherterms) the deviation variables δx(t) and δu(t), as long as they remain small. It is a linear,time-invariant, differential equation, since the derivatives of δx are linear combinations of theδx variables and the deviation inputs, δu. The matrices

A :=∂f

∂x

∣∣∣∣∣x=xu=u

∈ Rn×n , B :=∂f

∂u

∣∣∣∣∣x=xu=u

∈ Rn×m (75)

are constant matrices. With the matrices A and B as defined in (75), the linear system

δx(t) = Aδx(t) + Bδu(t)

is called the Jacobian Linearization of the original nonlinear system (74), about theequilibrium point (x, u). For “small” values of δx and δu, the linear equation approximatelygoverns the exact relationship between the deviation variables δu and δx.

For “small” δu (ie., while u(t) remains close to u), and while δx remains “small” (ie., whilex(t) remains close to x), the variables δx and δu are related by the differential equation

δx(t) = Aδx(t) + Bδu(t)

In some of the rigid body problems we considered earlier, we treated problems by makinga small-angle approximation, taking θ and its derivatives θ and θ very small, so that cer-tain terms were ignored (θ2, θ sin θ) and other terms simplified (sin θ ≈ θ, cos θ ≈ 1). Inthe context of this discussion, the linear models we obtained were, in fact, the Jacobianlinearizations around the equilibrium point θ = 0, θ = 0.

If we design a controller that effectively controls the deviations δx, then we have designed acontroller that works well when the system is operating near the equilibrium point (x, u).We will cover this idea in greater detail later. This is a common, and somewhat effectiveway to deal with nonlinear systems in a linear manner.

Page 160: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 159

18.3 Tank Example

? ?

??

6

hT

qH qC

Consider a mixing tank, with constant supply temperaturesTC and TH . Let the inputs be the two flow rates qC(t) and qH(t). The equations for the tankare

h(t) = 1AT

(

qC(t) + qH(t) − cDAo

2gh(t))

TT (t) = 1h(t)AT

(qC(t) [TC − TT (t)] + qH(t) [TH − TT (t)])

Let the state vector x and input vector u be defined as

x(t) :=

[

h(t)TT (t)

]

, u(t) :=

[

qC(t)qH(t)

]

f1(x, u) = 1AT

(

u1 + u2 − cDAo

√2gx1

)

f2(x, u) = 1x1AT

(u1 [TC − x2] + u2 [TH − x2])

Intuitively, any height h > 0 and any tank temperature TT satisfying

TC ≤ TT ≤ TH

should be a possible equilibrium point (after specifying the correct values of the equilibriuminputs). In fact, with h and TT chosen, the equation f(x, u) = 0 can be written as

[

1 1TC − x2 TH − x2

] [

u1

u2

]

=

[

cDAo

√2gx1

0

]

The 2× 2 matrix is invertible if and only if TC 6= TH . Hence, as long as TC 6= TH , there is aunique equilibrium input for any choice of x. It is given by

[

u1

u2

]

=1

TH − TC

[

TH − x2 −1x2 − TC 1

] [

cDAo

√2gx1

0

]

This is simply

u1 =cDAo

√2gx1 (TH − x2)

TH − TC, u2 =

cDAo

√2gx1 (x2 − TC)

TH − TC

Page 161: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 160

Since the ui represent flow rates into the tank, physical considerations restrict them tobe nonegative real numbers. This implies that x1 ≥ 0 and TC ≤ TT ≤ TH . Looking at thedifferential equation for TT , we see that its rate of change is inversely related to h. Hence, thedifferential equation model is valid while h(t) > 0, so we further restrict x1 > 0. Under thoserestrictions, the state x is indeed an equilibrium point, and there is a unique equilibriuminput given by the equations above.

Next we compute the necessary partial derivatives.

[∂f1

∂x1

∂f1

∂x2

∂f2

∂x1

∂f2

∂x2

]

=

− gcDAo

AT

√2gx1

0

−u1[TC−x2]+u2[TH−x2]x21AT

−(u1+u2)x1AT

[∂f1

∂u1

∂f1

∂u2

∂f2

∂u1

∂f2

∂u2

]

=

[1

AT

1AT

TC−x2

x1AT

TH−x2

x1AT

]

The linearization requires that the matrices of partial derivatives be evaluated at the equi-librium points. Let’s pick some realistic numbers, and see how things vary with differentequilibrium points. Suppose that TC = 10, TH = 90, AT = 3m2, Ao = 0.05m, cD = 0.7. Tryh = 1m and h = 3m, and for TT , try TT = 25 and TT = 75. That gives 4 combinations.Plugging into the formulae give the 4 cases

1.(

h, TT

)

= (1m, 25). The equilibrium inputs are

u1 = qC = 0.126 , u2 = qH = 0.029

The linearized matrices are

A =

[

−0.0258 00 −0.517

]

, B =

[

0.333 0.333−5.00 21.67

]

2.(

h, TT

)

= (1m, 75). The equilibrium inputs are

u1 = qC = 0.029 , u2 = qH = 0.126

The linearized matrices are

A =

[

−0.0258 00 −0.0517

]

, B =

[

0.333 0.333−21.67 5.00

]

3.(

h, TT

)

= (3m, 25). The equilibrium inputs are

u1 = qC = 0.218 , u2 = qH = 0.0503

The linearized matrices are

A =

[

−0.0149 00 −0.0298

]

, B =

[

0.333 0.333−1.667 7.22

]

Page 162: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 161

4.(

h, TT

)

= (3m, 75). The equilibrium inputs are

u1 = qC = 0.0503 , u2 = qH = 0.2181

The linearized matrices are

A =

[

−0.0149 00 −0.0298

]

, B =

[

0.333 0.333−7.22 1.667

]

We can try a simple simulation, both in the exact nonlinear equation, and the linearization,and compare answers.

We will simulate the systemx(t) = f(x(t), u(t))

subject to the following conditions

x(0) =

[

1.1081.5

]

and

u1(t) =

0.022 for 0 ≤ t ≤ 250.043 for 25 < t ≤ 100

u2(t) =

0.14 for 0 ≤ t ≤ 600.105 for 60 < t ≤ 100

This is close to equilibrium condition #2. So, in the linearization, we will use linearization#2, and the following conditions

δx(0) = x(0) −[

175

]

=

[

0.106.5

]

and

δu1(t) := u1(t) − u1 =

−0.007 for 0 ≤ t ≤ 250.014 for 25 < t ≤ 100

δu2(t) := u2(t) − u2 =

0.014 for 0 ≤ t ≤ 60−0.021 for 60 < t ≤ 100

To compare the simulations, we must first plot x(t) from the nonlinear simulation. Thisis the “true” answer. For the linearization, we know that δx approximately governs thedeviations from x. Hence, for that simulation we should plot x + δx(t). These are shownbelow for both h and TT .

Page 163: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 162

0 10 20 30 40 50 60 70 80 90 1001

1.05

1.1

1.15

1.2

1.25

1.3Water Height: Actual (solid) and Linearization (dashed)

Met

ers

0 10 20 30 40 50 60 70 80 90 10066

68

70

72

74

76

78

80

82Water Temp: Actual (solid) and Linearization (dashed)

Deg

rees

Time

18.4 Linearizing about general solution

In section 18.2, we discussed the linear differential equation which governs small deviationsaway from an equilibrium point. This resulted in a linear, time-invariant differential equation.

Often times, more complicated situations arise. Consider the task of controlling a rockettrajectory from Earth to the moon. By writing out the equations of motion, from Physics,we obtain state equations of the form

x(t) = f(x(t), u(t), d(t), t) (76)

where u is the control input (thrusts), d are external disturbances.

Page 164: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 163

Through much computer simulation, a preplanned input schedule is developed, which, underideal circumstances (ie., d(t) ≡ 0), would get the rocket from Earth to the moon. Denotethis preplanned input by u(t), and the ideal disturbance by d(t) (which we assume is 0).This results in an ideal trajectory x(t), which solves the differential equation,

˙x(t) = f(

x(t), u(t), d(t), t)

Now, small nonzero disturbances are expected, which lead to small deviations in x, whichmust be corrected by small variations in the pre-planned input u. Hence, engineers need tohave a model for how a slightly different input u(t) + δu(t) and slightly different disturbanced(t) + δd(t) will cause a different trajectory. Write x(t) in terms of a deviation from x(t),defining δx(t) := x(t) − x(t), giving

x(t) = x(t) + δx(t)

Now x, u and d must satisfy the differential equation, which gives

x(t) = f (x(t), u(t), d(t), t)˙x(t) + δx(t) = f

(

x(t) + δx(t), u(t) + δu(t), d(t) + δd(t), t)

≈ f (x(t), u(t), 0, t) + ∂f∂x

∣∣∣x(t)=x(t)

u(t)=u(t)d(t)=d(t)

δx(t) + ∂f∂u

∣∣∣x(t)=x(t)

u(t)=u(t)d(t)=d(t)

δu(t) + ∂f∂d

∣∣∣x(t)=x(t)

u(t)=u(t)d(t)=d(t)

δd(t)

But the functions x and u satisfy the governing differential equation, so ˙x(t) = f (x(t), u(t), 0, t),leaving the (approximate) governing equation for δx

δx(t) =∂f

∂x

∣∣∣∣∣x(t)=x(t)

u(t)=u(t)d(t)=d(t)

δx(t) +∂f

∂u

∣∣∣∣∣x(t)=x(t)

u(t)=u(t)d(t)=d(t)

δu(t) +∂f

∂d

∣∣∣∣∣x(t)=x(t)

u(t)=u(t)d(t)=d(t)

δd(t)

Define time-varying matrices A, B1 and B2 by

A(t) :=∂f

∂x

∣∣∣∣∣x(t)=x(t)u(t)=u(t)d(t)=d(t)

B1(t) :=∂f

∂u

∣∣∣∣∣x(t)=x(t)u(t)=u(t)d(t)=d(t)

B2(t) :=∂f

∂d

∣∣∣∣∣x(t)=x(t)u(t)=u(t)d(t)=d(t)

The deviation variables are approximately governed by

δx(t) = A(t)δx(t) +B1(t)δu(t) +B2(t)δd(t) = A(t)δx(t) +[

B1(t) B2(t)][

δu(t)δd(t)

]

This is called the linearization of system (76) about the trajectory(

x, u, d)

. This type oflinearization is a generalization of linearizations about equilibrium points. Linearizing aboutan equilibrium point yields a LTI system, while linearizing about a trajectory yields an LTVsystem.

In general, these types of calculations are carried out numerically,

Page 165: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 164

• simulink to get solution x(t) given particular inputs u(t) and d(t)

• Numerical evaluation of ∂f∂x

, etc, evaluated at the solution points

• Storing the time-varying matrices A(t), B1(t), B2(t) for later use

In a simple case it is possible to analytically determine the time-varying matrices.

Page 166: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 165

18.5 Problems

1. The temperature in a particular 3-dimensional solid is a function of position, and isknown to be

T (x, y, z) = 42 + (x− 2)2 + 3 (y − 4)2 − 5 (z − 6)2 + 2yz

(a) Find the first order approximation (linearization) of the temperature near thelocation (4, 6, 0). Use δx, δy and δz as your deviation variables.

(b) What is the maximum error between the actual temperature and the first orderapproximation formula for |δx| ≤ 0.3, |δy| ≤ 0.2, |δz| ≤ 0.1. You may use Matlabto solve this numerically, or analytically if you wish. If you do it analytically,remember how to do it. First, compute the error at the 8 corners of the“cube.”Then, using calculus, look along all 8 edges, and find critical points (where thesingle partial derivative vanishes). Then, look on all 6 faces to find critical points(where both partial derivative vanish). Finally, look inthe cube for critical points(where all 3 partial derivatives vanish). The maximum (and minimum) must beat one of these numerous points.

(c) More generally, suppose that x ∈ R, y ∈ R, z ∈ R. Find the first order approxi-mation of the temperature near the location (x, y, z).

2. The pitching-axis of a tail-fin controlled missile is governed by the nonlinear stateequations

α(t) = K1Mfn (α(t),M) cosα(t) + q(t)q(t) = K2M

2 [fm (α(t),M) + Eu(t)]

Here, the states are x1 := α, the angle-of-attack, and x2 := q, the angular velocity ofthe pitching axis. The input variable, u, is the deflection of the fin which is mountedat the tail of the missile. K1, K2, and E are physical constants, with E > 0. M is thespeed (Mach) of the missile, and fn and fm are known, differentiable functions (fromwind-tunnel data) of α and M . Assume that M is a constant, and M > 0.

(a) Show that for any specific value of α, with |α| < π2, there is a pair (q, u) such that

[

αq

]

, u

is an equilibrium point of the system (this represents a turn at a constant rate).Your answer should clearly show how q and u are functions of α, and will mostlikely involve the functions fn and fm.

(b) Calculate the Jacobian Linearization of the missile system about the equilibriumpoint. Your answer is fairly symbolic, and may depend on partial derivatives of thefunctions fn and fm. Be sure to indicate where the various terms are evaluated.

3. (Taken from “Introduction to Dynamic Systems Analysis,” T.D. Burton, 1994) Letf1(x1, x2) := x1 − x3

1 + x1x2, and f2(x1, x2) := −x2 + 1.5x1x2. Consider the 2-statesystem x(t) = f(x(t)).

Page 167: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 166

(a) Note that there are no inputs. Find all equilibrium points of this system. Hint:In this problem, there are 4 equilibrium points.

(b) Derive the Jacobian linearization which describes the solutions near each equilib-rium point. You will have 4 different linearizations, each of the form

δx(t) = Aδx(t)

with different A matrices dependent on which equilibrium point the linearizationhas been computed.

(c) Using eigenvalues, determine the stability of each of 4 Jacobian linearizations.Note: (for part 3e below) If the linearization is stable, it means that while thedeviation of x(t) from x remains small, the variables x(t)−x approximately evolveby a linear differential equation whose homogenous solutions all decay to zero. So,we would expect that initial conditions near the equilibium point would convergeto the equilibrium point. Conversely, if the linearization is unstable, it meansthat while the deviation of x(t) from x remains small, the variables x(t) − xapproximately evolve by a linear differential equation that has some homogenoussolutions which grow. So, we would expect that some initial conditions near theequilibium point would initially diverge away from the equilibrium point.

(d) Using Simulink, simulate the system starting from 30 random initial conditionssatisfying −3 ≤ x1(0) ≤ 3, and −3 ≤ x2(0) ≤ 3. Plot the resulting solutions inx2 versus x1 plane (each solution will be a curve - parametrized by time t). Thisis called a phase plane graph. Make the axis limits −4 ≤ xi ≤ 4. On each curve,hand-draw in arrow(s) indicating which direction is increasing time. Mark the 4equilibrium points on your graph.

(e) Make note of the solution curves near the equilibrium points, and how the curvesrelate to the stability computation in part 3c.

Hints: The simulation can be “built” using 2 integrators (from Continuous), aMux and Demux from Signal Routing, and a Matlab Fcn block from User-defined

Functions. This is shown below.

Since some initial conditions will lead to diverging solutions, it is best to stop thesimulation when either x1(t) ≥ 10 (say) or x2(t) ≥ 10. Use a Stop Simulation block(from Sinks), with its input coming from the Relational Operator (from Math).

Page 168: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 167

x2data

To Workspace1

x1data

To Workspace

STOP

Stop Simulation1

STOP

Stop Simulation

>=

RelationalOperator1

>=

RelationalOperator

MATLABFunction

MATLAB Fcn

1s

Integrator1

1s

Integrator

Demux

R+5

Constant1

R+5

Constant

4. A hoop (of radius R) is mounted vertically, and rotates at a constant angular velocityΩ. A bead of mass m slides along the hoop, and θ is the angle that locates the beadlocation. θ = 0 corresponds to the bead at the bottom of the hoop, while θ = πcorresponds to the top of the hoop.

The nonlinear, 2nd order equation (from Newton’s law) governing the bead’s motion

Page 169: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 168

ismRθ +mg sin θ + αθ −mΩ2R sin θ cos θ = 0

All of the parameters m,R, g, α are positive.

(a) Let x1(t) := θ(t) and x2(t) := θ(t). Write the 2nd order nonlinear differentialequation in the state-space form

x1(t) = f1 (x1(t), x2(t))x2(t) = f2 (x1(t), x2(t))

(b) Show that x1 = 0, x2 = 0 is an equilibrium point of the system.

(c) Find the linearized systemδx(t) = Aδx(t)

which governs small deviations away from the equilibrium point (0, 0).

(d) Under what conditions (on m,R,Ω, g) is the linearized system stable?

(e) Show that x1 = π, x2 = 0 is an equilibrium point of the system.

(f) Find the linearized system δx(t) = Aδx(t) which governs small deviations awayfrom the equilibrium point (π, 0).

(g) Under what conditions is the linearized system stable?

(h) It would seem that if the hoop is indeed rotating (with angular velocity Ω) thenthere would other equilibrium point (with 0 < θ < π/2). Do such equilibriumpoints exist in the system? Be very careful, and please explain your answer.

(i) Find the linearized system δx(t) = Aδx(t) which governs small deviations awayfrom this equilibrium point.

(j) Under what conditions is the linearized system stable?

Page 170: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 169

5. Car Engine Model (the reference for this problem is Cho and Hedrick, “AutomotivePowertrain Modelling for Control,” ASME Journal of Dynamic Systems, Measurementand Control, vol. 111, No. 4, December 1989): In this problem we consider a 1-statemodel for an automotive engine, with the transmission engaged in 4th gear. The enginestate is ma, the mass of air (in kilograms) in the intake manifold. The state of thedrivetrain is the angular velocity, ωe, of the engine. The input is the throttle angle, α,(in radians). The equations for the engine is

ma(t) = c1T (α(t)) − c2ωe(t)ma(t)Te = c3ma(t)

where we treat ωe and α as inputs, and Te as an output. The drivetrain is modeled

ωe(t) =1

Je[Te(t) − Tf (t) − Td(t) − Tr(t)]

The meanings of the terms are as follows:

• T (α) is a throttle flow characteristic depending on throttle angle,

T (α) =

0.00032 for α < 01 − cos (1.14α− 0.0252) for 0 ≤ α ≤ 1.4

1 for α > 1.4

• Te is the torque from engine on driveshaft, c3 = 47500 Nm/kg.

• Tf is engine friction torque (Nm), Tf = 0.106ωe + 15.1

• Td is torque due to wind drag (Nm), Td = c4ω2e , with c4 = 0.0026 Nms2

• Tr is torque due to rolling resistance at wheels (Nm), Tr = 21.5.

• Je is the effective moment of inertia of the engine, transmission, wheels, car,Je = 36.4kgm2

• c1 = 0.6kg/s, c2 = 0.095

• In 4th gear, the speed of car, v (m/s), is related to ωe as v = 0.129ωe.

(a) Combine these equations into state variable form.

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

where x1 = ma, x2 = ωe, u = α and y = v.

(b) For the purpose of calculating the Jacobian linearization, explicitly write out thefunction f(x, u) (without any t dependence). Note that f maps 3 real numbers(x1, x2, u) into 2 real numbers. There is no explicit time dependence in thisparticular f .

Page 171: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 170

(c) Compute the equilibrium values of ma, ωe and α so that the car travels at aconstant speed of 22 m/s (let v denote the equilibrium speed). Repeat calculationfor an equilibrium speed of v = 32 m/s. Make sure your formula are clear enoughthat you repeat this at any value of v.

(d) Consider deviations from these equilibrium values,

α(t) = α + δα(t)ωe(t) = ωe + δωe

(t)ma(t) = ma + δma

(t)y(t) = y + δy(t)

Find the (linear) differential equations that approximately govern these deviationvariables (Jacobian Linearzation discussed in class), in both the 22 m/s and 32m/s cases.

(e) Using Simulink, starting from the initial condition ωe(0) = ωe, ma(0) = ma,apply a step input of

α(t) = α + β

for 6 values of β, β = ±0.01,±0.04,±0.1 and obtain the response for v and ma.

(f) Also using Simulink (you can use the State-Space block from Continuous),compute the response of the Jacobian linearization starting from initial conditionδωe

(0) = 0 and δma(0) = 0, with the input δα(t) = β for for 6 values of β, β =

±0.01,±0.04,±0.1. Add the responses δωe(t) and δma

(t) to the equilibrium valuesωe, ma and plot these sums, which are approximations of the actual response.Compare the linearized response with the actual response from part 5e Commenton the difference between the results of the “true” nonlinear simulation and theresults from the linearized analysis. Note: do this for both the equilibrium points– at 22 m/s and at 32 m/s.

(g) Using Simulink, again starting from the equilibrium point computed inpart 5c apply a sinusoidal throttle angle of

α(t) = α + β sin(0.5t)

for 3 values of β, β = 0.01, 0.04, 0.1 and obtain the response for v and ma. Doan analogous simulation for the linearized system, and appropriately compare theresponses. Comment on the difference between the results of the “true” nonlinearsimulation and the results from the linearized analysis. Again, do this for bothcases.

6. In this problem, we will approximate the 2nd order linearization by a lower-order linearsystem.

(a) At v m/s, compute the equilibrium values, and write the linearized equation thatapproximately governs the deviation variables. Eveything should be a function ofv.

Page 172: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 171

(b) Write the transfer function (from δu to δy) of the linearized car model at v m/s

(c) Decompose this transfer function into the form

G(s) =1

(τ1s + 1)

γ

(τ2s+ 1)

where τ1 < τ2. Specifically, find the 2nd order polynomial (coefficients are func-tions of the equilibrium velocity, v) whose roots are −1

τ1and −1

τ2. Also, find the

expression (in terms of v) for γ. Hence, G is the cascade of two first-order systems:

• A system with steady-state gain 1, and time constant τ1

• A system with steady-state gain γ, and time constant τ2

Since τ1 < τ2, we will approximate G with

Gapp(s) :=γ

τ2s+ 1

Note that G and Gapp depend on v.

(d) Plot γ, τ1 and τ2 as functions of v for 22 ≤ v ≤ 32.

7. In this problem, we will design a cruise-control system for the linearized model of thecar at arbitrary speed of v.

(a) Pick a value of v, say 26m/s. Design a PI controller, C for Gapp, which yieldsclosed-loop roots of the characteristic equation at ωn = 0.6, ξ = 1.1. Aroundthe equilibrium values, this controller will work well in generating the correctdeviation input δu(t) in order to regulate the deviation in velocity, δy, as shownbelow

C Gapp- - - -

6

i+

−δr(t)

δu(t)δy(t)

Here, δr is interpreted as a desired velocity deviation away from the equilibriumvalue of y.

(b) Since δr is the desired velocity deviation away from the equilibrium value of y, itmakes sense to interpret the actual velocity command r as r(t) = y+δr(t). So, thevelocity command is “near” y, but not necessarily equal to it. Therefore, we canimplement the control on the true nonlinear car/engine model, as shown below,with the equilibrium value of the throttle input shown adding to δu in order toget the correct input u.

CCar/

Engine- - - d -

6-

6

i+

−(y + δr =) r δu

u

u y (= y + δy)

Page 173: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 172

We can generate the equilibrium input α simply by setting the initial value (ie.,initial condition, as the cruise-control is activated) of the integrator to be equalto α

KI

Car/Engine

KP

KI- -

-

?- - i - -

6

i+

−r u y

Starting from equilibrium initial conditions, in the car, and with the correct initialvalue on the controller integrator, simulate the closed-loop system for the followingdesired velocity input

-

6

JJJJ

JJJJ

10 20 40

50 60 65

30

28

24

t

r(t)

(c) Notice that the undershoot at t = 50 appears to be from integrator windup. Plotz and α and verify that integrator windup has occurred.

(d) Implement an anti-windup scheme for the PI controller. The left end of thedeadzone should be 0, and the right end should be 1.4. Resimulate, and verifythat the antiwindup controller reduces the undershoot at t = 50.

(e) Using the antiwindup controller, do a family of simulations (say 50), randomlyvarying the car/engine parameters (c1, c2, ...Je,.. etc) by ±20%. Plot three vari-ables: the velocity response, the control input α, and the controller integrator sig-nal z. Note the robustness of the feedback system to variations in the car/enginebehavior. Also notice that the speed (v) is relatively insensitive to the parametervariations, but that the actual control input α is quite dependent on the varia-tions. This is the whole point of feedback control – make the regulated variableinsensitive to variations, through the use of feedback strategies which “automat-ically” cause the control variable to accomodate these variations.

8. A common actuator in industrial and construction equipment is a hydraulic device,called a hydraulic servo-valve. A diagram is below.

Page 174: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 173

AA

AA

AA

AA

AA

AA

AA

AA

AA

AA

-h

p0 pS p0

p1 p2

-y

A

AKq4 q1

AAU

q2 q3

Fe

Two resevoirs, one at high pressure, ps, called the supply, and one at low pressure, p0,called the drain. The small piston can be moved relatively easily, its position h(t) isconsidered an input. As is moves, its connects the supply/drain to opposite sides ofthe power piston, which causes significant pressure differences across the power piston,and causes it to move.

Constant Value

pS 1.4 × 107N/m2

p0 1 × 105N/m2

c1 0.02mc0 4 × 10−7m2

Ap 0.008m2

K 6.9 × 108N/m2

ρ 800kg/m3

L 1mcD 0.7mp 2.5kg

The volume in each cylinder is simply

V1(y) = Ap (L+ y)V2(y) = Ap (L− y)

Page 175: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 174

The mass flows areq1(t) = cDA1(h(t))

ρ (pS − p1(t))

q2(t) = cDA2(h(t))√

ρ (pS − p2(t))

q3(t) = cDA3(h(t))√

ρ (p2(t) − p0)

q4(t) = cDA4(h(t))√

ρ (p1(t) − p0)

The valve areas are all given by the same underlying function A(h),

A(h) =4.0 × 10−7 for h ≤ −0.00024.0 × 10−7 + 0.02(u+ 0.0002) for −0.0002 < h < 0.0051.044 × 10−4 for 0.005 < h

By symmetry, we have A1(h) = A(−h);, A2(h) = A(h);, A3(h) = A(−h);, A4(h) =A(h). Mass continuity (with compressibility) gives

q1(t) − q4(t) = ρ[

p1(t)V1(y(t))1

K+ Apy(t)

]

and

q2(t) − q3(t) = ρ[

p2(t)V2(y(t))1

K− Apy(t)

]

Finally, Newton’s law on the power piston gives

mpy(t) = Ap (p1(t) − p2(t)) − Fe(t)

(a) Why can the small piston be moved easily?

(b) Define states x1 := p1, x2 := p2, x3 := y, x4 := y. Define inputs u1 := h, u2 := Fe.Define outputs y1 := y, y2 := y, y3 := y. Write state equations of the form

x(t) = f(x(t), u(t))y = g(x(t), u(t))

(c) Suppose that the power piston is attached to a mass M , which itself is also actedon by an external force w. This imposes the condition that Fe(t) = My(t)+w(t),where w is the external force acting on the mass. Substitute this in. The “inputs”to your system will now be h and w. Although it’s bad notation, call this pair u,with u1 = h, u2 = w. You will still have 4 state equations.

(d) Develop a Simulink model of the hydraulic servovalve, attached to a mass, M .Have y and y as outputs (used for feedback later), and h and w as inputs.

(e) Let y be any number satisfying −L < y < L. With the mass attached, computethe equilibrium values p1 and p2 such that

x :=

p1

p2

y0

, u :=

[

00

]

is an equilibrium point. Hint: The value of M should not affect your answers forp1 and p2

Page 176: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 175

(f) Derive (by hand) the linearization of the system, at the equilibrium point. withu and w as the inputs. The matrices will be parametrized by all of the area, fluidparameters, as well as M and y. Make y the output.

(g) Ignoring the disturbance force w, compute the transfer function of the linearizedmodel from h to y. Denote this by Gy,M(s), since it depends on y and M . Let Mvary from 10kg to 10000kg, and let y vary from −0.8 to 0.8. Plot the Bode plotof the frequency-response function from h→ y for at least 35 combinations of Mand y, namely 7 log-spaced values of M and 5 lin-spaced values of y. Place all onone plot.

(h) There are several simulations here. Consider two different cases with M = 30kgand separately M = 10000kg. Do short duration (Final Time is small, say 0.15)response with step inputs with h := 0.0001, w = 0, and h := 0.0004, w = 0, andh := 0.001, w = 0, and h := 0.004, w = 0, and h := 0.01, w = 0. The powerpiston should accelerate to the left. Plot the power-piston y(t), normalized (ie.,divided by) by the constant value of h. (You should have 10 plots on one sheet).Note, had the system been linear, (which it is not), after normalizing by the sizeof the step, the outputs would be identical, which they are not. Comment onthe differences as the the forcing function step size gets larger (more deviationfrom equilibrium input of h = 0). Hints: Be careful with maximum step size (inParameters window), using small sizes (start with 0.0001) as well as the simulationtime. Make sure that y(t) does not exceed L. Note that a dominant aspect of thebehavior is that y is the integral (with a negative scaling factor) of h.

(i) On one figure, using many different values for M and y, plot∣∣∣∣∣

Gy,M(jω) −G0,10000(jω)

G0,10000(jω)

∣∣∣∣∣

versus ω, for ω in the range 0.01 ≤ ω ≤ 1000. This is a plot of percentage-variationof the linearized model away from the linearized model G0,10000.

(j) On one figure, using many different values for M and y, plot∣∣∣∣∣

Gy,M(jω) −Gnom(jω)

Gnom(jω)

∣∣∣∣∣

for ω in the range 0.01 ≤ ω ≤ 1000, using

Gnom :=−325

s

This is a plot of percentage-variation from Gnom.

(k) Using Gnom, design a proportional controller

h(t) = KP [r(t) − y(t)]

so that the nominal closed-loop time constant is 0.25. On the same plot as in part8j, plot the percentage variation margin. Do all of the variations lie underneaththe percentage variation margin curve?

Page 177: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 176

(l) With the nominal closed-loop time constant set to 0.25, we know that Lnom hasmagnitude less than 1 for frequencies beyond about 4 rad/sec. We can reduce thegain of L even more beyond that without changing the dominant overall responseof the closed system, but we will improve the percentage variation margin. Keep-ing KP fixed from before, insert a first-order filter in the controller, so that (intransfer function form)

H =KP

τfs+ 1[R− Y ]

Try using τf = 110

0.25. Again on the same plot as in part 8j, plot the newpercentage variation margin. Has the margin improved?

(m) Using this controller, along with the true nonlinear model, simulate the closed-loop system with 3 different reference signals, given by the (time/value) pairslisted below. Do this for three different values for M , namely 30, 2000, and 10000kg.

Time Case 1 Case 2 Case 30 0 0 01 0.05 0.25 0.753 0.05 0.25 0.755 -0.025 -0.125 -0.37510 -0.025 -0.125 -0.37512 0 0 014 0 0 0

Between points, the reference signal changes linearly, connecting the points withstraight lines. Plot the resulting trajectory y, along with r. Comment on theperformance of the closed-loop system.

9. In ??, we derived a complex model for a hydraulic servo-valve, taking compressibility ofthe hydraulic fluid into account. In this problem, we derive a model for incompressiblefluid, which is much simpler, and gives us a good, simplified, “starting point” modelfor the servovalve’s behavior. The picture is as before, but with ρ constant (though p1

and p2 are still functions of time – otherwise the piston would not move...).

(a) Assume that the forces from the environment are such that we always have p0 <p1(t) < ps and p0 < p2(t) < ps. Later, we will check what limits this imposeson the environment forces. Suppose that u > 0. Recall that flow into side 1 is

ch(t)√

ρ (ps − p1(t)), and flow out of side 2 is ch(t)√

ρ (p2(t) − p0), where is c issome constant reflecting the discharge coefficient, and the relationship betweenorifice area and spool displacement (h). Show that it must be that

ps + p0 = p1(t) + p2(t)

(b) Let ∆(t) := p1(t) − p2(t). Show that

p1(t) =ps + p0 + ∆(t)

2, p2(t) =

ps + p0 − ∆(t)

2

Page 178: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 177

(c) Assuming that the mass of the piston is very small, show that

Ap∆(t) + FE(t) = 0

(d) Show that p0 < p1(t) < ps for all t if and only if

|FE(t)| ≤ Ap (ps − p0)

Show that this is also necessary and sufficient for p0 < p2(t) < ps to hold for all t.

(e) Show that the velocity of the piston y is given by

ρApy(t) = ch(t)

√√√√ρ

[

ps − p0

2− ∆(t)

2

]

(f) Manipulate this into the form

y(t) =c

ρAph(t)

√√√√ρ

[

ps − p0

2+FE(t)

2Ap

]

(77)

Hence, the position of the piston y(t) is simply the integral of a nonlinear functionof the two “inputs,” h and FE.

(g) Go through the appropriate steps for the case h < 0 to derive the relationship inthat case.

(h) Suppose y and F are constants. Show that the “triple” (y, h = 0, F ) is an equi-librium point of the system described in equation (77).

(i) What is the linear differential equation governing the behavior near the equilib-rium point?

10. A satellite is in a planar orbit around the earth, with coordinates as shown below.

The equations of motion are

m [r(t) − r(t)ω(t)] = − Kr2(t)

m [ω(t) + 2r(t)ω(t)] = u(t)

Page 179: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 178

where u is a force input provided by thrusters mounted in the tangential direction.Define states as x1 := r, x2 := r, x3 := ω.

(a) Define states for the system (with u as the input), and write down state equations.

(b) For a given value x3 = ω > 0, determine values for x1, x2, and u to give anequilibrium point.

(c) What is the physical interpretation of this particular equilibrium point?

(d) Calculate the linearization about the equilibrium point.

(e) Is the linearized system stable?

(f) Propose, derive, and fully explain a feedback control system which stabilizes thelinearized system. Document all steps, and mention any sensors (measurements)your control system will need to make.

Page 180: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 179

19 Linear Systems and Time-Invariance

We have studied the governing equations for many types of systems. Usually, these arenonlinear differential equations which govern the evolution of the variables as time progresses.In section 18.2, we saw that we could “linearize” a nonlinear system about an equilibriumpoint, to obtain a linear differential equation which giverns the approximate behavior of thesystem near the equilibrium point. Also, in some systems, the governing equations werealready linear. Linear differential equations are important class of systems to study, andthese are the topic of the next several section.

19.1 Linearity of solution

Consider a vector differential equation

x(t) = A(t)x(t) +B(t)d(t)x(t0) = x0

(78)

where for each t, A(t) ∈ Rn×n, B(t) ∈ Rn×m, and for each time t, x(t) ∈ Rn and d(t) ∈ Rm.

Claim: The solution function x(·), on any interval [t0, t1] is a linear function of the pair(

x0, d(t)[t0 t1]

)

.

The precise meaning of this statement is as follows: Pick any constants α, β ∈ R,

• if x1 is the solution to (81) starting from initial condition x1,0 (at t0) and forced withinput d1, and

• if x2 is the solution to (81) starting from initial condition x2,0 (at t0) and forced withinput d2,

then αx1 +βx2 is the solution to (81) starting from initial condition αx1,0 +βx2,0 (at t0) andforced with input αd1(t) + βd2(t).

This can be easily checked, note that for every time t, we have

x1(t) = A(t)x1(t) +B(t)d1(t)x2(t) = A(t)x2(t) +B(t)d2(t)

Multiply the first equation by the constant α and the second equation by β, and add themtogether, giving

ddt

[αx1(t) + βx2(t)] = αx1(t) + βx2(t)= α [Ax1(t) +Bd1(t)] + β [Ax2(t) +Bd2(t)]= A [αx1(t) + βx2(t)] +B [αd1(t) + βd2(t)]

Page 181: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 180

which shows that the linear combination αx1+βx2 does indeed solve the differential equation.

The initial condition is easily checked. Finally, the existence and uniqueness theorem fordifferential equations tells us that this (αx1 + βx2) is the only solution which satisfies boththe differential equation and the initial conditions.

Linearity of the solution in the pair (initial condition, forcing function) is often called ThePrincipal of Superposition and is an extremely useful property of linear systems.

19.2 Time-Invariance

A separate issue, unrelated to linearity, is time-invariance. A system described by x(t) =f(x(t), d(t), t) is called time-invariant if (roughly) the behavior of the system does dependexplicitly on the absolute time. In other words, shifting the time axis does not affect solutions.

Precisely, suppose that x1 is a solution for the system, starting from x10 at t = t0 subject tothe forcing d1(t), defined for t ≥ t0.

Now, let x be the solution to the equations starting from x0 at t = t0 + ∆, subject to theforcing d(t) := d(t− ∆), defined for t ≥ t0 + ∆. Suppose that for all choices of t0,∆, x0 andd(·), the two responses are related by x(t) = x(t − ∆) for all t ≥ t0 + ∆. Then the systemdescribed by x(t) = f(x(t), d(t), t) is called time-invariant.

In practice, the easiest manner to recognize time-invariance is that the right-hand side of thestate equations (the first-order differential equations governing the process) do not explicitlydepend on time. For instance, the system

x1(t) = 2 ∗ x2(t) − sin [x1(t)x2(t)d2(t)]x2(t) = − |x2(t)| − x2(t)d1(t)

is nonlinear, yet time-invariant.

Page 182: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 181

20 Linear Algebra Review

20.1 Notation

1. R denotes the set of real numbers, C denotes the set of complex numbers. If weuse F, it means that within a definition/theorem/proof every occurance of F can beinterpreted either as R or C.

2. Rn will denote the set of all n× 1 vectors with real entries. Cn will denote the set ofall n× 1 vectors with complex entries. If v ∈ Fn, then vi denotes the i’th entry of v.

3. Rn×m denotes the set of all real, n ×m matrices. Here, the first integer denotes thenumber of rows, and the second integer denotes the number of columns. Similarly,Cn×m denotes the set of complex n × m matrices. If A ∈ Fn×m, then Aij (usually)denotes the (i, j)’th entry of v (i’th row, j’th column).

4. Addition of vectors: if v ∈ Fn and u ∈ Fn, then the sum u+ v ∈ Fn is defined by

(v + u)i := vi + ui

5. Addition of matrices: if A ∈ Fn×m and B ∈ Fn×m, then the sum A + B ∈ Fn×m isdefined by

(A+B)ij := Aij +Bij

6. Scalar multiplication: if α ∈ F and v ∈ Fn, then the product αv ∈ Fn is defined by

(αv)i := αvi

7. Scalar multiplication: if α ∈ F and A ∈ Fn×m, then the product αA ∈ Fn×m is definedby

(αA)ij := αAij

8. Matrix-Vector multiplication: if A ∈ Fn×m and v ∈ Fm, then the product Av ∈ Fn isdefined by

(Av)i :=m∑

j=1

Aijvj

9. Matrix-Matrix Multiplication: if A ∈ Fn×m and B ∈ Fm×p, then the product AB ∈Fn×p is defined by

(AB)ij :=m∑

k=1

AikBkj

10. Suppose x, y, z ∈ Fn and α, β ∈ F, then

• Addition is commutative and associative

x+ y = y + x, x + (y + z) = (x + y) + z

Page 183: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 182

• The zero vector 0n is the only vector such that x + 0n = x for all x ∈ Fn

• For each x ∈ Rn the vector −x is the unique vector such that

x + (−x) = 0

• Scalar multiplication is associative and distributive with respect to scalar addition

α(βx) = (αβ)x, (α + β)x = αx+ βx

• Scalar multiplication is distributive with respect to vector addition

α(x+ y) = αx + αy

11. Matrix addition is commutative, so for every matrix A and B of the same dimensions,

A+B = B + A

12. For every A,B ∈ Fn×m and every x, y ∈ Fm,

A(x + y) = Ax + Ay, (A+B)x = Ax+Bx

Hence vector addition distributes across matrix-vector multiplication, and matrix ad-dition distributes across matrix-vector multiplication.

13. Matrix multiplication is associative, so for every A ∈ Fn×p, B ∈ Fp×q, A ∈ Fq×m

A(BC) = (AB)C

14. For every A ∈ Fn×m, α ∈ F, and x ∈ Fm,

A(αx) = α(Ax) = (αA)x

15. Block Partitioned Matrices: Suppose that n1 + n2 = n,m1 +m2 = m, p1 + p2 = p. LetA ∈ Fn×m and B ∈ Fm×p be partitioned as

A =

[

A11 A12

A21 A22

]

B =

[

B11 B12

B21 B22

]

with each Aij ∈ Fni×mj and Bjk ∈ Fmj×pk . Then

AB =

[

A11B11 + A12B21 A11B12 + A12B22

A21B11 + A22B21 A21B12 + A22B22

]

Why is this easy to remember?

Page 184: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 183

20.2 Determinants

1. Definition: If A ∈ F1×1, A = a11, then det (A) := a11.

2. Definition: If A ∈ Fn×n, then the (n − 1) × (n − 1) matrix obtained by eliminatingthe i’th row and j’th column is denoted A(i;j).

3. Definition: If A ∈ Fn×n, then det (A) is defined in terms of determinants of (n− 1)×(n− 1) matrices,

det (A) :=n∑

j=1

a1j(−1)1+j det[

A(1;j)

]

4. Theorem: Given A ∈ Fn×n, and integers p, q with 1 ≤ p, q ≤ n,

det (A) =n∑

j=1

apj(−1)p+j det[

A(p;j)

]

=n∑

i=1

aiq(−1)i+q det[

A(i;q)

]

5. Given A ∈ Fn×n. The following are true:

(a) if all elements of any row (or column) are zero, then det (A) = 0

(b) if all elements of any row (or column) are multiplied by a constant c to yield A,

then det(

A)

= c det (A)

(c) if c is a scalar, then det (cA) = cn det (A)

(d) if A has two equal columns (or rows), then det (A) = 0

(e) If one column (or row) is a multiple of a different column, then det (A) = 0

(f) Interchanging two columns (or rows) of A to yield A gives det(

A)

= − det (A).

(g) det (A) = det(

AT)

6. X, Y ∈ Cn×n, thendet (XY ) = det (X) det (Y )

7. If X ∈ Cn×n, Z ∈ Cm×m Y ∈ Cn×m, then

det

([

X Y0 Z

])

= det (X) det (Z)

8. Suppose X ∈ Cn×m and Y ∈ Cm×n. Then

det (In +XY ) = det (Im + Y X)

Note: This holds for any dimensions n and m.

Page 185: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 184

20.3 Inverses

1. Definition: A ∈ Fn×m. If there is a matrix G ∈ Fm×n such that GA = Im, then A isleft-invertible, and G is a left inverse of A.

2. Definition: A ∈ Fn×m. If there is a matrix H ∈ Fm×n such that AH = In, then A isright-invertible, and H is a right inverse of A.

3. Let A ∈ Fn×m and b ∈ Fn be given. Consider the linear equation Ax = b.

(a) If A has a left inverse, then there is at most one solution x to the equation Ax = b

(b) If A has a right inverse, then there is a solution x to the equation Ax = b (thoughit may not be unique)

4. Theorem: If A has a left and right inverse, then they are the same, and are unique(and denoted A−1). Furthermore, it must be that A is square.

5. Definition: If A is square, and has a left and right inverse, then A is called nonsin-gular and/or invertible; if A does not have an inverse, then A is called singular.

6. If A and B are square nonsingular matrices of the same dimension, then

• A−1 is invertible, and (A−1)−1

= A

• (AB) is invertible, and (AB)−1 = B−1A−1

7. For any X ∈ Cn×n, there is a matrix adj(X) ∈ Cn×n such that

adj(X)X = Xadj(X) = det(X)In.

The (i, j) element of adj(X) is

(−1)i+j det[

A(j;i)

]

8. For any X ∈ Cn×n, X is nonsingular (invertible) if and only if det (X) 6= 0.

9. If X ∈ Cn×n and Z ∈ Cm×m are invertible, then for every Y ∈ Cn×m the matrix[

X Y0 Z

]

is invertible, and the inverse is[

X Y0 Z

]−1

=

[

X−1 −X−1Y Z−1

0 Z−1

]

10. Suppose X ∈ Cn×m and Y ∈ Cm×n. Then (In +XY ) is invertible if and only if(Im + Y X) is invertible. Moreover, if either (and hence both) is invertible,

(In +XY )−1 = In −X (Im + Y X)−1 Y

(Im + Y X)−1 = Im − Y (In +XY )−1X

Also(In +XY )−1X = X (Im + Y X)−1

Page 186: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 185

20.4 Solving Linear equations: Gaussian Elimination

Consider the linear equations

2x1 − 3x2 + 2x3 + 5x4 = 3x1 − x2 + x3 + 2x4 = 1

3x1 + 2x2 + 2x3 + x4 = 0x1 + x2 − 3x3 − x4 = 0

Gaussian Elimination reduces this system of 4 equations in 4 unknowns to a system of3 equations in 3 unknowns by using 1 of the equations to eliminate one of the unknownsfrom the other 3 equations. Then the set of 3 equations/unknowns is reduced to a set of 2equations/unknowns, and finally reduced to 1 equation/unknown, which is solved, and therecursively backsubstituted into the larger problems, getting all of the solution.

One possible path to the solution is as follows:

Multiply the 1st equation by 1/2, and subtract appropriate multiples from the other equa-tions to get

x1 − 1.5x2 + x3 + 2.5x4 = 1.5− 0.5x2 + − 0.5x4 = −0.5

6.5x2 − x3 − 6.5x4 = −4.52.5x2 − 4x3 − 3.5x4 = −1.5

Multiply the 2nd equation by −2, and subtract appropriate multiples from the other equa-tions to get

x1 + x3 + x4 = 0x2 − x4 = −1

−x3 = 2− 4x3 − x4 = 1

Multiply the 3rd equation by −1, and subtract appropriate multiples from the other equa-tions to get

x1 + x4 = 2x2 − x4 = −1

x3 = −2− x4 = −7

Multiply the 4th equation by −1, and subtract appropriate multiples from the other equa-tions to get

x1 = −5x2 = 6

x3 = −2x4 = 7

Page 187: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 186

What we really were doing here was operating on the matrix [A b] ∈ R4×5,

2 −3 2 5 31 −1 1 2 13 2 2 1 01 1 −3 −1 0

with elementary row operations (EROs), to reduce it to row-echeleon form. Recall thatelementary row operations are

1. multiply a row by a scalar

2. interchange 2 rows

3. replace a row by (itself + scalar multiple of another row)

20.5 Matrix functions of Time

Suppose that A is a matrix function of time, so that for each t ∈ R, A(t) ∈ Rn×m. We writethis as A : R → Rn×m. If each entry Aij of A is differentiable, then the derivative of A issimply the matrix of derivatives of the individual entries,

A(t) :=

ddtA11(t)

ddtA12(t) · · · d

dtA1m(t)

ddtA21(t)

ddtA22(t) · · · d

dtA2m(t)

......

. . ....

ddtAn1(t)

ddtAn2(t) · · · d

dtAnm(t)

Hence, the notation Aij is an ok notation, since you can interpret it to mean either the (i, j)entry of the matrix A, or the derivative of the (i, j) entry of A (since they are the samething).

Similarly, assume that B : R → Rm×q. Hence, we can define the product C := AB, simplyby taking the matrix product at each time, so that C : R → Rn×q. with

C(t) = A(t)B(t)

for each t ∈ R. It is easy to verify that the product rule holds, namely,

C(t) = A(t)B(t) + A(t)B(t)

Indeed, the (i, j) entry of C is

Cij =m∑

k=1

AikBkj

These are all scalar functions, so if we differentiate, we get

Cij =m∑

k=1

(

AikBkj + AikBkj

)

Page 188: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 187

Note that the first term is just the (i, j) entry of the matrix product AB, and the secondterm is just the (i, j) entry of the matrix product AB. Hence for all 1 ≤ i ≤ n and 1 ≤ j ≤ q,

Cij =[

AB]

ij+[

AB]

ij

which is longhand for writingC = AB + AB

Page 189: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 188

21 Linear State-Space Representations

First, let’s describe the most general type of dynamic system that we will consider/encounterin this class. Systems may have many inputs, and many outputs. Specifically, m inputs(denoted by d) and q outputs (denoted by e), and the input/output behavior is governed bya set of n, 1st order, coupled differential equations, of the form

x1(t)x2(t)

...xn(t)e1(t)e2(t)

...eq(t)

=

f1 (x1(t), x2(t), . . . , xn(t), d1(t), d2(t), . . . , dm(t), t)f2 (x1(t), x2(t), . . . , xn(t), d1(t), d2(t), . . . , dm(t), t)

...fn (x1(t), x2(t), . . . , xn(t), d1(t), d2(t), . . . , dm(t), t)h1 (x1(t), x2(t), . . . , xn(t), d1(t), d2(t), . . . , dm(t), t)h2 (x1(t), x2(t), . . . , xn(t), d1(t), d2(t), . . . , dm(t), t)

...hq (x1(t), x2(t), . . . , xn(t), d1(t), d2(t), . . . , dm(t), t)

(79)

where the functions fi, hi are given functions of the n variables x1, x2, . . . , xn, the m variablesd1, d2, . . . , dm and also explicit functions of t.

For shorthand, we write (79) as

x(t) = f (x(t), d(t), t)e(t) = h (x(t), d(t), t)

(80)

Given an initial condition vector x0, and a forcing function d(t) for t ≥ t0, we wish to solvefor the solutions

x(t) =

x1(t)x2(t)

...xn(t)

, e(t) =

e1(t)e2(t)

...eq(t)

on the interval [t0 , tF ], given the initial condition

x (t0) = x0.

and the input forcing function d(·).

If the functions f and u are “reasonably” well behaved in x and t, then the solution exists,is continuous, and differentiable at all points.

21.1 Linearity of solution

Consider a vector differential equation

x(t) = A(t)x(t) +B(t)d(t)x(t0) = x0

(81)

Page 190: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 189

where for each t, A(t) ∈ Rn×n, B(t) ∈ Rn×m, and for each time t, x(t) ∈ Rn and d(t) ∈ Rm.

Claim: The solution function x(·), on any interval [t0, t1] is a linear function of the pair(

x0, d(t)[t0 t1]

)

.

The precise meaning of this statement is as follows: Pick any constants α, β ∈ R,

• if x1 is the solution to (81) starting from initial condition x1,0 (at t0) and forced withinput d1, and

• if x2 is the solution to (81) starting from initial condition x2,0 (at t0) and forced withinput d2,

then αx1 +βx2 is the solution to (81) starting from initial condition αx1,0 +βx2,0 (at t0) andforced with input αd1(t) + βd2(t).

This can be easily checked, note that for every time t, we have

x1(t) = A(t)x1(t) +B(t)d1(t)x2(t) = A(t)x2(t) +B(t)d2(t)

Multiply the first equation by the constant α and the second equation by β, and add themtogether, giving

ddt

[αx1(t) + βx2(t)] = αx1(t) + βx2(t)= α [Ax1(t) +Bd1(t)] + β [Ax2(t) +Bd2(t)]= A [αx1(t) + βx2(t)] +B [αd1(t) + βd2(t)]

which shows that the linear combination αx1+βx2 does indeed solve the differential equation.

The initial condition is easily checked. Finally, the existence and uniqueness theorem fordifferential equations tells us that this (αx1 + βx2) is the only solution which satisfies boththe differential equation and the initial conditions.

Linearity of the solution in the pair (initial condition, forcing function) is often called ThePrincipal of Superposition and is an extremely useful property of linear systems.

21.2 Time-Invariance

A separate issue, unrelated to linearity, is time-invariance. A system described by x(t) =f(x(t), d(t), t) is called time-invariant if (roughly) the behavior of the system does dependexplicitly on the absolute time. In other words, shifting the time axis does not affect solutions.

Precisely, suppose that x1 is a solution for the system, starting from x10 at t = t0 subject tothe forcing d1(t), defined for t ≥ t0.

Page 191: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 190

Now, let x be the solution to the equations starting from x0 at t = t0 + ∆, subject to theforcing d(t) := d(t− ∆), defined for t ≥ t0 + ∆. Suppose that for all choices of t0,∆, x0 andd(·), the two responses are related by x(t) = x(t − ∆) for all t ≥ t0 + ∆. Then the systemdescribed by x(t) = f(x(t), d(t), t) is called time-invariant.

In practice, the easiest manner to recognize time-invariance is that the right-hand side of thestate equations (the first-order differential equations governing the process) do not explicitlydepend on time. For instance, the system

x1(t) = 2 ∗ x2(t) − sin [x1(t)x2(t)d2(t)]x2(t) = − |x2(t)| − x2(t)d1(t)

is nonlinear, yet time-invariant.

For the next few sections, we focus entirely on systems that are linear and time-invariant.This is not any different than the systems governed by our standard ODE model, introducedin Section 7. However, the representation is different, namely lots of coupled 1st orderequations, rather than one big n’th order equation. We will derive all of the same ideas fromthis perspective: general solution, stability, frequency response, transfer function.

Page 192: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 191

21.3 Matrix Exponential

Recall that for the scalar differential equation

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

x(t0) = x0

the solution for t ≥ t0 is given by the formula

x(t) = ea(t−t0)x0 +∫ t

t0ea(t−τ)bu(τ)dτ

What makes this work is the special structure of the exponential function, namely that

d

dteat = aeat.

Now consider a vector differential equation

x(t) = Ax(t) +Bu(t)

x(t0) = x0

(82)

where A ∈ Rn×n, B ∈ Rn×m are constant matrices, and for each time t, x(t) ∈ Rn andu(t) ∈ Rm. The solution can be derived by proceeding analogously to the scalar case.

For a matrix A ∈ Cn×n define a matrix function of time, eAt ∈ Cn×n as

eAt :=∞∑

k=0

tk

k!Ak

= I + tA+ t2

2!A2 + t3

3!A3 + · · ·

This is exactly the same as the definition in the scalar case. Now, for any T > 0, everyelement of this matrix power series converges absolutely and uniformly on the interval [0, T ].Hence, it can be differentiated term-by-term to correctly get the derivative. Therefore

ddteAt :=

∞∑

k=0

k tk−1

k!Ak

= A+ tA2 + + t2

2!A3 + · · ·

= A(

I + tA+ t2

2!A2 + · · ·

)

= AeAt

This is the most important property of the function eAt. Also, in deriving this result, Acould have been pulled out of the summation on either side. Summarizing these importantidentities,

eA0 = In,d

dteAt = AeAt = eAtA

So, the matrix exponential has properties similar to the scalar exponential function. However,there are two important facts to watch out for:

Page 193: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 192

• WARNING: Let aij denote the (i, j)th entry of A. The (i, j)th entry of eAt IS NOTEQUAL TO eaij t. This is most convincingly seen with a nontrivial example. Consider

A =

1 1

0 1

A few calculations show that

A2 =

1 2

0 1

A3 =

1 3

0 1

· · · Ak =

1 k

0 1

The definition for eAt is

eAt = I + tA +t2

2!A2 +

t3

3!A3 + · · ·

Plugging in, and evaluating on a term-by-term basis gives

eAt =

1 + t + t2

2!+ t3

3!+ · · · 0 + t+ 2 t2

2!+ 3 t3

3!+ · · ·

0 + 0 + 0 + 0 + · · · 1 + t+ t2

2!+ t3

3!+ · · ·

The (1, 1) and (2, 2) entries are easily seen to be the power series for et, and the (2, 1)entry is clearly 0. After a few manipulations, the (1, 2) entry is tet. Hence, in this case

eAt =

et tet

0 et

which is very different than the element-by-element exponentiation of At,

ea11t ea12t

ea21t ea22t

=

et et

1 et

• WARNING: In general,e(A1+A2)t 6= eA1teA2t

unless t = 0 (trivial) or A1A2 = A2A1. However, the identity

eA(t1+t2) = eAt1eAt2

is always true. Hence eAte−At = e−AteAt = I for all matrices A and all t, and thereforefor all A and t, eAt is invertible.

Page 194: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 193

21.3.1 Diagonal A

If A ∈ Cn×n is diagonal, then eAt is easy to compute. Specifically, if A is diagonal, it is easyto see that for any k,

A =

β1 0 · · · 0

0 β2 · · · 0...

.... . .

...

0 0 · · · βn

Ak =

βk1 0 · · · 0

0 βk2 · · · 0

......

. . ....

0 0 · · · βkn

In the power series definition for eAt, any off-diagonal terms are identically zero, and the i’thdiagonal term is simply

[

eAt]

ii= 1 + tβi +

t2

2!β2

i +t3

3!β3

i + · · · = eβit

21.3.2 Block Diagonal A

If A1 ∈ Cn1×n1 and A2 ∈ Cn2×n2, define

A :=

A1 0

0 A2

Question: How is eAt related to eA1t and eA2t? Very simply – note that for any k ≥ 0,

Ak =

A1 0

0 A2

k

=

Ak

1 0

0 Ak2

Hence, the power series definition for eAt gives

eAt =

eA1t 0

0 eA2t

21.3.3 Effect of Similarity Transformations

For any invertible T ∈ Cn×n,eT−1ATt = T−1eAtT

Equivalently,TeT−1ATtT−1 = eAt

This can easily be shown from the power series definition.

eT−1ATt = I + t(

T−1AT)

+t2

2!

(

T−1AT)2

+t3

3!

(

T−1AT)3

+ · · ·

Page 195: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 194

It is easy to verify that for every integer k

(

T−1AT)k

= T−1AkT

Hence, we have (with I written as T−1IT )

eT−1ATt = T−1IT + tT−1AT +t2

2!T−1A2T +

t3

3!T−1A3T + · · ·

Pull T−1 out on the left side, and T on the right to give

eT−1ATt = T−1

(

I + tA +t2

2!A2 +

t3

3!A3 + · · ·

)

T

which is simplyeT−1ATt = T−1eAtT

as desired.

21.3.4 Examples

Given β ∈ R, define

A :=

0 β

−β 0

Calculate

A2 =

−β2 0

0 −β2

and hence for any k,

A2k =

(−1)kβ2k 0

0 (−1)kβ2k

, A2k+1 =

0 (−1)kβ2k+1

(−1)k+1β2k+1 0

Therefore, we can write out the first few terms of the power series for eAt as

eAt =

1 − 1

2β2t2 + 1

4!β4t4 − · · · βt− 1

3!β3t3 + 1

5!β5t5 − · · ·

−βt + 13!β3t3 − 1

5!β5t5 + · · · 1 − 1

2β2t2 + 1

4!β4t4 − · · ·

which is recognized as

eAt =

cos βt sin βt

− sin βt cos βt

Similarly, suppose α, β ∈ R, and

A :=

α β

−β α

Page 196: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 195

Then, A can be decomposed as A = A1 + A2, where

A1 :=

α 0

0 α

, A2 :=

0 β

−β 0

Note: in this special case, A1A2 = A2A1, hence

e(A1+A2)t = eA1teA2t

Since A1 is diagonal, we know eA1t, and eA2t follows from our previous example. Hence

eAt =

eαt cos βt eαt sin βt

−eαt sin βt eαt cos βt

This is an important case to remember.

Finally, suppose λ ∈ F, and

A =

λ 1

0 λ

We did a similar example in the first Warning of section 21.3. A few calculations show that

Ak =

λk kλk−1

0 λk

Hence, the power series gives

eAt =

eλt teλt

0 eλt

21.4 Problems

1. Determine eAt for the matrices

A =

[

−2.4 1.8−1.8 −2.4

]

Plot the solution to x(t) = Ax(t) from the initial conditions

x(0) =

[

10

]

, x(0) =

[

01

]

, x(0) =

[

−10

]

, x(0) =

[

0−1

]

Plot this in 2 different manners: first, two plots (using subplot) of x1(t) versus t, andx2(t) versus t; and in another single plot of x2 versus x1. In each plot, there should be4 lines. Use different linetypes (or colors) and make sure they are consistent across allof the figures.

Page 197: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 196

21.4.1 Solution To State Equations

The matrix exponential is extremely important in the solution of the vector differentialequation

x(t) = Ax(t) +Bu(t) (83)

starting from the initial condition x(t0) = x0. Now, consider the original equation in (83).We can derive the solution to the forced equation using the “integrating factor” methid,proceeding in the same manner as in the scalar case, with extra care for the matrix-vectoroperations. Suppose a function x satisfies (83). Multiply both sides by e−At to give

e−Atx(t) = e−AtAx(t) + e−AtBu(t)

Move one term to the left, leaving,

e−AtBu(t) = e−Atx(t) − e−AtAx(t)= e−Atx(t) − Ae−Atx(t)

= ddt

[

e−Atx(t)] (84)

Since these two functions are equal at every time, we can integrate them over the interval[t0 t1]. Note that the right-hand side of (84) is an exact derivative, giving

∫ t1

t0e−AtBu(t)dt =

∫ t1

t0

d

dt

[

e−Atx(t)]

dt

= e−Atx(t)∣∣∣

t1

t0

= e−At1x(t1) − e−At0x(t0)

Note that x(t0) = x0. Also, multiply both sides by eAt1 , to yield

eAt1

∫ t1

t0e−AtBu(t)dt = x(t1) − eA(t1−t0)x0

This is rearranged into

x(t1) = eA(t1−t0)x0 +∫ t1

t0eA(t1−t)Bu(t)dt

Finally, switch variable names, letting τ be the variable of integration, and letting t be theright end point (as opposed to t1). In these new letters, the expression for the solution ofthe (83) for t ≥ t0, subject to initial condition x(t0) = x0 is

x(t) = eA(t−t0)x0 +∫ t

t0eA(t−τ)Bu(τ)dτ

consisting of a free and forced response.

Page 198: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 197

21.5 Eigenvalues, eigenvectors, stability

21.5.1 Diagonalization: Motivation

Recall two facts from Section 21.3: For diagonal matrices Λ ∈ Fn×n,

Λ =

λ1 0 · · · 00 λ2 · · · 0...

.... . .

...0 0 · · · λn

⇒ eΛt =

eλ1t 0 · · · 00 eλ2t · · · 0...

.... . .

...0 0 · · · eλnt

and: If A ∈ Fn×n, and T ∈ Fn×n is invertible, and A := T−1AT , then

eAt = TeAtT−1

Clearly, for a general A ∈ Fn×n, we need to study the invertible transformations T ∈ Fn×n

such that T−1AT is a diagonal matrix.

Suppose that T is invertible, and Λ is a diagonal matrix, and T−1AT = Λ. Moving the T−1

to the other side of the equality gives AT = TΛ. Let ti denote the i’th column of the matrixT . SInce T is assumed to be invertible, none of the columns of T can be identically zero,hence ti 6= Θn. Also, let λi denote the (i, i)’th entry of Λ. The i’th column of the matrixequation AT = TΛ is just

Ati = tiλi = λiti

This observation leads to the next section.

21.5.2 Eigenvalues

Definition: Given a matrix A ∈ Fn×n. A complex number λ is an eigenvalue of A if thereis a nonzero vector v ∈ Cn such that

Av = vλ = λv

The nonzero vector v is called an eigenvector of A associated with the eigenvalue λ.

Remark: Consider the differential equation x(t) = Ax(t), with initial condition x(0) = v.Then x(t) = veλt is the solution (check that it satisfies initial condition and differentialequation). So, an eigenvector is “direction” in the state-space such that if you start in thedirection of the eigenvector, you stay in the direction of the eigenvector.

Note that if λ is an eigenvalue of A, then there is a vector v ∈ Cn, v 6= Θn such that

Av = vλ = (λI) v

Hence(λI − A) v = Θn

Page 199: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 198

Since v 6= Θn, it must be that det (λI − A) = 0.

For an n× n matrix A, define a polynomial, pA (·), called the characteristic polynomialof A by

pA (s) := det (λI − A)

Here, the symbol s is simply the indeterminate variable of the polynomial.

For example, take

A =

2 3 −1−1 −1 −10 2 0

Straightforward manipulation gives pA(s) = s3 − s2 +3s− 2. Hence, we have shown that theeigenvalues of A are necessarily roots of the equation

pA(s) = 0.

For a general n× n matrix A, we will write

pA (s) = sn + a1sn−1 + · · ·+ an−1s+ an

where the a1, a2, . . . , an are complicated products and sums involving the entries of A. Sincethe characteristic polynomial of an n × n matrix is a n’th order polynomial, the equationpA(s) = 0 has at most n distinct roots (some roots could be repeated). Therefore, a n×nmatrix A has at most n distinct eigenvalues.

Conversely, suppose that λ ∈ C is a root of the polynomial equation

pA(s)|s=λ = 0

Question: Is λ an eigenvalue of A?

Answer: Yes. Since pA(λ) = 0, it means that

det (λI − A) = 0

Hence, the matrix λI − A is singular (not invertible). Therefore, by the matrix facts, theequation

(λI − A) v = Θn

has a nonzero solution vector v (which you can find by Gaussian elimination). This meansthat

λv = Av

for a nonzero vector v, which means that λ is an eigenvalue of A, and v is an associatedeigenvector.

We summarize these facts as:

Page 200: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 199

• A is a n× n matrix

• The characteristic polynomial of A is

pA(s) := det (sI − A)= sn + a1s

n−1 + · · · + an−1s+ an

• A complex number λ is an eigenvalue of A if and only if λ is a root of the “characteristicequation” pa(λ) = 0.

Next, we have a useful fact from linear algebra: Suppose A is a given n × n matrix, and(λ1, v1) , (λ2, v2) , . . . , (λn, vn) are eigenvalue/eigenvector pairs. So, for each i, vi 6= Θn andAvi = viλi. Fact: If all of the λin

i=1 are distinct, then the set of vectors

v1, v2, . . . , vn

are a linearly independent set. In other words, the matrix

V := [v1 v2 · · · vn] ∈ Cn×n

is invertible.

Proof: We’ll prove this for 3 × 3 matrices – check your linear algebra book for the general-ization, which is basically the same proof.

Suppose that there are scalars α1, α2, α3, such that

3∑

i=1

αivi = Θ3

This means that

Θ3 = (A− λ3I)Θ3

= (A− λ3I)∑3

i=1 αivi

= α1 (A− λ3I) v1 + α2 (A− λ3I) v2 + α3 (A− λ3I) v3

= α1 (λ1 − λ3) v1 + α2 (λ2 − λ3) v2 + Θ3

(85)

Now multiply by (A− λ2I), giving

Θ3 = (A− λ2I)Θ3 = (A− λ2I) [α1(λ1 − λ3)v1 + α2(λ2 − λ3)v2]= α1(λ1 − λ3)(λ1 − λ2)v1

Since λ1 6= λ3, λ1 6= λ2, v1 6= Θ3, it must be that α1 = 0. Using equation (85), and the factthat λ2 6= λ3, v2 6= Θ3 we get that α2 = 0. Finally, α1v1 +α2v2 +α3v3 = Θ3 (by assumption),and v3 6= Θ3, so it must be that α3 = 0. ]

Page 201: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 200

21.5.3 Diagonalization Procedure

In this section, we summarize all of the previous ideas into a step-by-step diagonalizationprocedure for n× n matrices.

1. Calculate the characteristic polynomial of A, pA(s) := det (sI − A).

2. Find the n roots of the equation pA(s) = 0, and call the roots λ1, λ2, . . . , λn.

3. For each i, find a nonzero vector ti ∈ Cn such that

(A− λiI) ti = Θn

4. Form the matrixT := [t1 t2 · · · tn] ∈ Cn×n

(note that if all of the λini=1 are distinct from one another, then T is guaranteed to

be invertible).

5. Note that AT = TΛ, where

Λ =

λ1 0 · · · 00 λ2 · · · 0...

.... . .

...0 0 · · · λn

6. If T is invertible, then T−1AT = Λ. Hence

eAt = TeΛtT−1 = T

eλ1t 0 · · · 00 eλ2t · · · 0...

.... . .

...0 0 · · · eλnt

T−1

We will talk about the case of nondistinct eigenvalues later.

21.5.4 eAt as t→ ∞

For the remainder of the section, assume A has distinct eigenvalues.

• if all of the eigenvalues (which may be complex) of A satisfy

Re (λi) < 0

then eλit → 0 as t→ ∞, so all entries of[

eAt]

decay to zero

Page 202: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 201

• If there is one (or more) eigenvalues of A with

Re (λi) ≥ 0

then

eλit → bounded 6= 0∞ as → ∞

Hence, some of the entries of eAt either do not decay to zero, or, in fact, diverge to ∞.

So, the eigenvalues are an indicator (the key indicator) of stability of the differential equation

x(t) = Ax(t)

• if all of the eigenvalues of A have negative real parts, then from any initial conditionx0, the solution

x(t) = eAtx0

decays to Θn as t → ∞ (all coordinates of x(t) decay to 0 as t → ∞). In this case, Ais said to be a Hurwitz matrix.

• if any of the eigenvalues of A have nonnegative real parts, then from some initialconditions x0, the solution to

x(t) = Ax(t)

does not decay to zero.

21.5.5 Complex Eigenvalues

In many systems, the eigenvalues are complex, rather than real. This seems unusual, sincethe system itself (ie., the physical meaning of the state and input variables, the coefficientsin the state equations, etc.) is very much Real. The procedure outlined in section 21.5.3 formatrix diagonalization is applicable to both real and complex eigenvalues, and if A is real,all intermediate complex terms will cancel, resulting in eAt being purely real, as expected.However, in the case of complex eigenvalues it may be more advantageous to use a differentsimilarity transformation, which does not lead to a diagonalized matrix. Instead, it leads toa real block-diagonal matrix, whose structure is easily interpreted.

Let us consider a second order system, with complex eigenvalues

x(t) = Ax(t) (86)

where A ∈ Rn×n, x ∈ R2 and

pA(λ) = det(λI2 − A) = (λ− σ)2 + ω2 . (87)

Page 203: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 202

The two eigenvalues of A are λ1 = σ + jω and λ2 = σ − jω, while the two eigenvectors of Aare given by

(λ1I2 − A)v1 = Θ2 (λ2I2 − A)v2 = Θ2 . (88)

Notice that, since λ2 is the complex conjugate of λ1, v2 is the complex conjugate vector ofv1, i.e. if v1 = vr + jvi, then v2 = vr − jvi. This last fact can be verified as follows. Assumethat λ1 = σ + jω, v1 = vr + jvi and insert these expressions in the first of Eqs. (88).

[(σ + jω)I2 − A)] [vr + jvi] = Θ2 ,

Separating into its real and imaginary parts we obtain

[σvr − ωvi] + j [σvi + ωvr] = Avr + jAvi

[σvr − ωvi] = Avr (89)

[σvi + ωvr] = Avi .

Notice that Eqs. (89) hold if we replace ω by −ω and vi by −vi. Thus, if λ1 = σ + jω andv1 = vr + jvi are respectively an eigenvalue and eigenvector of A, then λ2 = σ − jω andv2 = vr − jvi are also respectively an eigenvalue and eigenvector.

Eqs. (89) can be rewritten in matrix form as follows

A[

vr vi

]

=[

vr vi

][

σ ω−ω σ

]

. (90)

Thus, we can define the similarity transformation matrix

T =[

vr vi

]

∈ R2×2 (91)

and the matrix

Jc =

[

σ ω−ω σ

]

(92)

such that

A = T Jc T−1, eAt = T eJct T−1 . (93)

The matrix exponential eJct is easy to calculate. Notice that

Jc =

[

σ ω−ω σ

]

= σI2 + S2

where

I2 =

[

1 00 1

]

and S2 =

[

0 ω−ω 0

]

Page 204: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 203

is skew-symmetric, i.e. ST2 = −S2. Thus,

eS2t =

[

cos(ωt) sin(ωt)− sin(ωt) cos(ωt)

]

.

This last result can be verified by differentiating with respect to time both sides of theequation:

d

dteS2t = S2 e

S2t

and

d

dt

[

cos(ωt) sin(ωt)− sin(ωt) cos(ωt)

]

=

[

−ω sin(ωt) ω cos(ωt)−ω cos(ωt) −ω sin(ωt)

]

=

[

0 ω−ω 0

] [

cos(ωt) sin(ωt)− sin(ωt) cos(ωt)

]

= S2 eS2t .

Since σI2 S2 = S2 σI2, then

eJct = eσt

[

cos(ωt) sin(ωt)− sin(ωt) cos(ωt)

]

. (94)

21.5.6 Examples

Consider the system

x(t) = Ax(t) (95)

where x ∈ R2 and

A =

[

−1.3 1.6−1.6 1.3

]

.

The two eigenvalues of A are λ1 = j and λ2 = −j. Their corresponding eigenvectors arerespectively

v1 =

[

0.4243 + 0.5657j0 + 0.7071j

]

and v2 =

[

0.4243 − 0.5657j0 − 0.7071j

]

.

Defining

T =

[

0.4243 0.56570 0.7071

]

(96)

we obtain A T2 = T2 Jc, where

Jc =

[

0 1−1 0

]

.

Page 205: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 204

Thus,

eJct =

[

cos(t) sin(t)− sin(t) cos(t)

]

and

eAt = T eJctT−1 =

[

0.4243 0.56570 0.7071

] [

cos(t) sin(t)− sin(t) cos(t)

] [

2.3570 −1.88560 1.4142

]

.

Utilizing the coordinate transformation

x∗ = T−1x x = Tx∗ , (97)

where T is given by Eq. (96), we can obtain from Eqs. (97) and(95)

x∗(t) =

T−1AT

x∗(t) (98)

= Jc x∗(t) .

Consider now the initial condition

x(0) =

[

0.42430

]

= Tx∗(0) , x∗(0) =

[

10

]

.

The phase plot for x∗(t) is given by Fig. 8-(a), while that for x(t) is given by Fig. 8-(b).

-1 -0.5 0 0.5 1-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

x*1

x*2

-0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

x1

x2

(a) x∗ = Jcx∗ (b) x = Ax

Figure 8: Phase plots

Page 206: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 205

21.6 Jordan Form

21.6.1 Motivation

In the last section, we saw that if A ∈ Fn×n has distinct eigenvalues, then there exists aninvertible matrix T ∈ Cn×n such that T−1AT is diagonal. In this sense, we say that A isdiagonalizable by similarity transformation (the matrix T−1AT is called a similaritytransformation of A).

Even some matrices that have repeated eigenvalues can be diagonalized. For instance, takeA = I2. Both of the eigenvalues of A are at λ = 1, yet A is diagonal (in fact, any invertibleT makes T−1AT diagonal).

On the other hand, there are other matrices that cannot be diagonalized. Take, for instance,

A =

[

0 10 0

]

The characteristic equation of A is pA(λ) = λ2. Clearly, both of the eigenvalues of A areequal to 0. Hence, if A can be diagonalized, the resulting diagonal matrix would be the0 matrix (recall that if A can be diagonalized, then the diagonal elements are necessarilyroots of the equation pA(λ) = 0). Hence, there would be an invertible matrix T such thatT−1AT = 02×2. Rearranging gives

[

0 10 0

] [

t11 t12t21 t22

]

=

[

t11 t12t21 t22

] [

0 00 0

]

Multiplying out both sides gives

[

t21 t220 0

]

=

[

0 00 0

]

But if t21 = t22 = 0, then T is not invertible. Hence, this 2 × 2 matrix A cannot bediagonalized with a similarity transformation.

21.6.2 Details

It turns out that every matrix can be “almost” diagonalized using similarity transformations.Although this result is not difficult to prove, it will take us too far from the main flow of thecourse. The proof can be found in any decent linear algebra book. Here we simply outlinethe facts.

Page 207: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 206

Definition: If J ∈ Cm×m appears as

J =

λ 1 0 · · · 00 λ 1 · · · 0

. . .. . .

λ 10 0 0 · · · λ

then J is called a Jordan block of dimension m, with associated eigenvalue λ.

Theorem: (Jordan Canonical Form) For every A ∈ Fn×n, there exists an invertible matrixT ∈ Cn×n such that

T−1AT =

J1 0 · · · 00 J2 · · · 0...

.... . .

...0 0 · · · Jk

where each Ji is a Jordan block.

If J ∈ Fm×m is a Jordan block, then using the power series definition, it is straightforwardto show that

eJt =

eλt teλt · · · tm−1

(m−1)!eλt

0 eλt . . . tm−2

(m−2)!eλt

......

. . ....

0 0 · · · eλt

Note that if Re (λ) < 0, then every element of eJt decays to zero, and if if Re (λ) ≥ 0, thensome elements of eJt diverge to ∞.

21.7 Significance

In general, there is no numerically reliable way to compute the Jordan form of a matrix. Itis a conceptual tool, which, among other things, shows us the extent to which eAt containsterms other than exponentials.

Notice that if the real part of λ is negative, then for any finite integer m,

limt→∞

tmeλt

= 0 .

From this result, we see that even in the case of Jordan blocks, the signs of the real parts ofthe eigenvalues of A determine the stability of the linear differential equation

x(t) = Ax(t)

Page 208: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 207

21.8 Problems

1. Find, by hand calculation the eigenvalues, the eigenvectors and eAt for the matrices

(a) A =

[

5 −412 −9

]

(b) A =

[

14 −824 −14

]

(c) A =

[

0 1−9 −4.8

]

(d) A =

[

−2.4 1.8−1.8 −2.4

]

2. Find (by hand calculation) the eigenvalues and eigenvectors of the matrix

A =

−3 −2 25 7 −55 8 −6

Does eAt have all of its terms decaying to zero?

3. Read about the MatLab command eig (use the MatLab manual, the Matlab primer,and/or the comnand >> help eig). Repeat problem 2 using eig, and explain anydifferences that you get. If a matrix has distinct eigenvalues, in what sense are theeigenvectors not unique?

4. Consider the differential equation x(t) = Ax(t), where x(t) is (3 × 1) and A is fromproblem (2) above. Suppose that the initial condition is

x(0) =

1−10

Write the initial condition as a linear combination of the eigenvectors, and find the so-lution x(t) to the differential equation, written as a time-dependent, linear combinationof the eigenvectors.

5. Suppose that we have a 2nd order system (x(t) ∈ R2) governed by the differentialequation

x(t) =

[

0 −22 −5

]

x(t)

Let A denote the 2 × 2 matrix above.

(a) Find the eigenvalues an eigenvectors of A. In this problem, the eigenvectors canbe chosen to have all integer entries (recall that eigenvectors can be scaled)

Page 209: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 208

(b) On the grid below (x1/x2 space), draw the eigenvectors.

-

-

-

-

-

-

-

-

-

-6 6 6 6 6 6 6 6 6 66

- x1

x2

(c) A plot of x2(t) vs. x1(t) is called a phase-plane plot. The variable t is not explicitlyplotted on an axis, rather it is the parameter of the tick marks along the plot.On the grid above, using hand calculations, draw the solution to the equationx(t) = Ax(t) for the initial conditions

x(0) =

[

33

]

, x(0) =

[

−22

]

, x(0) =

[

−3−3

]

, x(0) =

[

42

]

HINT: Remember that if vi are eigenvectors, and λi are eigenvalues of A, thenthe solution to x(t) = Ax(t) from the initial condition x(0) =

∑2i=1 αivi is simply

x(t) =n∑

i=1

αieλitvi

(d) Use Matlab to create a similar picture with many (say 20) different initial condi-tions spread out in the x1, x2 plane

6. Suppose A is a real, n× n matrix, and λ is an eigenvalue of A, and λ is not real, butλ is complex. Suppose v ∈ Cn is an eigenvector of A associated with this eigenvalueλ. Use the notation λ = λR + jλI and v = vr + jvI for the real and imaginary parts ofλ, and v ( j means

√−1).

(a) By equating the real and imaginary parts of the equation Av = λv, find twoequations that relate the various real and imaginary parts of λ and v.

(b) Show that λ (complex conjugate of λ) is also an eigenvalue of A. What is theassociated eigenvector?

Page 210: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 209

(c) Consider the differential equation x = Ax for the A described above, with theeigenvalue λ and eigenvector v. Show that the function

x(t) = eλRt [cos (λIt) vR − sin (λIt) vI ]

satisfies the differential equation. What is x(0) in this case?

(d) Fill in this sentence: If A has complex eigenvalues, then if x(t) starts on thepart of the eigenvector, the solution x(t) oscillates between theand parts of the eigenvector, with frequency asso-

ciated with the part of the eigenvalue. During the motion, thesolution also increases/decreases exponentially, based on the partof the eigenvalue.

(e) Consider the matrix A

A =

[

1 2−2 1

]

It is possible to show that

A

[ 1√2

1√2

j 1√2

−j 1√2

]

=

[ 1√2

1√2

j 1√2

−j 1√2

] [

1 + 2j 00 1 − 2j

]

Sketch the trajectory of the solution x(t) in R2 to the differential equation x = Ax

for the initial condition x(0) =

[

10

]

.

(f) Find eAt for the A given above. NOTE: eAt is real whenever A is real. See thenotes for tricks in making this easy.

7. Consider the 2-state system governed by the equation x(t) = Ax(t). Shown below arethe phase-plane plots (x1(t)vs.x2(t)) for 4 different cases. Match the plots with theA matrices, and correctly draw in arrows indicating the evolution in time. Put youranswers on the enlarged graphs included in the solution packet.

A1 =

[

−3 2−1 0

]

, A2 =

[

−2 03 1

]

, A3 =

[

−1 3−3 −1

]

, A4 =

[

1 3−3 1

]

Page 211: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 210

−5 0 5−5

0

5

x1

x2

−4 −2 0 2 4−4

−2

0

2

4

x1

x2

−5 0 5−5

0

5

x1

x2

−5 0 5−5

0

5

x1

x2

Page 212: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 211

22 Frequency Response for Linear Systems

22.1 Theory for Stable System: Complex Input Signal

Consider the linear dynamical system

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

(99)

We assume that there are n states, m inputs, and q outputs (so A ∈ Rn×n, B ∈ Rn×m,C ∈ Rp×n, D ∈ Rp×m).

If the system is stable, (ie., all of A’s eigenvalues have negative real parts) it is “intuitively”clear that if u is a sinusoid, then y will approach a steady-state behavior that is sinusoidal,at the same frequency, but with different amplitude and phase. In this section, we make thisidea precise.

Take ω ≥ 0 as the input frequency, and (although not physically relevant) let u ∈ Cm be afixed complex vector. Take the input function u(t) to be

u(t) = uejωt

for t ≥ 0. Then, the response is

x(t) = eAtx0 +∫ t0 e

A(t−τ)Bu(τ)dτ= eAtx0 + eAt

∫ t0 e

−AτBuejωτdτ= eAtx0 + eAt

∫ t0 e

(jωI−A)τdτBu

Now, since A is stable, all of the eigenvalues have negative real parts. This means that allof the eigenvalues of (jωI − A) have positive real parts. Hence (jωI − A) is invertible, andwe can write the integral as

x(t) = eAtx0 + eAt∫ t0 e

(jωI−A)τdτBu

= eAt + eAt (jωI − A)−1 e(jωI−A)τ∣∣∣

t

0Bu

= eAtx0 + eAt (jωI − A)−1[

e(jωI−A)t − I]

Bu

= eAtx0 + eAt[

e(jωI−A)t − I]

(jωI − A)−1Bu

= eAtx0 + eAt[

ejωteAt − I]

(jωI − A)−1Bu

= eAtx0 +[

ejωt − eAt]

(jωI − A)−1Bu

= eAt[

x0 − (jωI − A)−1Bu]

+ (jωI − A)−1Buejωt

Hence, the output y(t) would satisfy

y(t) = CeAt[

x0 − (jωI − A)−1Bu]

+ C (jωI − A)−1Buejωt +Duejωt

In the limit as t → ∞, the first term decays to 0 exponentially, leaving the steady-stateresponse

yss(t) =[

D + C (jωI − A)−1B]

uejωt

Page 213: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 212

Hence, we have verified our initial claim – if the input is a complex sinusoid, then the steady-state output is a complex sinusoid at the same exact frequency, but amplified by a complexgain of D + C (jωI − A)−1B.

The function G(jω)G(jω) := D + C (jωI − A)−1B (100)

is called the frequency response of the linear system in (99). Hence, for stable systems, wehave proven

u(t) := uejωt ⇒ yss(t) = G(jω)uejωt

More precisely, this is the frequency response from u to y, so we might also write Gyu(jω) toindicate what is the input (u) and what is the output (y). Gyu can be calculated rather easilyusing a computer, simply by evaluating the matrix expression in (100) at a large number offrequency points ω ∈ R.

22.2 MIMO Systems: Response due to real sinusoidal inputs

In the case where the system has multiple inputs and outputs, it is a bit more complicatedto write out the response due to sinusoidal inputs at a fixed frequency, since the differentinputs may all have different magnitudes and phases. Suppose that there are m inputs, andq outputs (so B ∈ Rn×m, C ∈ Rp×n, D ∈ Rp×m). Take a ∈ Rm, b ∈ Rm, and ω ≥ 0.Consider the input

u(t) = a cosωt + b sinωt

Note that this is the real part of a complex input, namely

u(t) = Re[

(a− jb)ejωt]

Hence, the steady state output must be the real part of a function, specifically,

y(t) = Re[

G(jω)(a− jb)ejωt]

So, in summary: To determine the steady-state response due to an input

u(t) = a cosωt + b sinωt,

let c ∈ Rq and d ∈ Rq be real vectors so that

c− jd = G(jω)(a− jb)

Then, the steady-state output is

yss(t) = c cosωt + d sinωt

Page 214: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 213

22.3 Experimental Determination

Since the frequency response has the interpretation as a representation of the frequency-dependent amplitude gain and phase shift between a sinusoidal input and steady-state out-put, it is easy to obtain experimentally for a given physical system. This can be done byperforming several different forced-response experiments, with the forcing being a sinusoid,each experiment using a different frequency.

Page 215: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 214

23 Control of Second-Order System

In this section, we analyze PD and PID control of a plant typical in mechanical positioningsystems. We also propose a possible design method. The nominal model for the plant is

P (s) =A

s(s+ p)

where A and p are fixed parameters.

23.1 PD control

First, consider PD control, specifically proportional control, with inner loop rate-feedback.This is shown below (its just the PID diagram, with the integral action removed)

KP

KD

A1

s+p1s

- i - - i - - - i?- - -

?

6?

6− −ur y

d

Inner-loop Rate-Feedback

×

In terms of plant and controller parameters, the loop gain (at breaking point marked by ×)is

L(s) =A(KDs+KP )

s(s+ p)

In other words, from a stability point of view, the system is just unity-gain, negative feedbackaround L.

KP

KD

A1

s+p1s

- - i - - - i?- - -

?

6

?

6

y

Page 216: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 215

The closed-loop transfer function from R and D to Y is

Y (s) =AKP

s2 + (AKD + p)s+ AKPR(s) +

1

s2 + (AKD + p)s+ AKPD(s)

The characteristic equation is

CE : s2 + (AKD + p)s+ AKP

Clearly, with two controller parameters, and a 2nd order closed-loop system, the poles canbe freely assigned. Using the (ξ, ωn) parametrization, we set the characteristic equation tobe

s2 + 2ξωns+ ω2n

giving design equations

KP :=ω2

n

A, KD :=

2ξωn − p

A

In terms of the (ξ, ωn) parametrization, the loop gain and transfer functions are

L(s) =(2ξωn − p)s+ ω2

n

s(s+ p)

Y (s) =ω2

n

s2 + 2ξωn + ω2n

R(s) +1

s2 + 2ξωn + ω2n

D(s) (101)

Although this is a 2nd order system, and most quantities can be computed analytically,the formulae that arise are rather messy, and interpretation ends up requiring plotting.Hence, we skip the analytic calculations, and simply numerically compute and plot interestingproperties for different values of ωn, p and ξ. Normalization is the key to displaying the datain a cohesive and minimal fashion.

For now, take p = 0 (you should take the time to write a MatLab script file that duplicatesthese results for arbitrary p). In this case, it is possible to write everything in terms ofnormalized frequency, all relative to ωn. This simultaneously leads to a normalization intime (recall homework 8). Hence frequency responses are plotted G(jω) versus ω

ωn, and time

responses plotted y(t) versus ωnt. We consider a few typical values for ξ.

Page 217: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 216

The plots below are:

• Magnitude/Phase plots of Loop transfer function. These are normalized in frequency,and show L(jω) versus ω

ωn. From these, we can read off the crossover frequencies and

margins.

xi = 0.5

xi = 0.707

xi = 0.95

xi = 1.3

10−2

10−1

100

101

102

10−2

10−1

100

101

102

103

104

Normalized Frequency (w/wn)

Mag

nitu

de

Open−Loop Transfer Function, PD

xi = 0.5

xi = 0.707

xi = 0.95

xi = 1.3

10−2

10−1

100

101

102

−180

−170

−160

−150

−140

−130

−120

−110

−100

−90

Normalized Frequency (w/wn)

Phas

e (d

egre

es)

Open−Loop Transfer Function, PD

Page 218: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 217

• Magnitude/Phase plots of closed-loop R → Y transfer function. These are normalizedin frequency, and show GR→Y (jω) versus ω

ωn.

xi = 0.5

xi = 0.707

xi = 0.95

xi = 1.3

10−2

10−1

100

101

102

10−4

10−3

10−2

10−1

100

101

Normalized Frequency (w/wn)

Mag

nitu

de

R−>Y Frequency Response, PD

xi = 0.5

xi = 0.707

xi = 0.95

xi = 1.3

10−2

10−1

100

101

102

−180

−160

−140

−120

−100

−80

−60

−40

−20

0

Normalized Frequency (w/wn)

Pha

se (d

egre

es)

R−>Y Frequency Response, PD

Page 219: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 218

• Magnitude plot of closed-loop D → Y These are normalized in frequency and magni-tude,, and show ω2

nGD→Y (jω) versus ωωn

.

xi = 0.5

xi = 0.707

xi = 0.95

xi = 1.3

10−2

10−1

100

101

102

10−4

10−3

10−2

10−1

100

101

Normalized Frequency (w/wn)

Nor

mal

ized

Mag

nitu

de, |

wn^

2 G

|

Normalized Disturbance Response, PD

• Unit step d→ y responses. These are normalized both in time, and in response. Hencethe plot is ω2

ny(t) versus ωnt.

xi = 0.5

xi = 0.707

xi = 0.95

xi = 1.3

0 1 2 3 4 5 6 7 80

0.2

0.4

0.6

0.8

1

1.2

Normalized Time (wn*t)

Nor

mal

ized

Res

pons

e, w

n^2

y

Normalized Disturbance Response, PD

Page 220: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 219

• Unit step r → y responses. These are normalized in time, and show y(t) versus ωnt.

xi = 0.5

xi = 0.707

xi = 0.95

xi = 1.3

0 1 2 3 4 5 6 7 80

0.2

0.4

0.6

0.8

1

1.2

Normalized Time (wn*t)

Y

R−>Y Step Response, PD

• Magnitude plot of closed-loop R → E. These are normalized in frequency, and showGR→E(jω) versus ω

ωn.

xi = 0.5

xi = 0.707

xi = 0.95

xi = 1.3

10−2

10−1

100

101

102

10−2

10−1

100

101

Normalized Frequency (w/wn)

Mag

nitu

de

R−>E (Sensitivity), PD

Page 221: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 220

Some things to notice.

• The r → y response has the canonical 2nd order response we have come to know andlove.

• The steady-state disturbance rejection properties are dependent on ωn. As ωn increases,the effect of a disturbance d on the output y is decreased. Hence, in order to improvethe disturbance rejection characteristics, we need to pick larger ωn.

• Depending on ξ, the gain-crossover frequency is between about 1.3ωn and 2.5ωn. So,using this controller architecture, the gain crossover frequency must increase when thesteady-state disturbance rejection is improved. The phase margin varies between 53

and 83.

• There is no phase-crossover frequency, so as defined, the gain margin is infinite.

• The closer that the complex frequency response remains to 1 (over a large frequencyrange), the better the r → y response. The term “bandwidth” is often used to meanthe largest frequency ωB such that for all ω satisfying 0 ≤ ω ≤ ωB,

|1 −GR→Y (jω)| ≤ 0.3

Be careful with the word “bandwidth.” Make sure whoever you are talking to agreeson exactly what you both mean. Sometimes people use it to mean the gain crossoverfrequency. Generally, the higher the bandwidth, the faster the response, and better thedisturbance rejection. Of course, its hard to explicitly assess time-domain propertiesfrom a single number about a frequency response, so use it carefully. The same types ofintuition can also be assessed by looking at the frequency range over which the transferfunction is GR→E small, and also verifying that it is not too large in another range.

23.2 PID Control

In order to reduce the steady-state effect of the disturbance, we next analyze PID control,namely proportional+integral, with inner loop rate feedback. This is shown below.

KI

KP

KD

A1

s+p1s

- i - - - i - - - i?- - -

?

6?

6

-

− −ur y

d

Inner-loop Rate-Feedback

Page 222: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 221

The open-loop transfer function is

L(s) =A(KDs

2 +KP s+KI)

s2(s+ p)

The closed-loop transfer function is

Y (s) =A(KP s+KI)

s3 + (p+ AKD)s2 + AKP s+ AKIR(s) +

s

s3 + (p+ AKD)s2 + AKP s+ AKID(s)

The closed-loop characteristic equation is

s3 + (p+ AKD)s2 + AKPs + AKI

With three controller parameters, and a 3rd order closed-loop system, the poles can befreely assigned. Using the (ξ, ωn) parametrization, along with a 3rd pole at −αωn, we setthe characteristic equation to be

CE : (s2 + 2ξωns + ω2n)(s+ αωn)

Multiplied out, this gives

s3 + (2ξ + α)ωns2 + (2ξα+ 1)ω2

ns+ αω3n

Choosing specific values of ξ, ωn and α yields appropriate controller gains, via the designequations, which are obtained by simply equating coefficients,

KD =(2ξ + α)ωn − p

A, KP =

(2ξα+ 1)ω2n

A, KI =

αω3n

A

Note that for α 1, the design equations give KD and KP as in the PD case, along with avery small integral control term. Hence, for a given pair (ξ, ωn), picking α small and doingthe full PID design is equivalent to doing the PD design for ξ and ωn, and then simplyadding a small amount of integral control as an afterthought. That approach will leave aclosed-loop pole near the origin, approximately at s = −AKI

ω2n

(= −αωn).

In terms of the parameters, the closed-loop transfer function is

Y (s) =(2ξα+ 1)ω2

ns+ αω3n

(s2 + 2ξωns+ ω2n)(s+ αωn)

R(s) +s

(s2 + 2ξωns+ ω2n)(s+ αωn)

D(s)

The steady-state gain from d to y is zero, due to the integral term. Again, take the casep = 0. For clarity, let’s also pick ξ = 0.707, and only study the variation in responses due toour choice of α. Again, the normalization with ωn is complete, in both time and frequency,with frequency responses plotted versus ω

ωn, and time responses plotted versus ωnt.

Page 223: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 222

The plots below are:

• Magnitude/Phase plots of Loop transfer function

alpha = 0.1

alpha = 0.3162

alpha = 1

alpha = 3.162

alpha = 10

10−2

10−1

100

101

102

10−2

10−1

100

101

102

103

104

105

106

107

Normalized Frequency (w/wn)

Mag

nitu

de

Open−Loop Transfer Function, PID, xi = 0.707

alpha = 0.1

alpha = 0.3162

alpha = 1

alpha = 3.162

alpha = 10

10−2

10−1

100

101

102

50

100

150

200

250

300

Normalized Frequency (w/wn)

Phas

e (d

egre

es)

Open−Loop Transfer Function, PID, xi = 0.707

Page 224: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 223

• Magnitude/Phase plots of closed-loop R → Y transfer function

alpha = 0.1

alpha = 0.3162

alpha = 1

alpha = 3.162

alpha = 10

10−2

10−1

100

101

102

10−4

10−3

10−2

10−1

100

101

Normalized Frequency (w/wn)

Mag

nitu

deR−>Y Frequency Response, PID, xi = 0.707

alpha = 0.1

alpha = 0.3162

alpha = 1

alpha = 3.162

alpha = 10

10−2

10−1

100

101

102

−180

−160

−140

−120

−100

−80

−60

−40

−20

0

Normalized Frequency (w/wn)

Pha

se (d

egre

es)

R−>Y Frequency Response, PID, xi = 0.707

• Magnitude plot of closed-loop R → E

Page 225: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 224

• Normalized Disturbance-to-output response

alpha = 1e−05

alpha = 0.1

alpha = 0.3162

alpha = 1

alpha = 3.162

alpha = 10

10−2

10−1

100

101

102

10−4

10−3

10−2

10−1

100

Normalized Frequency (w/wn)

| wn^

2 G

|

Normalized Disturbance Response, xi = 0.707

alpha = 1e−05

alpha = 0.1

alpha = 0.3162

alpha = 1

alpha = 3.162

alpha = 10

0 1 2 3 4 5 6 7 8−0.2

0

0.2

0.4

0.6

0.8

1

1.2

Normalized Time (wn*t)

wn^

2 y

Normalized Disturbance Response, xi = 0.707

Page 226: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 225

• Unit step r → y responses

alpha = 0.1

alpha = 0.3162

alpha = 1

alpha = 3.162

alpha = 10

0 1 2 3 4 5 6 7 80

0.2

0.4

0.6

0.8

1

1.2

1.4

Normalized Time (wn*t)

Y

R−>Y Step Response, PID, xi = 0.707

• R → E magnitude plots

alpha = 0.1

alpha = 0.3162

alpha = 1

alpha = 3.162

alpha = 10

10−2

10−1

100

101

102

10−4

10−3

10−2

10−1

100

101

Normalized Frequency (w/wn)

Mag

nitu

de

R−>E (Sensitivity), PID, xi = 0.707

Some things to notice.

Page 227: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 226

• For a given ωn and α > 1, both the crossover frequencies, and bandwidth (look atGR→E) are much higher than the PD case. This is somewhat reflected in quicker risetimes and comparable settling times.

• The gain crossover frequency increases significantly with increasing α. For instance, atα ≈ 0 (which is the same as the PD control) the crossover frequency is about 1.7ωn,whereas for the crossover frequency jumps to approximately ≈ 5ωn at α ≈ 3.1. Atthe respective crossover frequencies, the phase margins of eth PD and PID designs aresimilar.

• As α increases, the disturbance rejection properties change. Any (and every) α > 0gives perfect steady-state disturbance rejection, but the time-domain and frequencydomain properties for different α are quite different.

• It is instructive to calculate the residue associated with the pole at −αωn when r(t) isa unit step. It is then fairly easy to explain the slow settling times that occur for theintermediate values of α.

Remember, in typical applications, the uncertainty in the plant’s behavior increases with in-creasing frequency, so designs that lead to higher crossover frequencies usually are required(for confidence) to have significantly larger phase margins. Usually, for a given problem, mod-eling innaccuracies and unknown dynamics typically impose a maximum allowable crossoverfrequency, regardless of phase margin.

Page 228: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 227

Since some normalization is possible (using ωn), brute-force repeated simulation allows usto approximately compute several functions. They are functions of p, ξ and α. Here, weimagine that p is known, and fixed. We also propose to fix ξ = 0.707, leaving only functionsof α. In any given design situation, it may be necessary to modify the choice of ξ, andrecompute. The functions are plotted below.

• normalized crossover frequency versus α

10−2

10−1

100

101

102

0

20

40

60

80

100Normalized Gain Crossover Frequency, xi = 0.707

wc/

wn

Alpha

Page 229: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 228

• phase margin versus α

10−2

10−1

100

101

102

60

65

70

75

80

85

90Phase Margin, xi = 0.707

PHI

Alpha

Page 230: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 229

• normalized rise time versus α

10−2

10−1

100

101

102

1

1.5

2

2.5

3

3.5Normalized Rise Time, xi = 0.707

Alpha

wn*

Tris

e

• normalized settling time versus α

2 percent

3 percent

4 percent

10−2

10−1

100

101

102

0

5

10

15

20

25

30Normalized Settling Time, xi = 0.707

Alpha

wn*

Tset

tle

Page 231: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 230

• normalized peak response due to step disturbance versus α

10−2

10−1

100

101

102

0

0.2

0.4

0.6

0.8

1

1.2Normalized Peak Disturbance Response, xi = 0.707

Alpha

wn^

2 y

• normalized settling time due to step disturbance versus α

10−2

10−1

100

101

102

0

50

100

150

200

250

300

350

400Normalized Disturbance Settling (Relative), xi = 0.707

Alpha

wn*

Tset

tle

Page 232: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 231

• percentage overshoot versus α

10−2

10−1

100

101

102

5

10

15

20

25

30

35Percent Overshoot, xi = 0.707

Alpha

% O

vers

hoot

Suppose that these have been computed reasonably accurately, at sufficiently large numbersof α values. Can we use all of this data to develop a foolproof design method?

23.3 A Brute-Force Design Method

In designing the PID controller gains, the free parameters (at this point) to be chosen areξ, ωn and α. For fixed choice of ξ, we can precompute functions f1, f2, . . . , f5 of α such that

1. Gain crossover frequency (ωc) equals ωnf1(α)

2. Rise Time (tR) equals f2(α)/ωn

3. Settling Time (tS) equals f3(α)/ωn

4. Peak response to step disturbance (yd,max) equals f4(α)/ω2n

5. Settling time of step disturbance response (tS,d) equals f5(α)/ωn

So, given target requirements, we can fairly easily determine if there is a PID controllerwhich satisfies the objectives. Specifically, take objectives as

ωc ≤ ωc, tR ≤ tR, tS ≤ tS, yd,max ≤ yd,max, tS,d ≤ tS,d

Page 233: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 232

where the over-bar quantities are targets. Hence we search for values of ωn and α whichsatisfy

gL(α) := max

f2(α)

tR,f3(α)

tS,

√√√√f4(α)

yd,max

,f5(α)

tS,d

≤ ωn ≤ ωc

f1(α)=: gU(α)

Hence, we simply graph the two functions gL and gU , and see if there is any value of α wheregl(α) ≤ gu(α). If so, then simply pick an α∗ for which the inequality it true, and pick anyω∗

n such thatgL(α∗) ≤ ω∗

n ≤ gU(α∗)

Moreover, since the overshoot reaches a maximum at α = 1, and falls off on both sides, youcan easily reduce the overshoot by moving to one side of the feasible region.

23.4 Design Example

Consider the Lab, with single inertia, and pulley. The PD control worked reasonably wellwith ωn = 25, and ξ = 0.707. This implies that a phase margin of 65 at a crossover frequencyof 38 is adequate for stability robustness. So, in designing a PID controller, let’s aim fora crossover frequency of 38, a rise time of 0.4 seconds, settling time of 0.55 seconds, and adisturbance response settling time of 0.7 seconds. We’ll set the peak disturbance responseat 5, which essentially makes it not relevant, and then we could tighten down on it if wewanted.

The constraints on α and ωn are shown below

10−2

10−1

100

101

102

10−2

10−1

100

101

102

103

Alpha

wn

wn/Alpha Design Options

Page 234: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 233

The circle is the point I chose, which MatLab tells me is

α = 0.36, ωn = 19.2

which is pretty similar to what we had working in the lab. Plots of the various relevantquantities

• Open-Loop gain

100

101

102

103

10−2

10−1

100

101

102

Open−Loop Gain

Frequency, rad/sec

| L(j

w) |

Page 235: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 234

• Open-Loop Phase

100

101

102

103

100

120

140

160

180

200

220

240

260

280Open−Loop Phase

Frequency, rad/sec

Pha

se L

(j w

), de

gree

s

• Response to unit-step reference

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.2

0.4

0.6

0.8

1

1.2

1.4Unit Step response

Time, sec

y

Page 236: Prof. A Packard - Berkeley Center for Control and ...pack/me132/AllNotes.pdf · Lateral/steering control systems for future ... for machines, including Disk Drives/CD, robotic manip

ME 132, Spring 2005, UC Berkeley, A. Packard 235

• Response to unit-step disturbance

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6x 10

−3 Unit Step disturbance response

Time, sec

y