Control of the Lorenz Equations Richard B. Choroszucha 26.IV.2010
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
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
List of Figures 1.1 Relative Tolerance 1 10 9, x 1 (0) = [10 10 30] T................ 3 1.2 Relative Tolerance 1 10 6, x 1 (0) = [10 10 30] T................ 4 1.3 Relative Tolerance 1 10 9, x 2 (0) = [10.001 10 30] T.............. 5 1.4 Relative Tolerance 1 10 6, x 2 (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
List of Tables 1.1 Declaration of Variables in Lorenz Equation.................. 1 3.1 Variable Declarations for TDFC......................... 14 iv
Chapter 1 Lorenz Equations The Lorenz equations are a simplified model of convective incompressible air flow between two horizontal plates with a temperature difference, subject to gravity. The motivation for these equations were to spotlight why weather is unpredictable, despite being a deterministic system. where The non-dimensionalised Lorenz Equations are: ẋ = σ(y x) (1.1) ẏ = (r z)x y (1.2) ż = xy bz, (1.3) x : Fluid Motion y : Horizontal Temperature z : 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 insight due to approximations made for a simplified model that exhibits chaos. The derivation has been left for the readers review in Appendix A. For this paper, σ = 10, r = 28 and b = 8/3, perhaps the most common choice. 1
CHAPTER 1. LORENZ EQUATIONS Choroszucha 2 1.1 Spotlighting Chaos Chaos is the strong dependence of the solution trajectories on the initial conditions, or the exponential 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 four figures of the open loop (no control) Lorenz Equations to demonstrate how tiny differences in the initial conditions and tolerances on the integrator can propagate through the system causing drastically different solution trajectories. The open loop simulations were performed using MATLAB s ode45. Figures 1.1 and 1.2, pages 3 and 4, respectively, have the same initial conditions, but the Relative 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 and forth 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 the original initial condition x 1 (0). As was the case for x 1 (0), x 2 (0) solutions remains close to the x 1 (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 will be carried out with x(0) = [10 10 30] T and RelTol=1 10 9 with all other settings being left as the default. This begs the questions, which has more of an effect, the error or initial conditions, and how can we control such a maniacal mathematical model?
CHAPTER 1. LORENZ EQUATIONS Choroszucha 3 Figure 1.1: Relative Tolerance 1 10 9, x 1 (0) = [10 10 30] T
CHAPTER 1. LORENZ EQUATIONS Choroszucha 4 Figure 1.2: Relative Tolerance 1 10 6, x 1 (0) = [10 10 30] T
CHAPTER 1. LORENZ EQUATIONS Choroszucha 5 Figure 1.3: Relative Tolerance 1 10 9, x 2 (0) = [10.001 10 30] T
CHAPTER 1. LORENZ EQUATIONS Choroszucha 6 Figure 1.4: Relative Tolerance 1 10 6, x 2 (0) = [10.001 10 30] T
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 = x e y e z e = ± b(r 1) ± b(r 1) (r 1). 2.2 Linearisation Linearising the system through the Jacobian matrix, one obtains σ σ 0 (D x f)( x e ) = r z 1 x (2.1) y x b x e This results in the characteristic equation (λi (D x f)( x e )) = λ 3 + (b + σ + 1)λ 2 + (b + x 2 e + 1 + bσ rσ + z e σ)λ +(bσ brσ + x 2 eσ + x e y e σ + bz e σ). (2.2) One can solve for the roots of the characteristic polynomial evaluated at the equilibria to obtain the local stability. 7
CHAPTER 2. ANALYSIS OF LORENZ EQUATIONS Choroszucha 8 2.3 Lyapunov Argument Choosing the standard Lyapunov function candidate, making the substitutions x = x x e, y = y y e and z = z z e V = 1 2 (a(x x e) 2 + c(y y e ) 2 + d(z z e ) 2 ) (2.3) V = a(x x e )ẋ + c(y y e )ẏ + d(z z e )ż (2.4) = a(x x e )(σ((y y e ) (x x e ))) + c(y y e )((r (z z e ))(x x e ) (y y e )) +d(z z e )((x x e )(y y e ) b(z z e )). 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 x e ) r + 1 ) ( 2 ( ) ) 2 r + 1 2 (y y e) 1 (y y e ) 2 b(z z e ) 2. (2.5) 2 Implying that there are no unstable orbits in the Lorenz system. For the logic behind this statement, a Lyapunov function candidate was tested, such that V ( x) > 0 unless x = x e V (x e ) = 0, V (x) < 0 unless x = xe in which case V ( x e ) = 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 stronger stability, such as global stability of the origin, [22, 315]. 2.4 Controllability and Observability Augmenting the Lorenz Equations with controls on all variables ẋ = σ(y x) + α 1 u x (2.6) ẏ = (r z)x y + α 2 u y (2.7) ż = xy bz + α 3 u z (2.8) Y = c 1 x + c 2 y + c 3 z (2.9) one may check the controllability and observability of the system using [10]. Y is the output or measurements. Assuming this scheme, where α i, c i 0, the system is completely controllable and observable. However, in future works this may not be a good assumption to make because it may be impractical to control and measure some states.
Chapter 3 Control Techniques 3.1 Input State Linearisation Following the method outlined in [15], because a general case is quite complicated, and letting 0 g(x) = x, (3.1) 0 to apply Input State Linearisation we must satisfy that {g, ad g Y } is involutive and ad 2 fg 0 Y y σ Y x + x Y z = 0 (3.2) = 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 + c 1, (3.4) where c 1 is a constant of integration and according to [15], this constant is determined by the control goal. This implies that z 1 = 1 σ x2 2z + c 1 (3.5) z 2 = 2x 2 + 2bz (3.6) z 3 = 4σx(y x) + 2b(xy bz). (3.7) Selecting the synthetic input v = β 1 z 1 + β 2 z 2 + β 3 z 3, (3.8) 9
CHAPTER 3. CONTROL TECHNIQUES Choroszucha 10 and substituting into the control formula u = 1 L g L 2 f Y (v L3 fy ). (3.9) This is where the treatment of this paper and [15] differs, the author has implemented a tracking scheme for x through modifying c 1, namely x = 5 sin(2πt) + 8.485, 8.485 is the equilibrium point in the x direction. For the synthetic control law, the author has chosen to place 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 something like x 4 + y 4 = c 4.
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 can be 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 that SMC can be used to drive to an arbitrary point. Using a very elementary sliding surface for control of y, the author is able to do the same in a much less complicated manner by effectively changing r, but without the added x term multiplying the control as was discussed in [15]. S = y y e (3.10)
CHAPTER 3. CONTROL TECHNIQUES Choroszucha 12 The system goes rapidly to the desired point once the control is activated. The control is u 2 = ηsign(s) ẏ + 0.5sin(2πt) + y d. (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 y d = y e + 2. (3.12) As can be seen by the y vs τ plot of Figure 3.5, the state converges to 10.5 when y e 8.48.
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 chaotic systems, 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 specified time. The general form for TDFC is where x(t) = f( x) + K x(t τ), (3.13)
CHAPTER 3. CONTROL TECHNIQUES Choroszucha 14 x(t) : States f( x) : Arbitrary Function of States K : 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 system using 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 t i = t j to t f = t j+1 (a) When one period has passed and the Poincaré section condition is satisfied, implement 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 previous time step. 4. Repeat until finished. or the method suggested in [19] using MATLAB s built in dde23 solver, the code for the first method can be found in Appendix B.4.1 and the dde23 has not been implemented properly, thus not shown here. Using a gain matrix K = 5I 3 3 (3.14) and a period of τ = 5, the following figures show that a periodic orbit is achieved and the control does go to zero.
CHAPTER 3. CONTROL TECHNIQUES Choroszucha 15 Figure 3.7: States using TDFC Figure 3.8: Solution Trajectories
CHAPTER 3. CONTROL TECHNIQUES Choroszucha 16 Figure 3.9: Control
Chapter 4 Conclusions 4.1 Concluding Remarks Theoretically, this analysis suggests that one may control the weather through controlling convection and temperatures. Realistically, controlling the full nonlinear partial differential equations would be incredibly difficult. It would take an amasing control scheme and possibly a very large amount of energy for input, or if time was not much of an issue, one could capitalise on the term that Edward Lorenz coined, the Butterfly Effect, whereby small inputs could drastically change the system, however, in acting on the system, the Butterfly Effect will ripple through, causing further issues. In a nutshell, this is a chicken and egg type problem. 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
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 periodic orbits 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-December 2009. [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 difference control. New Journal of Physics, 10(6):063006, 2008. [7] B. Fiedler, V. Flunkert, M. Georgi, P. Hövel, and E. Schöll. Refuting the odd-number limitation 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 Transactions on In Automatic Control, 22(5):728 740, October 1977. [11] Robert C. Hilborn. Chaos and Nonlinear Dynamics. Oxford University Press, 2nd edition, 2001. [12] Chi-Chuan Hwang, Rong-Fong Fung, Jin-Yuan Hsieh, and Woei-Jong Li. A nonlinear feedback control of the lorenz equation. International Journal of Engineering Science, 37(14):1893 1900, 1999. 18
REFERENCES Choroszucha 19 [13] W. Just, B. Fiedler, M. Georgi, V. Flunkert, P. Hövel, and E. Schöll. Beyond the odd number 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, 3rd edition, 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 feedback control. 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 the lorenz equations using time-delayed feedback control. Phys. Rev. E, 76(5):056214, Nov 2007. [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 the Royal 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.
Appendix A Derivation My derivation follows [11, 547-558], but with added commentary using [9], [1] and [5] to expound upon the finer points in what [11] calls a development. 20
APPENDIX A. DERIVATION Choroszucha 21
APPENDIX A. DERIVATION Choroszucha 22
APPENDIX A. DERIVATION Choroszucha 23
APPENDIX A. DERIVATION Choroszucha 24
APPENDIX A. DERIVATION Choroszucha 25
Appendix B Code B.1 Open Loop Simulations 1 f u n c t i o n lorenzopen ( ) 2 3 sigma =10; 4 r =28; 5 b=8/3; 6 %t c =[0 5 0 ] ; 7 t c = 0 : 0. 0 1 : 5 0 ; 8 i c = [ 1 0. 0 0 1 10 3 0 ] ; 9 10 o d e o p t s=o d e s e t ( R e l T o l, 1E 6); 11 [ t x]= ode45 ( @lrwhcw, tc, i c, o d e o p t s ) ; 12 f i g u r e ( 1 ) 13 s u b p l o t ( 2, 2, 1 ) 14 p l o t 3 ( x ( :, 1 ), x ( :, 2 ), x ( :, 3 ), k ) 15 x l a b e l ( x ) 16 y l a b e l ( y ) 17 z l a b e l ( z ) 18 s u b p l o t ( 2, 2, 2 ) 19 p l o t ( t, x ( :, 1 ), k ) 20 x l a b e l ( \ t a u ) 21 y l a b e l ( x ) 22 s u b p l o t ( 2, 2, 3 ) 23 p l o t ( t, x ( :, 2 ), k ) 24 x l a b e l ( \ t a u ) 25 y l a b e l ( y ) 26 s u b p l o t ( 2, 2, 4 ) 27 p l o t ( t, x ( :, 3 ), k ) 28 x l a b e l ( \ t a u ) 29 y l a b e l ( z ) 30 s a v e a s ( gca, o p e n l o o p A l l - R e l T o l -6 - x 1 0 0 0 1. p n g ) 31 32 f i g u r e ( 2 ) 33 p l o t 3 ( x ( :, 1 ), x ( :, 2 ), x ( :, 3 ), k ) 34 x l a b e l ( x ) 35 y l a b e l ( y ) 36 z l a b e l ( z ) 37 s a v e a s ( gca, o p e n l o o p - R e l T o l -6 - x 1 0 0 0 1. p n g ) 38 39 f u n c t i o n dx=lrwhcw ( t, x ) 40 41 dx=z e r o 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 end 46 end B.2 Input State Linearisation 1 f u n c t i o n i s l i n e a r i s a t i o n ( ) 2 3 numpoints =10000; 26
APPENDIX B. CODE Choroszucha 27 4 5 sigma =10; 6 r =28; 7 b=8/3; 8 t f =100; 9 10 beta=[ 1 3 3]; 11 12 t t o t=l i n s p a c e ( 0, t f, numpoints ) ; 13 nt=numel ( t t o t ) ; 14 i c =[10 10 30 0 ] ; 15 o d e o p t s=o d e s e t ( R e l T o l, 1E 9); 16 [ t x]= ode45 ( @sonofthemorning, t t o t, i c, o d e o p t s ) ; 17 18 f i g u r e ( 1 ) 19 s u b p l o t ( 2, 2, 1 ) 20 p l o t 3 ( x ( :, 1 ), x ( :, 2 ), x ( :, 3 ), k ) 21 x l a b e l ( x ) 22 y l a b e l ( y ) 23 z l a b e l ( z ) 24 s u b p l o t ( 2, 2, 2 ) 25 p l o t ( t, x ( :, 1 ), k ) 26 x l a b e l ( \ t a u ) 27 y l a b e l ( x ) 28 s u b p l o t ( 2, 2, 3 ) 29 p l o t ( t, x ( :, 2 ), k ) 30 x l a b e l ( \ t a u ) 31 y l a b e l ( y ) 32 s u b p l o t ( 2, 2, 4 ) 33 p l o t ( t, x ( :, 3 ), k ) 34 x l a b e l ( \ t a u ) 35 y l a b e l ( z ) 36 s a v e a s ( gca, i s f l - a l l. p n g ) 37 38 f i g u r e ( 2 ) 39 p l o t 3 ( x ( :, 1 ), x ( :, 2 ), x ( :, 3 ), k ) 40 x l a b e l ( x ) 41 y l a b e l ( y ) 42 z l a b e l ( z ) 43 s a v e a s ( gca, i s f l. p n g ) 44 45 f i g u r e ( 3 ) 46 p l o t ( t ( 1 : ( end 1)), d i f f ( x ( :, 4 ) ). / d i f f ( t ), k ) 47 x l a b e l ( \ t a u ) 48 y l a b e l ( u ) 49 s a v e a s ( gca, i s f l - c o n t r o l. p n g ) 50 51 function dx=sonofthemorning ( t, x ) 52 53 dx=z e r o s ( 4, 1 ) ; 54 u=z e r o 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) 57 58 f =2 p i ; 59 ampl =500; 60 x1d=(ampl s i n ( f t ) ) ; 61 x1ddot=ampl f c o s ( f t ) ; 62 x1dddot= ampl f ˆ2 s i n ( f t ) ; 63 x1ddddot= ampl f ˆ3 c o s ( f t ) ; 64 xd=[x1d x1ddot x1dddot ] ; 65 66 d=(2 sigma b ) / ( b sigma ) ; 67 mu=d x1d ˆ2; 68 69 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 e 79 u=z e r o s ( 3, 1 ) ; 80 end 81 dx=z e r o s ( 3, 1 ) ; 82 dx ( 1 : 3 ) =F+u ; 83 dx (4)=u ( 2 ) ; 84 end 85 86 87 end B.3 Sliding Mode Control
APPENDIX B. CODE Choroszucha 28 1 function elemsmc ( ) 2 3 numpoints =10000; 4 5 e t a =0.25; 6 sigma =10; 7 r =28; 8 b=8/3; 9 e q p o i n t=s q r t ( b ( r 1 ) ) ; 10 eqvect =[ eqpoint eqpoint r 1 ] ; 11 12 t f =100; 13 t t o t=l i n s p a c e ( 0, t f, numpoints ) ; 14 nt=numel ( t t o t ) ; 15 i c =[10 10 30 0 ] ; 16 o d e o p t s=o d e s e t ( R e l T o l, 1E 9); 17 [ t x]= ode45 ( @sonofthemorning, t t o t, i c, o d e o p t s ) ; 18 19 f i g u r e ( 1 ) 20 s u b p l o t ( 2, 2, 1 ) 21 p l o t 3 ( x ( :, 1 ), x ( :, 2 ), x ( :, 3 ), k ) 22 x l a b e l ( x ) 23 y l a b e l ( y ) 24 z l a b e l ( z ) 25 s u b p l o t ( 2, 2, 2 ) 26 p l o t ( t, x ( :, 1 ), k ) 27 x l a b e l ( \ t a u ) 28 y l a b e l ( x ) 29 s u b p l o t ( 2, 2, 3 ) 30 p l o t ( t, x ( :, 2 ), k ) 31 x l a b e l ( \ t a u ) 32 y l a b e l ( y ) 33 s u b p l o t ( 2, 2, 4 ) 34 p l o t ( t, x ( :, 3 ), k ) 35 x l a b e l ( \ t a u ) 36 y l a b e l ( z ) 37 s a v e a s ( gca, smc - a l l. p n g ) 38 39 f i g u r e ( 2 ) 40 p l o t 3 ( x ( :, 1 ), x ( :, 2 ), x ( :, 3 ), k ) 41 hold on 42 p l o t 3 ( x ( end, 1 ), x ( end, 2 ), x ( end, 3 ), k +, M a r k e r S i z e, 1 2 ) 43 p l o t 3 ( e q v e c t ( 1 ), e q v e c t ( 2 ), e q v e c t ( 3 ), k s, M a r k e r S i z e, 1 2 ) 44 x l a b e l ( x ) 45 y l a b e l ( y ) 46 z l a b e l ( z ) 47 s a v e a s ( gca, s m c. p n g ) 48 49 f i g u r e ( 3 ) 50 p l o t ( t ( 1 : ( end 1)), d i f f ( x ( :, 4 ) ). / d i f f ( t ), k ) 51 x l a b e l ( \ t a u ) 52 y l a b e l ( u ) 53 s a v e a s ( gca, smc - c o n t r o l. p n g ) 54 55 function dx=sonofthemorning ( t, x ) 56 57 dx=z e r o s ( 4, 1 ) ; 58 u=z e r o s ( 3, 1 ) ; 59 F=[ sigma ( x(2) x ( 1 ) ) ( r x ( 3 ) ) x(1) x ( 2 ) x ( 1 ) x(2) b x ( 3 ) ] ; 60 61 i f ( t >20) 62 yd=eqpoint +2; 63 S=x(2) yd ; 64 u(2)= ( e t a ) s i g n ( S) F( 2 ) + 0. 5 s i n (2 p i t )+yd ; 65 end 66 67 dx=z e r o s ( 3, 1 ) ; 68 dx ( 1 : 3 ) =F+u ; 69 dx (4)=u ( 2 ) ; 70 end 71 end B.4 Time-Delayed Feedback Control B.4.1 Time-Step Algorithm 1 f u n c t i o n stepalgorithm ( ) 2 3 c l o s e a l l ; 4 pause ( 0. 1 ) ; 5 6 f o l d e r n a m e=d a t e s t r ( now, 3 0 ) ; 7 note={ L o o k i n g a t d o u b l e o r b i t. } ; 8 numpoints =10000;
APPENDIX B. CODE Choroszucha 29 9 10 type= s t e p ; 11 sigma =10; 12 r =28; 13 b=8/3; 14 %t c =[0 5 0 ] ; 15 t f =100; 16 17 tauarr =10; 18 K=1.5 eye ( 3, 3 ) ;%+0.1 rand ( 3, 3 ) ; 19 20 f o r o1=1 21 tau=t a u a r r ( o1 ) ; 22 t t o t=l i n s p a c e ( 0, t f, numpoints ) ; 23 nt=numel ( t t o t ) ; 24 x t o t=z e r o s ( nt, 6 ) ; 25 i c =[10 10 30 0 0 0 ] ; 26 x t o t ( 1, : ) = i c ; 27 t c =[ t t o t ( 1 ) t t o t ( 2 ) ] ; 28 o d e o p t s=o d e s e t ( 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 end 33 [ t x]= ode45 ( @sonofthemorning, tc, i c, o d e o p t s ) ; 34 x t o t ( a1 +1,:)= x ( end, : ) ; 35 i c=x ( end, : ) ; 36 i f ( a1 =nt 1) 37 t c =[ t t o t ( a1+1) t t o t ( a1 + 2 ) ] ; 38 end 39 end 40 41 s a v e C h a o t i c P l o t s ( type, t t o t, xtot, f a l s e, foldername, note, tau,k) ; 42 end 43 44 function dx=sonofthemorning ( t, x ) 45 46 dx=z e r o s ( 6, 1 ) ; 47 f o r i 1 =1:3 48 e ( i 1,1)= calcu ( t, x, i 1 ) ; 49 end 50 u= K e ; 51 52 dx=z e r o 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 end 58 59 f u n c t i o n myu=calcu ( t, x, a2 ) 60 i f ( t>=tau ) 61 myu=x ( a2) i n t e r p 1 ( t t o t, x t o t ( :, a2 ), t tau ) ; 62 e l s e 63 myu=x ( a2 ) ; 64 end 65 end 66 end B.4.2 Delayed Differential Equation 1 f u n c t i o n TDFCdde ( ) 2 3 sigma =10; 4 r =28; 5 b=8/3; 6 %t c =[0 5 0 ] ; 7 t f =100; 8 e q p o i n t=s q r t ( b ( r 1 ) ) ; 9 10 tau =10; 11 K=5 eye ( 3, 3 ) ; 12 13 t f=tau 1 0 ; 14 t t o t=l i n s p a c e ( 0, t f, 1 0 0 0 ) ; 15 nt=numel ( t t o t ) ; 16 x t o t=z e r o s ( nt, 6 ) ; 17 i c =[10 10 30 0 0 0 ] ; 18 x t o t ( 1, : ) = i c ; 19 20 o d e o p t s=o d e s e t ( R e l T o l, 1E 9); 21 ddeopts=d d e s e t ( R e l T o l, 1E 3); 22 23 p e r T i c =[ t t o t ( 1 ) t t o t (1)+ tau ] ; 24 [ pert h e r s t o r y ]= ode45 ( @sonofthemorning, [ t t o t ( 1 ) tau+t t o t ( 1 ) ], i c ( 1 : 3 ), o d e o p t s ) ; 25 s o l=dde23 ( @daughterofthemorning, tau, @herherstory, [ min ( t t o t ) max( t t o t ) ], ddeopts ) ; 26 x t o t=d e v a l ( s o l, t t o t ) ; 27
APPENDIX B. CODE Choroszucha 30 28 f i g u r e ( 1 ) 29 p l o t ( x t o t ( :, 1 ), x t o t ( :, 2 ), k ) 30 x l a b e l ( x ) 31 y l a b e l ( y ) 32 s a v e a s ( gca, s p r i n t f ( b - xy - % s - % d. p n g, uwhat, 1 0 0 0 rho ) ) 33 34 f i g u r e ( 3 ) 35 p l o t ( t t o t ( 1 : ( end 1)), d i f f ( x t o t ( :, 5 ) ). / d i f f ( t t o t ), k ) 36 x l a b e l ( t [ s ] ) 37 y l a b e l ( u _ x ) 38 s a v e a s ( gca, s p r i n t f ( b - ux - % s - % d. p n g, uwhat, 1 0 0 0 rho ) ) 39 40 f i g u r e ( 4 ) 41 p l o t ( t t o t ( 1 : ( end 1)), d i f f ( x t o t ( :, 6 ) ). / d i f f ( t t o t ), k ) 42 x l a b e l ( t [ s ] ) 43 y l a b e l ( u _ y ) 44 s a v e a s ( gca, s p r i n t f ( b - uy - % s - % d. p n g, uwhat, 1 0 0 0 rho ) ) 45 pause ( 1 ) ; 46 c l o s e a l l ; 47 48 function dx=sonofthemorning ( t, x ) 49 50 dx=z e r o 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 end 55 56 function dx=daughterofthemorning ( t, x, xtau ) 57 58 dx=z e r o s ( 6, 1 ) ; 59 e=x (1:3) xtau ( 1 : 3 ) ; 60 u= K e ; 61 62 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 end 68 69 f u n c t i o n myu=calcu ( t, x, a2 ) 70 i f ( t>=tau ) 71 myu=x ( a2) i n t e r p 1 ( t t o t, x t o t ( :, a2 ), t tau ) ; 72 e l s e 73 myu=0; 74 end 75 end 76 77 function r e t=herherstory ( t ) 78 r e t ( 1 : 3 ) = i n t e r p 1 ( pert, h e r s t o r y, mod( t, tau ) ) ; 79 r e t ( 4 ) = 0 ; 80 end 81 end