Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the...

35
Control of the Lorenz Equations Richard B. Choroszucha 26.IV.2010

Transcript of Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the...

Page 1: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

Control of the Lorenz Equations

Richard B. Choroszucha

26.IV.2010

Page 2: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

Contents

List of Figures iii

List of Tables iv

1 Lorenz Equations 1

1.1 Spotlighting Chaos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Analysis of Lorenz Equations 7

2.1 Equilibrium Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.2 Linearisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.3 Lyapunov Argument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.4 Controllability and Observability . . . . . . . . . . . . . . . . . . . . . . . . 8

3 Control Techniques 9

3.1 Input State Linearisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.2 Sliding Mode Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.3 Time-Delayed Feedback Control . . . . . . . . . . . . . . . . . . . . . . . . . 13

4 Conclusions 17

4.1 Concluding Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

4.2 Areas for Further Research . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

References 18

i

Page 3: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

CONTENTS Choroszucha ii

A Derivation 20

B Code 26

B.1 Open Loop Simulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

B.2 Input State Linearisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

B.3 Sliding Mode Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

B.4 Time-Delayed Feedback Control . . . . . . . . . . . . . . . . . . . . . . . . . 28

B.4.1 Time-Step Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

B.4.2 Delayed Differential Equation . . . . . . . . . . . . . . . . . . . . . . 29

Page 4: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

List of Figures

1.1 Relative Tolerance 1× 10−9, x1(0) = [10 10 30]T . . . . . . . . . . . . . . . . 3

1.2 Relative Tolerance 1× 10−6, x1(0) = [10 10 30]T . . . . . . . . . . . . . . . . 4

1.3 Relative Tolerance 1× 10−9, x2(0) = [10.001 10 30]T . . . . . . . . . . . . . . 5

1.4 Relative Tolerance 1× 10−6, x2(0) = [10.001 10 30]T . . . . . . . . . . . . . . 6

3.1 States using Input State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.2 Solution Trajectories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.3 Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.4 States using SMC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.5 Solution Trajectories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.6 Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.7 States using TDFC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.8 Solution Trajectories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.9 Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

iii

Page 5: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

List of Tables

1.1 Declaration of Variables in Lorenz Equation . . . . . . . . . . . . . . . . . . 1

3.1 Variable Declarations for TDFC . . . . . . . . . . . . . . . . . . . . . . . . . 14

iv

Page 6: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

Chapter 1

Lorenz Equations

The Lorenz equations are a simplified model of convective incompressible air flow betweentwo horizontal plates with a temperature difference, subject to gravity. The motivation forthese equations were to spotlight why weather is unpredictable, despite being a deterministicsystem.

The non-dimensionalised Lorenz Equations are:

x = σ(y − x) (1.1)

y = (r − z)x− y (1.2)

z = xy − bz, (1.3)

where

x : Fluid Motiony : Horizontal Temperaturez : Vertical Temperatureσ : Prandtl Number [22]r : Rayleigh Number [22]b : Geometric Factor [23]τ : Non-dimensionalised time.

Table 1.1: Declaration of Variables in Lorenz Equation

The derivation of (1.1)-(1.3) are very involved and provide nothing in the way of insightdue to approximations made for a simplified model that exhibits chaos. The derivation hasbeen left for the readers review in Appendix A.

For this paper, σ = 10, r = 28 and b = 8/3, perhaps the most common choice.

1

Page 7: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

CHAPTER 1. LORENZ EQUATIONS Choroszucha 2

1.1 Spotlighting Chaos

Chaos is the strong dependence of the solution trajectories on the initial conditions, or theexponential divergence in solution trajectories for small differences in the initial conditions.For great reviews of chaos and attractors, please see [22, 323-325] and [11].

To highlight chaos in the Lorenz Equations the author has provided the following fourfigures of the open loop (no control) Lorenz Equations to demonstrate how tiny differencesin the initial conditions and tolerances on the integrator can propagate through the systemcausing drastically different solution trajectories. The open loop simulations were performedusing MATLAB’s ode45.

Figures 1.1 and 1.2, pages 3 and 4, respectively, have the same initial conditions, but theRelative Tolerance on the error for the integrator has changed. To facilitate comparison,the author has placed each figure on a separate page at the top so one may flip back andforth quickly, much like a blink comparator.

As can be seen by Figures 1.1 and 1.2, the solution trajectories are similar until aboutτ = 17.83, then after that they no longer share any resemblance.

To call out the dependence on the initial conditions, Figure 1.3 and 1.4, pages 5 and 6,respectively, are simulations using the same tolerances, but with a small deviation from theoriginal initial condition x1(0). As was the case for x1(0), x2(0) solutions remains close to thex1(0) solutions until τ ≈ 20, then are completely incomparable for both sets of tolerances.

For code please see Appendix B.1. For the remainder of the paper, all calculations willbe carried out with x(0) = [10 10 30]T and RelTol=1 × 10−9 with all other settings beingleft as the default.

This begs the questions, which has more of an effect, the error or initial conditions, andhow can we control such a maniacal mathematical model?

Page 8: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

CHAPTER 1. LORENZ EQUATIONS Choroszucha 3

Figure 1.1: Relative Tolerance 1× 10−9, x1(0) = [10 10 30]T

Page 9: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

CHAPTER 1. LORENZ EQUATIONS Choroszucha 4

Figure 1.2: Relative Tolerance 1× 10−6, x1(0) = [10 10 30]T

Page 10: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

CHAPTER 1. LORENZ EQUATIONS Choroszucha 5

Figure 1.3: Relative Tolerance 1× 10−9, x2(0) = [10.001 10 30]T

Page 11: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

CHAPTER 1. LORENZ EQUATIONS Choroszucha 6

Figure 1.4: Relative Tolerance 1× 10−6, x2(0) = [10.001 10 30]T

Page 12: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

Chapter 2

Analysis of Lorenz Equations

2.1 Equilibrium Points

Setting the left-hand side of (1.1)-(1.3) to zero and solving, the equilibrium points are

⇀xe =

xeyeze

=

±√b(r − 1)

±√b(r − 1)

(r − 1)

.

2.2 Linearisation

Linearising the system through the Jacobian matrix, one obtains

(D⇀xf)(

⇀xe) =

−σ σ 0r − z −1 −xy x −b

∣∣∣∣∣∣⇀x e

(2.1)

This results in the characteristic equation

∆(λI − (D⇀xf)(

⇀xe)) = λ3 + (b+ σ + 1)λ2 + (b+ x2e + 1 + bσ − rσ + zeσ)λ

+(bσ − brσ + x2eσ + xeyeσ + bzeσ).(2.2)

One can solve for the roots of the characteristic polynomial evaluated at the equilibriato obtain the local stability.

7

Page 13: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

CHAPTER 2. ANALYSIS OF LORENZ EQUATIONS Choroszucha 8

2.3 Lyapunov Argument

Choosing the standard Lyapunov function candidate, making the substitutions x = x−xe,y = y − ye and z = z − ze

V =1

2(a(x− xe)2 + c(y − ye)2 + d(z − ze)2) (2.3)

⇒ V = a(x− xe)x+ c(y − ye)y + d(z − ze)z (2.4)

= a(x− xe)(σ((y − ye)− (x− xe))) + c(y − ye)((r − (z − ze))(x− xe)− (y − ye))+d(z − ze)((x− xe)(y − ye)− b(z − ze)).

This leads to a natural definition of the coefficients to be a = 1σ, c = 1 and d = 1. One can

then complete the square to arrive at

V = −(

(x− xe)−r + 1

2(y − ye)

)2

(1−

(r + 1

2

)2)

(y − ye)2 − b(z − ze)2. (2.5)

Implying that there are no unstable orbits in the Lorenz system.

For the logic behind this statement, a Lyapunov function candidate was tested, suchthat V (

⇀x) > 0 unless

⇀x =

⇀xe ⇒ V (xe) = 0, V (x) < 0 unless

⇀x =

⇀xe in which case

V (⇀xe) = 0. Using LaSalle’s Invariance Theorem from [14], one can then find that this

implies all trajectories are stable in the sense of Lyapunov. One may also show strongerstability, such as global stability of the origin, [22, 315].

2.4 Controllability and Observability

Augmenting the Lorenz Equations with controls on all variables

x = σ(y − x) + α1ux (2.6)

y = (r − z)x− y + α2uy (2.7)

z = xy − bz + α3uz (2.8)

Y = c1x+ c2y + c3z (2.9)

one may check the controllability and observability of the system using [10]. Y is the outputor measurements.

Assuming this scheme, where αi, ci 6= 0, the system is completely controllable andobservable. However, in future works this may not be a good assumption to make becauseit may be impractical to control and measure some states.

Page 14: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

Chapter 3

Control Techniques

3.1 Input State Linearisation

Following the method outlined in [15], because a general case is quite complicated, andletting

g(x) =

0x0

, (3.1)

to apply Input State Linearisation we must satisfy that {g, adgY } is involutive and ad2fg 6= 0

∂Y

∂y= 0 (3.2)

σ∂Y

∂x+ x

∂Y

∂z= 0 (3.3)

These can be solved by inspection, (3.2) implies that the output cannot depend on y and(3.3) implies a solution for Y to be

Y =1

σx2 − 2z + c1, (3.4)

where c1 is a constant of integration and according to [15], this constant is determined bythe control goal.

This implies that

z1 =1

σx2 − 2z + c1 (3.5)

z2 = −2x2 + 2bz (3.6)

z3 = −4σx(y − x) + 2b(xy − bz). (3.7)

Selecting the synthetic inputv = β1z1 + β2z2 + β3z3, (3.8)

9

Page 15: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

CHAPTER 3. CONTROL TECHNIQUES Choroszucha 10

and substituting into the control formula

u =1

LgL2fY

(v − L3fY ). (3.9)

This is where the treatment of this paper and [15] differs, the author has implemented atracking scheme for x through modifying c1, namely x = 5 sin(2πt) + 8.485, 8.485 is theequilibrium point in the x direction. For the synthetic control law, the author has chosen toplace the linearised system’s eigenvalues at -1, meaning the gains are β1 = −1, β2 = β3 = −3.The control is turned on at τ = 20.

The results of this simulation are close, but not exact, the frequency is higher than 1 Hz,and the amplitude is just shy of being 5. This can be seen in the following figures.

Figure 3.1: States using Input State

It should be noted in Figure 3.2 that it has not settled to a circle, it is closer to somethinglike x4 + y4 = c4.

Page 16: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

CHAPTER 3. CONTROL TECHNIQUES Choroszucha 11

Figure 3.2: Solution Trajectories

Figure 3.3 shows the control needed. Note, it never settles once activated.

Figure 3.3: Control

The code can be found in Appendix B.2.

It should be noted, that if controls are present on all states then the nonlinearities canbe canceled directly so that any trajectory is possible.

3.2 Sliding Mode Controller

Sliding Mode Control (SMC) is a very promising control scheme. [23] has shown thatSMC can be used to drive to an arbitrary point. Using a very elementary sliding surfacefor control of y, the author is able to do the same in a much less complicated manner byeffectively changing r, but without the added x term multiplying the control as was discussedin [15].

S = y − ye (3.10)

Page 17: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

CHAPTER 3. CONTROL TECHNIQUES Choroszucha 12

The system goes rapidly to the desired point once the control is activated.

The control isu2 = −ηsign(S)− y + 0.5sin(2πt) + yd. (3.11)

Figure 3.4: States using SMC

It should be noted in Figure 3.5 that the square is one equilibrium of the system and the‘+’ is the new equilibrium defined by

yd = ye + 2. (3.12)

As can be seen by the y vs τ plot of Figure 3.5, the state converges to ≈ 10.5 when ye ≈ 8.48.

Page 18: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

CHAPTER 3. CONTROL TECHNIQUES Choroszucha 13

Figure 3.5: Solution Trajectories

Figure 3.6 shows the control needed. Note, it settles to an approximately constant input.

Figure 3.6: Control

3.3 Time-Delayed Feedback Control

Time-Delayed Feedback Control (TDFC) is the dominant method in control of chaoticsystems, however, it only guarantees the solution to settle onto an unstable periodic orbit(UPO, [16]) with a specified period, not a desired trajectory.

TDFC is a proportional feedback controller with the feedback being delayed by a specifiedtime. The general form for TDFC is

⇀x(t) = f(

⇀x) +K

⇀x(t− τ), (3.13)

where

Page 19: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

CHAPTER 3. CONTROL TECHNIQUES Choroszucha 14

⇀x(t) : States

f(⇀x) : Arbitrary Function of StatesK : Gain Matrixτ : Desired Period.

Table 3.1: Variable Declarations for TDFC

Some sources, e.g. [3] and [21], claim that the control will tend to zero for chaotic systemusing TDFC.

There are two possible approaches one can take, either using this algorithm:

1. Declare initial conditions, separate time into a vector

2. Integrate system from time ti = tj to tf = tj+1

(a) When one period has passed and the Poincare section condition is satisfied, im-plement control.

(b) (Optional) Implement the optimal gain matrix [3] has proposed in the appendix.

3. Set initial conditions for next time step as being the final conditions from the previoustime step.

4. Repeat until finished.

or the method suggested in [19] using MATLAB’s built in dde23 solver, the code for the firstmethod can be found in Appendix B.4.1 and the dde23 has not been implemented properly,thus not shown here.

Using a gain matrixK = 5I3×3 (3.14)

and a period of τ = 5, the following figures show that a periodic orbit is achieved and thecontrol does go to zero.

Page 20: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

CHAPTER 3. CONTROL TECHNIQUES Choroszucha 15

Figure 3.7: States using TDFC

Figure 3.8: Solution Trajectories

Page 21: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

CHAPTER 3. CONTROL TECHNIQUES Choroszucha 16

Figure 3.9: Control

Page 22: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

Chapter 4

Conclusions

4.1 Concluding Remarks

Theoretically, this analysis suggests that one may control the weather through controllingconvection and temperatures. Realistically, controlling the full nonlinear partial differentialequations would be incredibly difficult. It would take an amasing control scheme and possiblya very large amount of energy for input, or if time was not much of an issue, one couldcapitalise on the term that Edward Lorenz coined, the Butterfly Effect, whereby small inputscould drastically change the system, however, in acting on the system, the Butterfly Effectwill ripple through, causing further issues. In a nutshell, this is a chicken and egg typeproblem.

4.2 Areas for Further Research

Some tempting areas of research are:

1. A more robust tracking control for all states.

2. A more general control form and the corresponding Input-State Linearisation.

3. A mixture between TDFC and Input-State Linearisation controls.

4. Fuzzy control of chaotic systems.

5. Observers for chaotic systems.

17

Page 23: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

References

[1] John D. Anderson. Aerodynamics, Fundamentals of. Anderson Series. McGraw-Hill,Boston, 4th edition, 2007.

[2] Serge Bielawski, Dominique Derozier, and Pierre Glorieux. Controlling unstable periodicorbits by a delayed continuous feedback. Phys. Rev. E, 49(2):R971–R974, Feb 1994.

[3] James D. Biggs and Colin R. McInnes. Time-delayed feedback control in astrodynamics.Journal of Guidance, Control and Dynamics, 32(6):1804–1811, November-December2009.

[4] S. Boccaletti, C. Grebogi, Y.-C. Lai, H. Mancini, and D. Maza. The control of chaos:Theory and applications. Physics Reports, 329:2000, 2000.

[5] James Ward Brown and Ruel V. Churchill. Complex Variables and Applications. Mc-Graw Hill, Boston, 7th edition, 2003.

[6] Jens Christian Claussen. Floquet stability analysis of ott-grebogi-yorke and differencecontrol. New Journal of Physics, 10(6):063006, 2008.

[7] B. Fiedler, V. Flunkert, M. Georgi, P. Hovel, and E. Scholl. Refuting the odd-numberlimitation of time-delayed feedback control. Phys. Rev. Lett., 98(11):114101, Mar 2007.

[8] Xinping Guan and Cailian Chen. Adaptive fuzzy control for chaotic systems with h∞tracking performance. Fuzzy Sets and Systems, 139(1):81 – 93, 2003.

[9] Richard Haberman. Applied Partial Differential Equations. Pearson - Prentice Hall,Upper Saddle River, 4th edition, 2004.

[10] R. Hermann and A Krener. Nonlinear controllability and observability. IEEE Transac-tions on In Automatic Control, 22(5):728–740, October 1977.

[11] Robert C. Hilborn. Chaos and Nonlinear Dynamics. Oxford University Press, 2ndedition, 2001.

[12] Chi-Chuan Hwang, Rong-Fong Fung, Jin-Yuan Hsieh, and Woei-Jong Li. A nonlinearfeedback control of the lorenz equation. International Journal of Engineering Science,37(14):1893 – 1900, 1999.

18

Page 24: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

REFERENCES Choroszucha 19

[13] W. Just, B. Fiedler, M. Georgi, V. Flunkert, P. Hovel, and E. Scholl. Beyond the oddnumber limitation: A bifurcation analysis of time-delayed feedback control. Phys. Rev.E, 76(2):026210, Aug 2007.

[14] Hassan Khalil. Nonlinear Systems. Prentice-Hall, Inc., Upper Saddle River, NJ, 3rdedition, 2002.

[15] Chen Liqun and Liu Yanzhu. Control of the lorenz chaos by the exact linearization*.Applied Mathematics and Mechanics, 19(1):67–73, Jan 1998.

[16] Hiroyuki Nakajima. On analytical properties of delayed feedback control of chaos.Physics Letters A, 232(3-4):207 – 210, 1997.

[17] Hiroyuki Nakajima and Yoshisuke Ueda. Limitation of generalized delayed feedbackcontrol. Physica D: Nonlinear Phenomena, 111(1-4):143 – 150, 1998.

[18] Edward Ott, Celso Grebogi, and James A. Yorke. Controlling chaos. Phys. Rev. Lett.,64(11):1196–1199, Mar 1990.

[19] Claire M. Postlethwaite and Mary Silber. Stabilizing unstable periodic orbits in thelorenz equations using time-delayed feedback control. Phys. Rev. E, 76(5):056214, Nov2007.

[20] K. Pyragas. Analytical properties and optimization of time-delayed feedback control.Phys. Rev. E, 66(2):026207, Aug 2002.

[21] Kestutis Pyragas. Delayed feedback control of chaos. Philosophical Transactions of theRoyal Society, 364:2309–2334, July 2006.

[22] Steven H. Strogatz. Nonlinear Dynamics and Chaos. Westview Press, Cambridge, 2000.

[23] Shyi-Kae Yang, Chieh-Li Chen, and Her-Terng Yau. Control of chaos in lorenz system.Chaos, Solitons & Fractals, 13(4):767 – 780, 2002.

Page 25: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

Appendix A

Derivation

My derivation follows [11, 547-558], but with added commentary using [9], [1] and [5] toexpound upon the finer points in what [11] calls a “development.”

20

Page 26: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

APPENDIX A. DERIVATION Choroszucha 21

Page 27: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

APPENDIX A. DERIVATION Choroszucha 22

Page 28: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

APPENDIX A. DERIVATION Choroszucha 23

Page 29: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

APPENDIX A. DERIVATION Choroszucha 24

Page 30: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

APPENDIX A. DERIVATION Choroszucha 25

Page 31: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

Appendix B

Code

B.1 Open Loop Simulations

1 func t i on lorenzopen ( )23 sigma=10;4 r=28;5 b=8/3;6 %tc=[0 5 0 ] ;7 tc =0 : 0 . 01 : 50 ;8 i c =[10.001 10 3 0 ] ;9

10 odeopts=odeset ( ’ R e l T o l ’ ,1E−6);11 [ t x]=ode45 (@lrwhcw , tc , i c , odeopts ) ;12 f i g u r e (1)13 subplot (2 , 2 , 1 )14 p lo t3 (x ( : , 1 ) , x ( : , 2 ) , x ( : , 3 ) , ’ k ’ )15 x l ab e l ( ’ x ’ )16 y l ab e l ( ’ y ’ )17 z l a b e l ( ’ z ’ )18 subplot (2 , 2 , 2 )19 p lo t ( t , x ( : , 1 ) , ’ k ’ )20 x l ab e l ( ’ \ tau ’ )21 y l ab e l ( ’ x ’ )22 subplot (2 , 2 , 3 )23 p lo t ( t , x ( : , 2 ) , ’ k ’ )24 x l ab e l ( ’ \ tau ’ )25 y l ab e l ( ’ y ’ )26 subplot (2 , 2 , 4 )27 p lo t ( t , x ( : , 3 ) , ’ k ’ )28 x l ab e l ( ’ \ tau ’ )29 y l ab e l ( ’ z ’ )30 saveas ( gca , ’ o p e n l o o p A l l - RelTol -6 - x 1 0 0 0 1 . png ’ )3132 f i g u r e (2)33 p lo t3 (x ( : , 1 ) , x ( : , 2 ) , x ( : , 3 ) , ’ k ’ )34 x l ab e l ( ’ x ’ )35 y l ab e l ( ’ y ’ )36 z l a b e l ( ’ z ’ )37 saveas ( gca , ’ o p e n l o o p - RelTol -6 - x 1 0 0 0 1 . png ’ )3839 func t i on dx=lrwhcw ( t , x )4041 dx=ze ro s ( 3 , 1 ) ;42 dx(1)= sigma ∗(x(2)−x ( 1 ) ) ;43 dx(2)= r∗x(1)−x(2)−x (1)∗x ( 3 ) ;44 dx(3)=x (1)∗x(2)−b∗x ( 3 ) ;45 end46 end

B.2 Input State Linearisation

1 func t i on i s l i n e a r i s a t i o n ( )23 numpoints=10000;

26

Page 32: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

APPENDIX B. CODE Choroszucha 27

45 sigma=10;6 r=28;7 b=8/3;8 t f =100;9

10 beta=[−1 −3 −3];1112 t t o t=l i n spa c e (0 , t f , numpoints ) ’ ;13 nt=numel ( t t o t ) ;14 i c =[10 10 30 0 ] ;15 odeopts=odeset ( ’ R e l T o l ’ ,1E−9);16 [ t x]=ode45 ( @sonofthemorning , t tot , i c , odeopts ) ;1718 f i g u r e (1 )19 subplot (2 , 2 , 1 )20 p lo t3 (x ( : , 1 ) , x ( : , 2 ) , x ( : , 3 ) , ’ k ’ )21 x l ab e l ( ’ x ’ )22 y l ab e l ( ’ y ’ )23 z l a b e l ( ’ z ’ )24 subplot (2 , 2 , 2 )25 p lo t ( t , x ( : , 1 ) , ’ k ’ )26 x l ab e l ( ’ \ tau ’ )27 y l ab e l ( ’ x ’ )28 subplot (2 , 2 , 3 )29 p lo t ( t , x ( : , 2 ) , ’ k ’ )30 x l ab e l ( ’ \ tau ’ )31 y l ab e l ( ’ y ’ )32 subplot (2 , 2 , 4 )33 p lo t ( t , x ( : , 3 ) , ’ k ’ )34 x l ab e l ( ’ \ tau ’ )35 y l ab e l ( ’ z ’ )36 saveas ( gca , ’ isfl - all . png ’ )3738 f i g u r e (2)39 p lo t3 (x ( : , 1 ) , x ( : , 2 ) , x ( : , 3 ) , ’ k ’ )40 x l ab e l ( ’ x ’ )41 y l ab e l ( ’ y ’ )42 z l a b e l ( ’ z ’ )43 saveas ( gca , ’ i s f l . png ’ )4445 f i g u r e (3)46 p lo t ( t ( 1 : ( end−1)) , d i f f ( x ( : , 4 ) ) . / d i f f ( t ) , ’ k ’ )47 x l ab e l ( ’ \ tau ’ )48 y l ab e l ( ’ u ’ )49 saveas ( gca , ’ isfl - c o n t r o l . png ’ )5051 func t i on dx=sonofthemorning ( t , x )5253 dx=ze ro s ( 4 , 1 ) ;54 u=ze ro s ( 3 , 1 ) ;55 F=[ sigma ∗(x(2)−x (1 ) ) r∗x(1)−x(2)−x (1)∗x (3) x (1)∗x(2)−b∗x ( 3 ) ] ’ ;56 i f ( t>20)5758 f=2∗pi ;59 ampl=500;60 x1d=(ampl∗ s i n ( f ∗ t ) ) ;61 x1ddot=ampl∗ f ∗ cos ( f ∗ t ) ;62 x1dddot=−ampl∗ f ˆ2∗ s i n ( f ∗ t ) ;63 x1ddddot=−ampl∗ f ˆ3∗ cos ( f ∗ t ) ;64 xd=[x1d x1ddot x1dddot ] ’ ;6566 d=(2∗sigma−b )/( b∗ sigma ) ;67 mu=d∗x1d ˆ2 ;6869 z (1 ,1)=1/ sigma∗x(1)ˆ2−2∗x(3)+mu;70 z (2 ,1)=−2∗x(1)ˆ2+2∗b∗x ( 3 ) ;71 z (3 ,1)=−4∗ sigma∗x (1 )∗ ( x(2)−x(1))+2∗b∗(x (1)∗x(2)−b∗x ( 3 ) ) ;72 v=beta ∗( z ) ;%x1ddddot+ −d∗xd ) ;73 c=(b−2∗sigma ) ;74 D3Y=[4∗ sigma ∗(x(2)−2∗x(1))+2∗b∗x (2) −4∗sigma∗x(2)+2∗b∗x (1) −2∗b ˆ 2 ] ;75 numer=D3Y∗F;76 denom=x(1)ˆ2∗(−4∗ sigma+2∗b ) ;77 u(2)=1/denom∗(v−numer ) ;78 e l s e79 u=ze ro s ( 3 , 1 ) ;80 end81 dx=ze ro s ( 3 , 1 ) ;82 dx (1:3)=F+u ;83 dx(4)=u ( 2 ) ;84 end858687 end

B.3 Sliding Mode Control

Page 33: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

APPENDIX B. CODE Choroszucha 28

1 func t i on elemSMC()23 numpoints=10000;45 eta =0.25;6 sigma=10;7 r=28;8 b=8/3;9 eqpoint=sq r t (b∗( r −1)) ;

10 eqvect=[ eqpoint eqpoint r −1 ] ’ ;1112 t f =100;13 t t o t=l i n spa c e (0 , t f , numpoints ) ’ ;14 nt=numel ( t t o t ) ;15 i c =[10 10 30 0 ] ;16 odeopts=odeset ( ’ R e l T o l ’ ,1E−9);17 [ t x]=ode45 ( @sonofthemorning , t tot , i c , odeopts ) ;1819 f i g u r e (1)20 subplot (2 , 2 , 1 )21 p lo t3 (x ( : , 1 ) , x ( : , 2 ) , x ( : , 3 ) , ’ k ’ )22 x l ab e l ( ’ x ’ )23 y l ab e l ( ’ y ’ )24 z l a b e l ( ’ z ’ )25 subplot (2 , 2 , 2 )26 p lo t ( t , x ( : , 1 ) , ’ k ’ )27 x l ab e l ( ’ \ tau ’ )28 y l ab e l ( ’ x ’ )29 subplot (2 , 2 , 3 )30 p lo t ( t , x ( : , 2 ) , ’ k ’ )31 x l ab e l ( ’ \ tau ’ )32 y l ab e l ( ’ y ’ )33 subplot (2 , 2 , 4 )34 p lo t ( t , x ( : , 3 ) , ’ k ’ )35 x l ab e l ( ’ \ tau ’ )36 y l ab e l ( ’ z ’ )37 saveas ( gca , ’ smc - all . png ’ )3839 f i g u r e (2)40 p lo t3 (x ( : , 1 ) , x ( : , 2 ) , x ( : , 3 ) , ’ k ’ )41 hold on42 p lo t3 (x ( end , 1 ) , x ( end , 2 ) , x ( end , 3 ) , ’ k + ’ , ’ M a r k e r S i z e ’ , 12)43 p lo t3 ( eqvect ( 1 ) , eqvect ( 2 ) , eqvect ( 3 ) , ’ ks ’ , ’ M a r k e r S i z e ’ , 12)44 x l ab e l ( ’ x ’ )45 y l ab e l ( ’ y ’ )46 z l a b e l ( ’ z ’ )47 saveas ( gca , ’ smc . png ’ )4849 f i g u r e (3)50 p lo t ( t ( 1 : ( end−1)) , d i f f ( x ( : , 4 ) ) . / d i f f ( t ) , ’ k ’ )51 x l ab e l ( ’ \ tau ’ )52 y l ab e l ( ’ u ’ )53 saveas ( gca , ’ smc - c o n t r o l . png ’ )5455 func t i on dx=sonofthemorning ( t , x )5657 dx=ze ro s ( 4 , 1 ) ;58 u=ze ro s ( 3 , 1 ) ;59 F=[ sigma ∗(x(2)−x (1 ) ) ( r−x (3 ) )∗ x(1)−x (2) x (1)∗x(2)−b∗x ( 3 ) ] ’ ;6061 i f ( t>20)62 yd=eqpoint+2;63 S=x(2)−yd ;64 u(2)=−( eta )∗ s i gn (S)−F(2)+0.5∗ s i n (2∗ pi ∗ t)+yd ;65 end6667 dx=ze ro s ( 3 , 1 ) ;68 dx (1:3)=F+u ;69 dx(4)=u ( 2 ) ;70 end71 end

B.4 Time-Delayed Feedback Control

B.4.1 Time-Step Algorithm

1 func t i on s tepa lgor i thm ()23 c l o s e a l l ;4 pause ( 0 . 1 ) ;56 foldername=dat e s t r (now , 3 0 ) ;7 note={’ L o o k i n g at d o u b l e o r b i t . ’ } ;8 numpoints=10000;

Page 34: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

APPENDIX B. CODE Choroszucha 29

910 type=’ s t e p ’ ;11 sigma=10;12 r=28;13 b=8/3;14 %tc=[0 5 0 ] ;15 t f =100;1617 tauarr =10;18 K=1.5∗ eye ( 3 , 3 ) ;%+0.1∗ rand ( 3 , 3 ) ;1920 f o r o1=121 tau=tauarr ( o1 ) ;22 t t o t=l i n spa c e (0 , t f , numpoints ) ’ ;23 nt=numel ( t t o t ) ;24 xtot=ze ro s ( nt , 6 ) ;25 i c =[10 10 30 0 0 0 ] ;26 xtot (1 , : )= i c ;27 tc=[ t t o t (1 ) t t o t ( 2 ) ] ;28 odeopts=odeset ( ’ R e l T o l ’ ,1E−9);29 f o r a1=1:( nt−1)30 i f (mod( a1 ,100)==0)31 f p r i n t f ( ’ % d /% d \ n ’ , a1 , nt ) ;32 end33 [ t x]=ode45 ( @sonofthemorning , tc , i c , odeopts ) ;34 xtot ( a1+1 ,:)=x( end , : ) ;35 i c=x( end , : ) ;36 i f ( a1˜=nt−1)37 tc=[ t t o t ( a1+1) t t o t ( a1 +2) ] ;38 end39 end4041 saveChaot icPlots ( type , t tot , xtot , f a l s e , foldername , note , tau ,K) ;42 end4344 func t i on dx=sonofthemorning ( t , x )4546 dx=ze ro s ( 6 , 1 ) ;47 f o r i 1 =1:348 e ( i1 ,1)= calcU ( t , x , i 1 ) ;49 end50 u=−K∗e ;5152 dx=ze ro s ( 3 , 1 ) ;53 dx(1)= sigma ∗(x(2)−x(1))+u ( 1 ) ;54 dx(2)= r∗x(1)−x(2)−x (1)∗x(3)+u ( 2 ) ;55 dx(3)=x (1)∗x(2)−b∗x(3)+u ( 3 ) ;56 dx (4:6)=u ;57 end5859 func t i on myU=calcU ( t , x , a2 )60 i f ( t>=tau )61 myU=x( a2)− i n t e rp1 ( ttot , xtot ( : , a2 ) , t−tau ) ;62 e l s e63 myU=x( a2 ) ;64 end65 end66 end

B.4.2 Delayed Differential Equation

1 func t i on TDFCdde( )23 sigma=10;4 r=28;5 b=8/3;6 %tc=[0 5 0 ] ;7 t f =100;8 eqpoint=sq r t (b∗( r −1)) ;9

10 tau=10;11 K=5∗eye ( 3 , 3 ) ;1213 t f=tau ∗10;14 t t o t=l i n spa c e (0 , t f , 1 0 0 0 ) ’ ;15 nt=numel ( t t o t ) ;16 xtot=ze ro s ( nt , 6 ) ;17 i c =[10 10 30 0 0 0 ] ;18 xtot (1 , : )= i c ;1920 odeopts=odeset ( ’ R e l T o l ’ ,1E−9);21 ddeopts=ddeset ( ’ R e l T o l ’ ,1E−3);2223 perTic=[ t t o t (1 ) t t o t (1)+ tau ] ;24 [ perT her s to ry ]=ode45 ( @sonofthemorning , [ t t o t (1 ) tau+t t o t ( 1 ) ] , i c ( 1 : 3 ) , odeopts ) ;25 s o l=dde23 ( @daughterofthemorning , tau , @herherstory , [ min ( t t o t ) max( t t o t ) ] , ddeopts ) ;26 xtot=deval ( so l , t t o t ) ’ ;27

Page 35: Control of the Lorenz Equations - U-M Personal World … that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate

APPENDIX B. CODE Choroszucha 30

28 f i g u r e (1)29 p lo t ( xtot ( : , 1 ) , xtot ( : , 2 ) , ’ k ’ )30 x l ab e l ( ’ x ’ )31 y l ab e l ( ’ y ’ )32 saveas ( gca , s p r i n t f ( ’b - xy -% s -% d . png ’ , uwhat ,1000∗ rho ) )3334 f i g u r e (3)35 p lo t ( t t o t ( 1 : ( end−1)) , d i f f ( xtot ( : , 5 ) ) . / d i f f ( t t o t ) , ’ k ’ )36 x l ab e l ( ’ t [ s ] ’ )37 y l ab e l ( ’ u_x ’ )38 saveas ( gca , s p r i n t f ( ’b - ux -% s -% d . png ’ , uwhat ,1000∗ rho ) )3940 f i g u r e (4)41 p lo t ( t t o t ( 1 : ( end−1)) , d i f f ( xtot ( : , 6 ) ) . / d i f f ( t t o t ) , ’ k ’ )42 x l ab e l ( ’ t [ s ] ’ )43 y l ab e l ( ’ u_y ’ )44 saveas ( gca , s p r i n t f ( ’b - uy -% s -% d . png ’ , uwhat ,1000∗ rho ) )45 pause ( 1 ) ;46 c l o s e a l l ;4748 func t i on dx=sonofthemorning ( t , x )4950 dx=ze ro s ( 3 , 1 ) ;51 dx(1)= sigma ∗(x(2)−x ( 1 ) ) ;52 dx(2)= r∗x(1)−x(2)−x (1)∗x ( 3 ) ;53 dx(3)=x (1)∗x(2)−b∗x ( 3 ) ;54 end5556 func t i on dx=daughterofthemorning ( t , x , xtau )5758 dx=ze ro s ( 6 , 1 ) ;59 e=x(1:3)− xtau ( 1 : 3 ) ;60 u=−K∗e ;6162 r=x(1)ˆ2+x (2 ) ˆ 2 ;63 dx(1)= sigma ∗(x(2)−x ( 1 ) ) ;64 dx(2)= r∗x(1)−x(2)−x (1)∗x(3)+u ;65 dx(3)=x (1)∗x(2)−b∗x ( 3 ) ;66 dx(4)=u ;67 end6869 func t i on myU=calcU ( t , x , a2 )70 i f ( t>=tau )71 myU=x( a2)− i n t e rp1 ( ttot , xtot ( : , a2 ) , t−tau ) ;72 e l s e73 myU=0;74 end75 end7677 func t i on r e t=herhe r s to ry ( t )78 r e t (1:3)= int e rp1 ( perT , herstory ,mod( t , tau ) ) ;79 r e t (4)=0;80 end81 end