Control of Chaotic Dynamical Systems using OGY G. Witvoet DCT 2005.36 Traineeship report Coach(es): M. Steinbuch Supervisor: L.N. Virgin (Duke University) H. Nijmeijer Technische Universiteit Eindhoven Department Mechanical Engineering Dynamics and Control Technology Group Eindhoven, 31st March 2005 Summary Chaos is the general name for non-linear dynamical systems which behave noise-like. Chaos is indecomposable, is highly dependent on the initial condition and consists of a large number of periodic points and orbits. Because of this, the solution of a chaotic system is difficult to predict, which calls for a way to control it. The control algorithm of Ott, Grebogi and Yorke (OGY, [13]) manages to do this. The basic observation behind OGY is that a chaotic attractor has a large number of unstable periodic solutions embedded within itself. Furthermore, by slightly perturbing an accessible parameter of the system, it is possible to push the system towards one of these orbits. Since chaos behaves ergodically, at some point in time the solution will come into the vicinity of a certain point of the orbit where a linearization is valid. With this linearization a simple pole placement method can be used to calculate a control effort to direct the system towards this point and thus the orbit. OGY is a discrete control algorithm, perturbing the system at discrete moments in time. OGY can therefore easily be used on discrete systems like the Hénon map. By first discretizing a system using the Poincaré map it can also be used on continuous systems like the Duffing oscillator. Periodic orbits will become a simple sequence of points on the Poincaré map (m points for a period m orbit), around which the OGY algorithm finds a linearization. The accuracy of this linearization is very important in the implementation of OGY. In cases where no model is present the values of the periodic points should be estimated using the recurrence method and the matrices A and B in xi+1 − x∗ i+1 = Ai (xi − x∗ i ) + Bi (pi − ¯p) should be estimated using linear least squares and data points in a small vicinity around x∗ j . Better results are obtained when this estimation is performed iteratively; the fixed point estimate ¯x is adjusted and the matrix A recalculated until the offset C in xi+1 − ¯xi+1 = Ai (xi − ¯xi) + C is close to zero. The matrix B is calculated with these new values of ¯x and A. The matrices A and B are then used to find the control matrix KT with which the control effort (or parameter perturbation) during simulation can be calculated: pi − ¯p = −KT i (xi − x∗ i ). When this perturbation is bigger than a limit δ, it is set to zero, so that a vicinity around ¯x is defined. Applying this on Hénon and Duffing indeed results in controlled states, for different periodic orbits. Observations during these simulations include: a steady state control effort iii SUMMARY when using estimations, time to achieve control differs per orbit and per simulation, maximum perturbation δ influences time to achieve control and number of false control attempts. OGY is able to overcome some amount of noise and is therefore quite robust. When noise is present during estimation though, it could cause poor estimates and therefore no control. When only one variable of the system can be measured, delay coordinates can be used to reconstruct the chaotic attractor (and its Poincaré map). Since previous control efforts could still have a direct effect on the current state of the system, the OGY algorithm should be adjusted for this. Implementation of this new algorithm caused problems though. Therefore an adjustment is made so that the parameter perturbation is applied in less time, removing the necessity of adjusting the OGY algorithm itself. Simulation indeed proved the increased performance for both period 1 and 2 orbits. As soon as all the estimates are made, OGY can also be implemented in SimulinkR , which makes it easier to play around with the system. Therefore two models, for both period 1 and period 2 orbits, were made, which show results comparable to the previous results. Summarizing, OGY seems to work on any system, discrete and continuous, with or without delay coordinates, as long as the error during estimation is not too big. The influence of the maximum parameter perturbation was shown, e.g. on the time to achieve control. Not needing a model makes OGY attractive to use. However, there are some major drawbacks of OGY. For example, control is restricted to one of the embedded orbits, time to achieve control is unpredictable and could be very large, and the eigenvectors are changed after control implementation. Recommendations considering OGY include taking different estimation methods for the periodic points and the matrices A and B. One can think of Partial Least Squares in case there is correlation present, or using a non-linear least squares method (e.g. quadratic) in order to shorten the time to achieve control by increasing the control vicinity. Furthermore, it should be investigated whether OGY can be written in continuous form, so that control can be applied around any point of the orbit instead of just one, thereby decreasing the time to achieve control even further. Targeting techniques could also be used for this purpose. iv Acknowledgements This report is the result of an international internship I’ve done in the year 2004. I had the privilege of spending three months in Durham NC, at Duke University, at the Department of Mechanical Engineering. Besides the research on the control of chaos I’ve done there, I was able to meet lots of people and see a lot of things in the USA. This gives me reason to be thankful. First of all my thanks goes to prof Lawrence Virgin, supervisor of my internship at Duke. I owe the opportunity of this internship to him, for he accepted my request and invited me to come to Duke for this assignment on OGY. I’m grateful for the confidence he had in me and for all the help he provided regarding my assignment. Thank also to prof Maarten Steinbuch and prof Henk Nijmeijer, my supervisors at the Technische Universiteit Eindhoven (TU/e) in the Netherlands, who were able to give directions by replying to the many questions I’ve sent by e-mail. Regarding the statistical part of this report, I’ve received some help from prof Alessandro Di Bucchianico and Rens Kodde from the TU/e and even from my roommate in the USA, Philippe Lűdi. Thanks to you also. Thanks also to Marten Voogt, friend and inmate, for letting me ’use’ his fast computer for my time consuming calculations, since my own computer was too slow. Besides these people I’m also very thankful to the people who were just there for me and supported me. I’d like to thank the Navigators for their friendship, BBQ’s and quality time. And of course for the awesome beachtrip. I’d also like to thank my labmates from "The Überoffice", Ryan Greer, Michael Hunter and Sophia Santillan, for their friendship and for helping me out every once in a while. Finally, my thanks goes to my wife Sietske, who was there with me, supported me and never doubted me. And of course my thanks to my God and Savior Jesus Christ, for His protection, comfort and wisdom. v Contents Summary iii Acknowledgements v 1 Introduction 1 2 Background 3 2.1 Chaotic dynamical systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.1.1 Definition and properties . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.1.2 Chaotic examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.1.3 Characterizing chaos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.2 Elementary control theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2.1 Pole placement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3 The OGY control theorem 11 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.2 Description of the OGY algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.2.1 Fixed points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.2.2 Higher periodic orbits . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.2.3 OGY and delay coordinates . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.3 Implementation of the OGY algorithm . . . . . . . . . . . . . . . . . . . . . . . 16 3.3.1 Recurrence method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.3.2 Least Squares method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4 OGY control of the Hénon map 19 4.1 Introduction to Hénon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4.1.1 Fixed points and linearization . . . . . . . . . . . . . . . . . . . . . . . . 20 4.2 Application of OGY to Hénon . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.2.1 Known fixed point, known A and B . . . . . . . . . . . . . . . . . . . . 21 4.2.2 Unknown fixed points, known A and B . . . . . . . . . . . . . . . . . . . 24 4.2.3 Unknown fixed points, unknown A and B . . . . . . . . . . . . . . . . . 27 4.3 Concluding remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 5 OGY control on the Duffing oscillator 31 5.1 System description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5.2 Application of OGY to Duffing . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.2.1 Adjustment of the estimates . . . . . . . . . . . . . . . . . . . . . . . . . 33 vii CONTENTS 5.2.2 Control without delay coordinates . . . . . . . . . . . . . . . . . . . . . 34 5.2.3 Control with delay coordinates . . . . . . . . . . . . . . . . . . . . . . . 36 5.2.4 Alternative method for delay coordinates . . . . . . . . . . . . . . . . . 37 5.3 Implementation in SimulinkR . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 5.3.1 The models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 5.3.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 5.4 Concluding remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 6 Conclusions and recommendations 43 6.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 6.2 Recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 References 47 Appendices 49 A Estimation results for Hénon 51 B Estimation results for Duffing 53 C Matlab R code 55 C.1 The Hénon map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 C.2 The Duffing oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 C.3 Estimation tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 C.3.1 Estimating fixed points and orbits . . . . . . . . . . . . . . . . . . . . . 56 C.3.2 Estimating A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 C.3.3 Estimating B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 C.3.4 Estimation adjustments . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 C.4 The OGY algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 C.4.1 Fixed point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 C.4.2 Higher periodic orbits . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 C.4.3 Delay coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 D Simulink R models 65 viii Chapter 1 Introduction Ever since the beginning of mankind, people are fascinated by movements, like the movement of the sun along the sky or the falling of objects towards the ground. Through the years mankind has learned that these movements are generated and influenced by forces. This knowledge has resulted into the research field called dynamics: the study of bodies in motion and the forces acting on them. Increased insight in dynamics during the past centuries finally has paved the way for control technology. This latter research field manages to regulate movements studied by dynamics, and has developed very fast in the 20th century due to the invention of the computer. In dynamics there is a general distinction between linear and non-linear dynamics. Although most dynamical systems in reality appear to be non-linear, most of the emphasis of dynamic research is put on linear systems. Linear research provides basic insight in dynamics and control, mainly because it is much easier to understand than non-linear systems. This results in the fact that dynamical analysis and control of linear systems is far more developed than non-linear systems. This report will deal with a special kind of non-linear dynamic behavior, so called chaos. Main focus will not be on the analysis but on its control. Furthermore, it will only concentrate on situations where the dynamics of the system is unknown, so no model is present. It will be assumed that there is only some amount of experimental data of the system. This restriction (the absence of a model) will limit the control possibilities; e.g. control will only be possible towards certain fixed points or orbits. The goal of this report is to examine the possibility of controlling a certain experimental chaotic dynamical system towards one or multiple (unstable) orbits, by just measuring one state variable of the system. However, no actual experiment is done for this, the data used is just numerical. In order to reach its goal, this report will use an algorithm designed by Edward Ott, Celso Grebogi and James Yorke to control chaos. These authors introduced their so called OGY algorithm in 1990, which was further improved by various authors in the following years. Chapter 2 will give an introduction to chaotic dynamical systems and some basic control theory. Chapter 3 will discuss the basics of the OGY algorithm. In the following chapters this algorithm is implemented in both discrete and continuous systems. Finally, chapter 6 will discuss the results and reflect on them. 1 Chapter 2 Background Before examining and applying the algorithm for chaotic dynamical systems, it is useful to discuss some background. This chapter will therefore give some background on chaotic systems (section 2.1, see also [2], [21] and [22]) and some elementary control theory (section 2.2). 2.1 Chaotic dynamical systems 2.1.1 Definition and properties What exactly is a chaotic dynamical system? In general, the equation of a dynamical system can be written in the form ˙x = f (x, u) or xi+1 = f(xi, ui), (2.1) where x is the state vector and u the input vector of the system. If the function f is nonlinear in x and/or u, the system is also non-linear. A chaotic system is a special kind of non-linear system, characterized by its chaotic behavior. However, this behavior cannot be recognized by just looking at the equation of the system, no matter how simple that equation is. One can only recognize chaotic behavior by analyzing the system response, which can be highly complicated and noise-like. Due to its complexity, there is no common definition of chaotic systems, but Devaney [2] manages to define chaos quite well using the following three properties: 1. A chaotic system has sensitive dependence on initial conditions. 2. A chaotic system is topologically transitive. 3. Periodic orbits and/or points are dense in the chaotic attractor. In other words, a chaotic system is unpredictable, since its response will highly depend on the initial condition; a small perturbation can result in a completely different response. Topological transitivity means that the system is indecomposable; it cannot be broken down into two subsystems. Finally, a chaotic system also has an element of regularity, since it is composed by a large number of periodic orbits and points embedded within the system. A typical chaotic response contains an infinite number of periodic orbits, creating an aperiodic solution, but the response can also be a simple periodic motion. Again, this depends to a large extend on the initial condition. Further explanation can be found in [2]. 3 CHAPTER 2. BACKGROUND A chaotic system can only be analyzed by observing the responses for a large set of different initial conditions, since a single solution, aperiodic or not, cannot fully describe the chaotic system. Because of this, only a few systems are actually proven to be chaotic, like the Hénon map of chapter 4. For the other systems used in this report, chaos is very plausible. Although a typical aperiodic response of chaos looks like noise, its structured behavior clearly shows the contrary. This structure is called ergodic behavior. When the system wanders through space, at a certain time t1 it crosses point x1. A time t2 after t1 it will come into some vicinity ε of the point x1 again. The same will happen a time t3 after t2, etc. In general, the smaller this vicinity ε is defined, the bigger t2, t3, . . . will be. But although the solution will come very close to x1, it will never become completely equal to it (with ε→0, ti →∞). This ergodic behavior explains the so called strange attractor which will arise; a certain subspace in space inside which the solution of the system will wander around. 2.1.2 Chaotic examples To illustrate the chaotic properties mentioned in the previous section, this section will shortly discuss two examples: the Rössler system and the Duffing oscillator. 2.1.2.1 Rössler system In 1976 Otto E. Rössler found a very simple 3-D continuous chaotic system, including its attractor[17]. This system is defined by the following set of differential equations: ˙x = − (y + z) ˙y = x + ay ˙z = b + xz − cz, (2.2) where a, b and c are parameters of the system. The equation contains only one simple −10 −5 0 5 10 15 −10 −5 0 5 10 0 5 10 15 x Rossler system; Strange attractor y z (a) 3-D representation −10 −5 0 5 10 15 −10 −8 −6 −4 −2 0 2 4 6 8 x y Rossler system; 2−D representation (b) 2-D representation in x and y Figure 2.1: Response of Rössler system with initial condition (4,4,1) 4 2.1. CHAOTIC DYNAMICAL SYSTEMS non-linearity, namely xz. Still, for some initial conditions the 3-D solution (x, y, z) of the system clearly shows a strange attractor; see figure 2.1 where a = 0.2, b = 0.4 and c = 5.7. The solution neither converges to a stable point or a periodic orbit, nor does x, y, z → ∞. Instead, the system wanders around within a certain subspace, never crossing itself, creating an aperiodic solution. This strange attractor shows the ergodic and thus chaotic behavior of the system. It should be noted though, that for some initial conditions the solution does become periodic, and for other initial conditions x, y, z →∞. −8 −6 −4 −2 0 2 4 6 8 10 −10 −8 −6 −4 −2 0 2 4 6 8 x y Figure 2.2: Dependence on initial conditions for (2.2); a = 0.2, b = 0.4, c = 5.7 The dependence on initial conditions is shown in figure 2.2. One curve has initial condition (0, −4, 0) and the other has an initial condition very close to this. However, both solutions follow a different path and after 40s of simulation (indicated by the encircled marks) both solutions clearly differ. 2.1.2.2 Duffing oscillator The example of Rössler is just a theoretical case meaning that the equation doesn’t represent an actual system. A system which does arise in reality is the Duffing oscillator [5]: ¨x + δ ˙x + (βx3 ± ω2 0x) = γ cos(ωt + φ). (2.3) Georg Duffing introduced this non-linear equation in 1918 to model the vibration modes of a beam with periodic forces acting on it. With certain parameter choices this system can behave in a chaotic way, meaning that the solution can be aperiodic. This behavior depends on the initial condition though. This is illustrated by the following Duffing oscillator: ¨x + d ˙x + x + x3 = f cos ωt, (2.4) where d = 0.2, f = 36 and ω = 0.661 (see [4]). When the initial condition is set at (0,1), the response of the system looks chaotic, as can be seen by the strange attractor in figure 2.3(a). However, figure 2.3(b) shows that the system behaves completely different when the initial condition is set on e.g. (0, 0). It seems that the solution is some kind of higher periodic orbit. 5 CHAPTER 2. BACKGROUND −5 −4 −3 −2 −1 0 1 2 3 4 5 −10 −8 −6 −4 −2 0 2 4 6 8 10 x (position) dx(velocity) Response for (0,1) (a) Initial condition: (0,1) −5 −4 −3 −2 −1 0 1 2 3 4 5 −10 −8 −6 −4 −2 0 2 4 6 8 10 x (position) dx(velocity) Response for (0,0) (b) Initial condition: (0,0) Figure 2.3: Response of (2.4); the first 500s of transient behavior is removed One way to investigate the (a)periodicity of a solution is by making a Fourier transform (FFT), shown in figure 2.4. The difference is obvious: the first solution shows a very noisy and continuous FFT, whereas the second clearly is discrete. It has sharp peaks at 1 3 ω, ω, 12 3 ω, 21 3 ω, etc, in other words, 1 3 ω +k2 3 ω, where k∈Z. This shows that the latter attractor only contains a finite number of frequencies and is thereby a periodic attractor. The first trajectory is clearly aperiodic since its FFT shows that it contains all frequencies. It should be said though, that 0 5 10 15 20 25 30 −100 −50 0 50 100 150 200 FFT of position Frequency (rad/s) dB 0 5 10 15 20 25 30 −100 −50 0 50 100 150 200 FFT of velocity Frequency (rad/s) dB (a) Initial condition: (0,1) 0 5 10 15 20 25 30 −100 −50 0 50 100 150 200 FFT of position Frequency (rad/s) dB 0 5 10 15 20 25 30 −100 −50 0 50 100 150 200 FFT of velocity Frequency (rad/s) dB (b) Initial condition: (0,0) Figure 2.4: Fourier transform of figure 2.3 6 2.1. CHAOTIC DYNAMICAL SYSTEMS the existence of an aperiodic solution doesn’t prove that the system itself is chaotic (see the definition of chaos in section 2.1.1). 2.1.3 Characterizing chaos The previous section already introduced the FFT method to investigate chaotic behavior. This section will shortly introduce some more methods to detect and characterize chaotic behavior. 2.1.3.1 Bifurcation diagram Non-linear systems are often subject to a phenomenon called bifurcation: the dynamic behavior of the system changes due to changes in one of the parameters. For example, the number of fixed points or (in)stable periodic orbits can depend on the value of a single parameter. The parameter value where this change occurs is where the bifurcation arises. Figure 2.5: Bifurcation diagram of xn+1 = cos (µxn); 40 points are plotted at each µ The easiest way to illustrate bifurcations is by looking at a discrete system xn+1 = f (xn, µ), where µ is the parameter, for example: xn+1 = cos (µxn) . (2.5) By iterating (2.5) lots of times at a certain parameter value, one can find periodic orbits: xn will only take a finite number of values. By plotting these points for different values of µ a so called bifurcation diagram is obtained (figure 2.5). For example, at µ ≈ 1.3 the single equilibrium changes to a period two orbit and at µ ≈ 1.8 the orbit becomes period four. These points are therefore (period doubling) bifurcation points. At µ ≈ 2.3 and µ ≈ 2.9 there is an infinite amount of periodic orbits with different periods, or in other words, chaos is present. 2.1.3.2 Poincaré maps For autonomous continuous systems, chaos can only occur in systems of third order or higher (see [21]). The response for a third order system is hard to draw though, since it needs 7 CHAPTER 2. BACKGROUND a 3-D plot to fully capture its behavior. Higher order systems will even need more dimensions. It is therefore useful to make plots of lower dimension which are able to show part of the dynamic behavior. A common method to do this is by making a Poincaré map (figure 2.6). It is named after Henri Poincaré, who introduced this map in 1881 (see [15]). Figure 2.6: Poincaré map; from [18] page 294 Suppose an n-dimensional system has a solution which intersects a certain hypersurface of dimension n−1. The points of intersection where the solution has the same direction then form the Poincaré map. It is called a map since it maps each intersection point (xj) into the next (xj+1). Of course, the resulting Poincaré map will depend on the choice of the hypersurface. A periodic orbit will become a single point in the Poincaré representation, and a chaotic attractor will be characterized by a certain shape. See figure 2.7 where the Poincaré map of the Rössler system (2.2) is drawn, with a = 0.2, b = 0.4 and c = 5.7. The hypersurface is formed by x = 0. For e.g. the Duffing oscillator one can also choose a constant phase as the hypersurface, which means sampling with the same period as the acting force. It is clear that the Poincaré map not only decreases the dimension with one, it also turns a continuous time system into a discrete time system, with xj+1 = f(xj). 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 0 0.5 1 1.5 2 2.5 3 Rossler system; Poincare−map y z Figure 2.7: Poincaré map of figure 2.1(a); hypersurface x = 0, y positive −10 −5 0 5 10 15 −10 −5 0 5 10 15 x(t−T) x(t) Delay coordinates reconstruction Figure 2.8: Reconstruction of figure 2.1(b), using x(t), x(t − τ); τ = 0.88 2.1.3.3 Delay coordinates During experiments it is sometimes not possible to measure all n state components, but only one or two. Still it might be useful to construct the n-dimensional chaotic attractor in order to analyze the system and its chaotic behavior. In their article [14], Packard et al. manage to do this using just one state component (say, x) by using the delay coordinates method: the attractor is reconstructed by defining n new states x(t), x(t−τ), x(t−2τ), . . . , x(t−(n−1)τ), 8 2.2. ELEMENTARY CONTROL THEORY where τ is a chosen delay time [11]. The resulting attractor can then be used for further analysis, e.g. to make a Poincaré map. Compare the delay coordinates reconstruction of the Rössler system with its original in figure 2.8. 2.2 Elementary control theory Before chapter 3 will discuss a control algorithm for chaotic dynamical systems, this section will give a short introduction to some basic control theory. Only the so called pole placement method will be discussed, since this is the basic method the control algorithm of chapter 3. 2.2.1 Pole placement The pole placement control method is probably one of the easiest control laws and therefore also quite easy to understand. It is a linear control method working well on linear systems. Since non-linear systems can normally be linearized around a equilibrium point, it is also applicable to a wide variety of non-linear systems. 2.2.1.1 Linear systems In order to apply pole placement, a system should be expressed in state space notation: ˙x = Ax + Bu for continuous systems, (2.6a) xj+1 = Axj + Buj for discrete systems. (2.6b) Here A is the (n × n) system matrix, B the (n × m) input matrix, x the (n × 1) state of the system and u the (m × 1) input. For continuous cases, system (2.6a) is stable when all the eigenvalues λi of A are negative, or (λi) < 0. For discrete cases, system (2.6b) is stable when the magnitude of every eigenvalue λi of A is smaller than 1, or |λi| < 1. When system (2.6) is unstable, an input u is needed to stabilize the system. The following pole placement technique will manage to do this when the system is controllable. This means that the controllability matrix P defined by P = [B, AB, A2 B, . . . , An−1 B] (2.7) has to have full rank n. When this is the case, a so called state feedback u = −Kx or uj = −Kxj can be defined, so that (2.6) can be written as: ˙x = Ax + Bu = Ax − BKx = (A − BK)x. (2.8) Now the matrix (A − BK) is the new system matrix, so the stability of the controlled system is now determined by the eigenvalues of (A−BK) and will depend on K. The eigenvalues, or poles, of the system can thus be placed anywhere by choosing an appropriate K. By choosing these poles according to (λi) < 0 (for continuous systems) or |λi| < 1 (for discrete systems) the system will become stable. Stabilizing a linear system is thus translated into finding K corresponding to the chosen poles. One way to do this is by using Ackermann’s formula (see [1]). This algorithm is also implemented in MatlabR (command acker). 9 CHAPTER 2. BACKGROUND 2.2.1.2 Non-linear systems Non-linear systems can also be written in state space notation: ˙x = f(x, u) for continuous systems, (2.9a) xj+1 = f(xj, uj) for discrete systems. (2.9b) Now suppose system (2.9) has an equilibrium point (x∗, u∗), for which holds that ˙x∗ = 0 or x∗ j+1 = x∗ j resp. Then around x∗ system (2.9) is linearized by defining: A =    ∂f1 ∂x1 · · · ∂f1 ∂xn ... ... ... ∂fn ∂x1 · · · ∂fn ∂xn    (x∗,u∗) and B =    ∂f1 ∂u1 · · · ∂f1 ∂um ... ... ... ∂fn ∂u1 · · · ∂fn ∂um    (x∗,u∗) , (2.10) both evaluated at the equilibrium point (x∗, u∗). Then around this equilibrium point we can approximate system (2.9) by using (2.6). Finding an appropriate control law u = −Kx is then the same as in the previous paragraph. There is one essential difference though. For linear systems the control law will control any point x ∈ R, whereas for non-linear systems the control law will only work for x sufficiently close to x∗, since the linearization (2.10) is only valid in the vicinity of the equilibrium point. 10 Chapter 3 The OGY control theorem 3.1 Introduction The name OGY comes from its inventors: Edward Ott, Celso Grebogi and James Yorke. In 1990 they published an article [13], showing that it was possible to control chaos, and thereby being the first to achieve this with reasonable control efforts. Ott, Grebogi and Yorke based their theory on recent articles showing that a chaotic attractor has a large number of unstable periodic orbits embedded within it [11]. The essence of the OGY theory is simply to stabilize one (or more) of these orbits by applying small perturbations. To apply these perturbations one of the parameters of the system should be accessible, meaning that this parameter can be adjusted while the system is running. This parameter thus becomes the input of the system. Ott, Grebogi and Yorke based their theory on just experimental data of the chaotic attractor, without having a priori analytical knowledge of the system. The noise-like behavior of the data causes modelling of a chaotic system to be almost impossible. OGY can only be applied to discrete data, so continuous time systems should first be made discrete time by using e.g. the Poincaré map. In case only one state variable can be measured, the OGY theory could be combined with the delay coordinates method [14]. The method presented by Ott, Grebogi and Yorke still needed some modifications though. While their article [13] was only theoretical and used a discrete time numerical Hénon map example, Ditto et al. were the first to successfully implement the OGY theory in a real experimental system [3], namely a parametrically driven magnetoelastic ribbon. They used an article by Eckmann and Ruelle [6] to approximate the dynamic behavior in the vicinity of the desired orbit. Dressler and Nitsche discovered a difficulty of OGY when they implemented it using delay coordinates. In their article [4] they proposed an important change to OGY, making it applicable to any experimental chaotic system. Romeiras et al.[16] wrote an important article in further understanding of the OGY theory. They restated the algorithm and showed that OGY is nothing more then an ordinary pole placement technique (discussed in section 2.2), making the algorithm easier to implement. Furthermore the OGY algorithm was also implemented to control not only fixed points, but also periodic orbits. The articles [20] and [7] continue the article of Romeiras et al. by applying the pole placement technique to the control of fixed points and orbits using delay coordinates, making 11 CHAPTER 3. THE OGY CONTROL THEOREM OGY applicable to every situation: fixed points as well as periodic orbits, discrete time maps as well as continuous time systems discretized by Poincaré and delay coordinates. Other adjustments, extensions and discussions of the OGY theory are discussed in [12], [19], [9] and [10]. 3.2 Description of the OGY algorithm As said before, the basic idea behind the OGY algorithm is that there are a large number of unstable periodic orbits embedded within a chaotic attractor. By perturbing a certain accessible parameter, it is possible to stabilize one (or more) of these orbits. But how does it work? This section will introduce the mathematics of the OGY algorithm, mostly based on articles [16], [20] and [7]. As was mentioned in section 3.1, OGY control is only applicable to discrete time systems. In case of a continuous time dynamical system, this system should first be converted into a discrete time system by using e.g. Poincaré maps (section 2.1.3.2). This way a n-dimensional system can be written in the form: xi+1 = f(xi, p), (3.1) where xi ∈ Rn is the n-dimensional state of the system at iteration i and p is the accessible parameter mentioned in section 3.1. For the parameter p a nominal value ¯p is defined, for which the system has a chaotic attractor. Since the perturbation of p is assumed to be small, the value of p is restricted: |p − ¯p | < δ. (3.2) A fixed point of the discrete time map (3.1) with p = ¯p satisfies x∗ i+1 = x∗ i , which is a period one orbit if the real system is described in continuous time (assuming the sampling is done once per period). Similarly, a period two point for the discrete time map, or period two orbit for continuous time systems, corresponds to x∗ i+2 = x∗ i . In general, a period T point or orbit satisfies x∗ i+T = x∗ i . Of course, for any q ∈ Z this also means that x∗ i+T+q = x∗ i+q. For understanding, the implementation of OGY for period one and higher periods is discussed separately in the following sections. 3.2.1 Fixed points First the case x∗ i+1 = x∗ i = x∗ is considered, where x∗ is an unstable fixed point embedded within the chaotic attractor. Since the system is ergodic (section 2.1.1) the state xi will come very close to this point at some point in time, while p = ¯p. When this is the case, system (3.1) can be linearized around x∗: xi+1 − x∗ = A(xi − x∗ ) + B(p − ¯p), (3.3) where A is the Jacobian and B represents the influence of the ’input’ p (for j, k = 1, 2, . . . , n): A = ∂f ∂x (x∗, ¯p) = Dxf(x, p) (3.4a) B = ∂f ∂p (x∗, ¯p) = Dpf(x, p), (3.4b) 12 3.2. DESCRIPTION OF THE OGY ALGORITHM both matrices evaluated at x = x∗ and p = ¯p. Then a state feedback can be defined, similar to section 2.2: p − ¯p = −KT (xi − x∗ ), (3.5) so that xi+1 − x∗ = A(xi − x∗) + B(p − ¯p) = A(xi − x∗) − BKT (xi − x∗) = (A − BKT )(xi − x∗). (3.6) Stability is now determined by the eigenvalues of (A−BKT ). As said in section 2.2 the system is stable when |λ| < 1. When the system is controllable, the poles λ can be placed anywhere by calculating the corresponding KT (with Ackermann’s method [1]). The question is, how should these poles be chosen in OGY control? Since x∗ is unstable, matrix A will have nu unstable eigenvalues and ns stable ones (with nu+ns =n). Then choose ns poles of (A−BKT ) equal to the ns poles of A and choose the remaining nu poles equal to zero, which corresponds to superstability. When the OGY algorithm was first introduced, it was believed that this would cause the stable eigenvectors to remain unchanged. But although the eigenvalues ns are still the same as before, the stable directions do change, since the eigenvectors of A − BKT are different then those of A. With these desired poles one can find KT , with which the parameter perturbation as defined in (3.5) can be found. One should keep (3.2) in mind though. Therefore, when KT (xi − x∗ ) ≥ δ the control is set to zero, so that p = ¯p. 3.2.2 Higher periodic orbits The OGY algorithm for orbits (or points) with period larger than one is slightly more complicated. Suppose there is an orbit of period T embedded within the chaotic attractor, meaning that x∗ i+T = x∗ i for any i. So for every iteration (or intersection with the Poincaré map) we can linearize the system, finding T different matrices Ai (the Jacobian) and Bi: Ai = Ai+T = ∂f ∂x (x∗ i , ¯p) = Dxf(x, p) (3.7a) Bi = Bi+T = ∂f ∂p (x∗ i , ¯p) = Dpf(x, p), (3.7b) evaluated at x = x∗ i and p = ¯p. At each iteration i the linearization is now given by: xi+1 − x∗ i+1 = Ai (xi − x∗ i ) + Bi (pi − ¯p) . (3.8) Furthermore, at the unstable orbit of period T (with p= ¯p) it is known that x∗ i+T = f x∗ i−1+T , ¯p , x∗ i−1+T = f x∗ i−2+T , ¯p , . . . , x∗ i+1 = f (x∗ i , ¯p) (3.9) In order to determine the stability of this orbit, one can investigate the propagation of a small error ε. This can be done by using the Taylor expansion: f(xi + ε, ¯p) = f(xi, ¯p) + Dxf(xi, ¯p)ε + O(ε2 ) ≈ f(xi, ¯p) + Dxf(xi, ¯p)ε. (3.10) 13 CHAPTER 3. THE OGY CONTROL THEOREM After T iterations, using Dxf(xi) = Ai, this then leads to: f(x1 + ε, ¯p) ≈ f(x1, ¯p) + Dxf(x1, ¯p) = x2 + A1ε (3.11a) f(x2 + A1ε, ¯p) ≈ f(x2, ¯p) + Dxf(x2, ¯p)A1ε = x3 + A2A1ε (3.11b) ... f(xT + AT−1 · · · A1ε, ¯p) ≈ x1 + (AT AT−1 · · · A2A1)ε (3.11c) The error after one period of the orbit is, by approximation, equal to (AT · · · A1)ε. It is clear that this error is smaller than ε when the magnitude of (AT · · · A1) is smaller than one. In other words, the stability of the period T orbit is determined by the eigenvalues λ of (AT · · · A1), i.e the product of all the T matrices Ai in descending order. The starting point of the multiplication doesn’t matter: the eigenvalues of (AT AT−1 · · · A2A1) are exactly equal to those of e.g. (A4 · · · A1AT AT−1 · · · A5). The eigenvectors do differ though. Where the (in)stability of an orbit is the same at each iteration, the direction in which this happens is of course different. Now assume that the orbit has s stable and u unstable eigenvalues. Then at every iteration i there are s stable eigenvectors {νi,1, . . . , νi,s} and u unstable eigenvectors {νi,1, . . . , νi,u}, which are formed by the eigenvectors of (AiAi−1 · · · Ai−T+1). The idea of OGY is then, in order to control the u unstable directions, the system is perturbed u times, so that xi+u lands on the linearized stable manifold of the periodic orbit through the point x∗ i+u. In other words, after u iterations the deviation should lie on the linearized stable subspace spanned by the stable eigenvectors {νi+u,1, . . . , νi+u,s}: xi+u − x∗ i+u = α1νi+u,1 + α2νi+u,2 + . . . + αsνi+u,s (3.12) Using linearization (3.8), xi+u − x∗ i+u is approximated by xi+2 − x∗ i+2 = Ai+1 xi+1 − x∗ i+1 + Bi+1 (pi+1 − ¯p) = Ai+1Ai (xi − x∗ i ) + Ai+1Bi (pi − ¯p) + Bi+1(pi+1 − ¯p) (3.13a) xi+u − x∗ i+u = Ai+(u−1) · · · Ai (xi − x∗ i ) + Ai+(u−1) · · · Ai+1Bi (pi − ¯p) +Ai+(u−1) · · · Ai+2Bi+1(pi+1 − ¯p) + . . . +Ai+(u−1)Bi+(u−2) pi+(u−2) − ¯p + Bi+(u−1) pi+(u−1) − ¯p (3.13b) = Φi,0 (xi − x∗ i ) + Φi,1Bi (pi − ¯p) + Φi,2Bi+1 (pi+1 − ¯p) + . . . +Φi,u−1Bi+(u−2) pi+(u−2) − ¯p + Bi+(u−1) pi+(u−1) − ¯p , (3.13c) Where Φi,j is defined as Φi,j = Ai+u−1Ai+u−2 · · · Ai+j+1Ai+j (3.14) Furthermore, a matrix Ci at each iteration i is defined as Ci = Φi,1Bi ... Φi,2Bi+1 ... · · · ... Φi,u−1Bi+u−2 ... Bi+u−1 ... νi+u,1 ... νi+u,2 ... · · · ... νi+u,s (3.15) This matrix Ci can be compared to the controllability matrix of section 2.2, so the system is controllable if Ci is nonsingular. When the control effort is defined similar to (3.5), i.e. pi − ¯p = −KT i (xi − x∗ i ), (3.16) 14 3.2. DESCRIPTION OF THE OGY ALGORITHM then Romeiras [16] and So and Ott [20] show that Ackermann’s method for setting the unstable poles to zero, as described in section 3.2.1, is equivalent to defining KT i as KT i = κC−1 i Φi,0, (3.17) where κ is an n-dimensional row vector whose first entry is one and remaining entries zero. Keep in mind that the restriction of (3.2) is still valid. If |pi − ¯p| ≥ δ, then pi is set to zero. 3.2.3 OGY and delay coordinates Most of the time it is impossible to measure all state variables of a system. To overcome this problem, section 2.1.3.3 gave a solution by introducing delay coordinates, for which an adjustment to the OGY algorithm is needed, as Dressler and Nitsche show in their article [4]. For a system with discrete time ti (e.g. by taking the Poincaré map) recall the definition of the delay coordinate: X(ti) = [x(ti), x(ti − τ), x(ti − 2τ), . . . , x(ti − (n−1)τ)] . (3.18) Assume that the time between two successive intersections of the solution with the Poincaré map is tF . It is clear to see that when (n − 1)τ > tF , the delay coordinate X at time ti contains information of the previous Poincaré intersection at time ti − tF . So if there was a parameter perturbation at time ti − tF , it still has influence at time ti. In fact, all parameter values {pi, . . . , pi−r} have influence on the variable X(ti) (to be called Xi), where r is the smallest integer such that (n−1)τ < rtF . This observation leads to an alternative description of the system: Xi+1 = F (Xi, pi, pi−1, . . . , pi−r) , (3.19) which leads to an alternative linearization: Xi+1 − X∗ i+1 = Ai (Xi − X∗ i ) + B1 i (pi−¯p) + B2 i (pi−1−¯p) + . . . + Br+1 i (pi−r −¯p) . (3.20) Here Bj i is equal to Bj i = Bj i+T = Dpi−(j−1) F (X, pi, pi−1, . . . , pi−r) . (3.21) In (3.20) pi is the only unknown on the right hand side. In order to solve for pi, new variables are introduced: Yi =        Xi pi−1 pi−2 ... pi−r        and Y ∗ i = Y ∗ i+T =        X∗ i ¯p ¯p ... ¯p        , (3.22) and the matrices A and B are redefined as ˜Ai =          Ai B2 i B3 i · · · Br i Br+1 i 0 0 0 · · · 0 0 0 1 0 · · · 0 0 0 0 1 · · · 0 0 ... ... ... ... ... ... 0 0 0 · · · 1 0          and ˜Bi =        B1 i 1 0 ... 0        . (3.23) 15 CHAPTER 3. THE OGY CONTROL THEOREM With these new variables and matrices, the linearization (3.20) can be written in the form Yi+1 − Y ∗ i+1 = ˜Ai (Yi − Y ∗ i ) + ˜Bi (pi − ¯p) . (3.24) The new matrices ˜Ai and ˜Bi can then be used in the OGY algorithm described in sections 3.2.1 and 3.2.2. 3.3 Implementation of the OGY algorithm The OGY control algorithm described in the previous section can only be applied once the fixed points or periodic orbits and the matrices A and B are known. Sometimes these have to be estimated though. Therefore, in order to control a n-dimensional continuous time system where not all variables can be measured, the following general strategy can be adopted: 1. Define the delay coordinate X(t) = [x(t), x(t − τ), . . . , x(t − (n − 1)τ)]; 2. Convert the system into a discrete time system, by constructing the Poincaré map, creating X(ti) = [x(ti), x(ti − τ), . . . , x(ti − (n − 1)τ)]; 3. Find fixed points X(ti+1)=X(ti) and period T points X(ti+T )=X(ti) of the Poincaré map; 4. Linearize the Poincaré map in the vicinity of these points, finding A; 5. Investigate the influence of a parameter perturbation and linearize again around the points of interest, thus finding B; 6. Implement the OGY algorithm described in section 3.2. Especially steps 3 and 4 may need some extra attention, since the methods used at these steps require a decent amount of statistics. In order to estimate fixed points and orbits, there is a method available called recurrence method, and for the estimation of A and B a Least Squares method will be used. The theory behind these methods is presented in the following sections; further adjustments will be made in chapter 5. 3.3.1 Recurrence method In order to apply OGY control, (an estimation of) the fixed points or orbits of the discrete time map of the system are needed, i.e. the values for xi for which xi+1 = xi or xi+T = xi holds, need to be found. When an exact description of the discrete time map is present, these points can be found by substituting these conditions into (3.1), keeping p = ¯p. For higher periodic orbits the calculations can become very complicated though. Sometimes an accurate description of the discrete time map isn’t available, thus a different approach is needed. Lathrop and Kostelich discuss such an approach in their article [11]. Assume a chaotic attractor of a continuous time system (or its delay coordinates reconstruction), and period one, two and three orbits embedded within it (figure 3.1). When a point x is close to an orbit, it will stay in the vicinity of this orbit for a certain time, moving with a frequency approximately equal to that of the orbit. Thus the motion of x is an approximation of the unstable orbit. The Poincaré points xi and xi+T are thus close to each other and give an approximation of x∗ i . 16 3.3. IMPLEMENTATION OF THE OGY ALGORITHM Now collect a large amount of data points, i.e. successive Poincaré intersections, and define a vicinity ε > 0. For each point xi follow its images xi+1, xi+2, . . . until the smallest k > i is found such that xk − xi < ε, and define m=k−i. Then if k exists, xi is an (m, ε) recurrent point. Figure 3.1: The recurrence method; from [11] page 4028 Such a point only indicates a possible period m orbit, but can not guarantee its existence. If recurrent points form a sequence though, so if all points xi, xi+1, . . . , xk are (m, ε) recurrent points, its presence becomes more likely. One can also make a histogram in which the number of occurrences of each value of m are plotted, in order to investigate this likelihood. A smaller ε and more data points will increase the accuracy of the recurrence method. Results for very high periodic orbits are not reliable, since high periodic recurrences are normally due to the ergodic behavior and not because of the stability of the orbit. Furthermore, low periodic points could occur as high periodic ones and vice versa, depending on the size of ε. In order to find all the m points of a period m orbit, one should collect all likely (m, ε) recurrent points, i.e. only those who are in a sequence (as described before). All points which are in each others vicinity (meaning they represent the same Poincaré point) should then be grouped and averaged. The thus achieved points ¯x1, ¯x2, . . . , ¯xm provide a reasonable estimation of the actual orbit x∗ 1, x∗ 2, . . . , x∗ m. 3.3.2 Least Squares method As can be concluded from section 3.2.2, the matrices Ai and Bi have to be computed for every point ¯x1, ¯x2, . . . , ¯xm found by the recurrence method. Since it is assumed that there is no model present, these matrices have to be estimated with the same data as was used for the recurrence method. The estimation is then done by an ordinary Least Squares method, described in e.g. [6]. The least squares method is normally used to find a best-fit linear curve for y=f(x) using an amount of data points. For (x1, y1), (x2, y2), . . . , (xp, yp), the basic form of least squares finds a and c in a function y = ax+c for which the sum of squares of the errors ej =yj−(axj+c) is as small as possible: min a,c : p j=1 e2 j = p j=1 [yj − (axj + c)]2 (3.25) For n-dimensional problems this becomes: min a1···ak,c : p j=1 e2 j = p j=1 [yj − (a1x1,j + a2x2,j + . . . + akxk,j + c)]2 (3.26) Here, the deviation of an n-dimensional point from the orbit is considered, expressed as (xi−¯xi, xi+1−¯xi+1) = (δxi, δxi+1) , (3.27) 17 CHAPTER 3. THE OGY CONTROL THEOREM where δxi has n components δxi,j (with j = 1, 2, . . . , n). Thus a linear curve for δxi+1 = f(δxi) must be sought. The points used for this are found by defining a small vicinity ξ > ε. For every ¯x1, ¯x2, . . . , ¯xm combinations (xi, xi+1) for which xi − ¯xi < ξ and its image xi+1 − ¯xi+1 < ξ should be found. If ξ is small enough only points close to the orbit, where the linearization is valid, are selected. 3.3.2.1 Finding A In order to find the matrix A, the linear fit for δxi+1 =f (δxi) can be written as δxi+1,1 = a1,1δxi,1 + a1,2δxi,2 + . . . + a1,nδxi,n + c1 δxi+1,2 = a2,1δxi,1 + a2,2δxi,2 + . . . + a2,nδxi,n + c2 ... δxi+1,n = an,1δxi,1 + an,2δxi,2 + . . . + an,nδxi,n + cn, (3.28) creating n equations which can be solved with the least squares method. A is then formed by A =      a1,1 a1,2 · · · a1,n a2,1 a2,2 · · · a2,n ... ... ... ... an,1 an,2 · · · an,n      . The numbers ci form a vector C which denotes an offset, which is not equal to the matrix B in the OGY algorithm. In fact, since only deviations from the orbit are considered, this offset should be equal to zero in the ideal case where ¯x = x∗. Therefore C will be neglected. 3.3.2.2 Finding B The matrix B is found by investigating the influence of the parameter perturbation. First consider the delay coordinates case, so there are multiple matrices Bk with k=1, 2, . . . , r+1. Recall from section 3.2.3 that r is the smallest integer such that (n−1)τ 1) direction. The offset matrix C can also be calculated, and should be zero. This is not exactly true though: C1 = 10−3 0.7651 0.2302 C2,1 = 10−3 −0.1261 −0.0650 C2,2 = −0.0011 0.0007 The matrices B are only given for period 1, 2 and 4: B1 = −0.3563 0.0115 B2,1 = −0.2290 −0.0032 , B2,2 = −0.9970 0.0339 B4,1 = −0.4111 −0.0134 , B4,2 = −0.0487 0.0000 , B4,3 = −1.2531 0.0000 , B4,4 = −0.4807 0.0090 . To examine the accurateness of these values, look at the actual value of B1 at the estimated fixed point: x y = 0.6309 0.1891 ⇒ B1 = −x2 0 = −0.3981 0 This means that the error in B1 is more than 10%. For other points this error in B is approx. between 0% and 15%. 52 Appendix B Estimation results for Duffing In this appendix chapter some results are presented for the implementation of the OGY control algorithm to the Duffing oscillator, given by ¨x + 2ξ ˙x + 1 2 x = FΩ2 sin Ωt, in which F is chosen as the control parameter. When both position and velocity can be measured, there’s no need to use delay coordinates. The recurrence method and the adjustment of the fixed point estimation then finds a fixed point x ˙x = 0.5079 −0.3535 , with the corresponding matrix A and remaining small offset C: A = −3.8958 −6.7048 0.0161 −0.1131 C = 10−5 −0.0112 0.4123 . Using a perturbation δFmax = 0.05F a data series can be generated with which B can be found as B = −5.4938 −0.7330 . Delay coordinates are necessary when only position can be measured. For the delay coordinate z(ti) = [x(ti), x(ti − τ)], the recurrence method and the adjustment of the fixed point estimation are able to calculate two fixed points and a period 2 orbit: ¯x(ti) ¯x(ti − τ) 1,a = 0.5075 1.3053 ¯x(ti) ¯x(ti − τ) 1,b = −0.8167 −0.2473 , ¯x(ti) ¯x(ti − τ) 2 = −0.4287 −1.2510 −0.0648 −0.7362 . 53 APPENDIX B. ESTIMATION RESULTS FOR DUFFING The adjustment method also returns A and the offset C: A1,a = −5.1180 5.3419 −1.5385 1.4965 C1,a = 10−16 0.1525 −0.8388 A1,b = −5.5756 3.8982 −2.3079 1.5174 C1,b = 10−16 −0.1133 0.0991 A2,1 = 0.4824 −0.0233 −1.3269 0.5916 C2,1 = 10−16 0.3747 −0.5538 A2,2 = −15.4317 8.1570 −4.7384 2.4191 C2,2 = 10−15 0.9061 0.2762 . The perturbation matrices B1 (influence of δFi) and B2 (influence of δFi−1) for the fixed points were found using δFmax = 0.05F: B1 1,a = −4.8474 −1.0575 B1 1,b = 1.5454 1.4537 B2 1,a = 2.6853 0.7935 B2 1,b = 2.3862 0.9270 When the adjusted delay coordinate method of section 5.2.4 is used, the values of ¯z(ti) and A remain the same. In that case there’s only one B at each point, instead of B1 and B2. Using δFmax = 0.1F, B becomes: B1,a = −1.4256 −0.0539 B1,b = 6.2522 2.3932 B2,1 = −0.2289 0.2358 B2,2 = 13.3566 3.9703 54 Appendix C Matlab R code C.1 The Hénon map % Henon Parameters a = 1.4; b = 0.3; iter = 100000; % Creation of data points data = [0;0]; for i = 1:iter; data(1,i+1) = data(2,i)+1-a*data(1,i)^2; data(2,i+1) = b*data(1,i); end xrange = max(data(1,:))-min(data(1,:)); yrange = max(data(2,:))-min(data(2,:)); C.2 The Duffing oscillator The code for delay coordinate reconstruction of Duffing: % Duffing parameters ksi = 0.04; omega = 0.84; F = 0.188; % Defining delay period = 2*pi/omega; deel = 4; delay = periode/deel; % Generating data series begin = [0 0]; endtime = 200000; nop_end = ceil(endtime/period); endtime = nop_end*period; data = []; for i = 0:(nop_end-1); timedc = [i*period , (i+1)*period-delay , (i+1)*period]; [tdc,xdc] = ode45(@duffing,timedc,begin,options,ksi,omega,F); data = [data , [xdc(3,1) ; xdc(2,1)] ]; begin = xdc(end,:); end xrange = max(data(1,:))-min(data(1,:)); yrange = max(data(2,:))-min(data(2,:)); iter = length(data)-1; 55 APPENDIX C. MATLABR CODE This code uses the function duffing.m: function dx = duffing(t,x,ksi,omega,F); dx = zeros(2,1); dx(1) = x(2); dx(2) = F*omega^2*sin(omega*t) - 2*ksi*x(2) - 0.5*x(1)^3 + 0.5*x(1); C.3 Estimation tools The scripts in sections C.3.1, C.3.2 and C.3.3 were used for the Hénon map. Section C.3.4 shows the script for the adjustment of the estimations for fixed points and A and B for the Duffing oscillator, described in section 5.2.1. C.3.1 Estimating fixed points and orbits % Recurrence parameters ksi_grens = 0.002; maxrecur = 15; % Recurrence iterations veld = sparse(1,iter); for i = 1:(length(data)-1); for j = i+1 : length(data); ddata = data(:,i) - data(:,j); ddata = [ddata(1,:)/xrange ; ddata(2,:)/yrange]; ksi = norm(ddata,2); if ksi < ksi_grens; veld(1,i) = j-i; break; elseif j-i >= maxrecur ; break; else ; end end end clear i j ddata ksi; For every period m of interest, perform the following: periode = m; % Recurrent points for period m [i,j] = find(veld==periode); for n = 1:length(j); rec(1,n) = j(n); rec(2:3,n) = data(:,j(n)); end clear n; % Searching longest sequence len = 1; lengte = 0; for n = 1:length(rec)-1; if rec(1,n+1)-rec(1,n) == 1; len = len + 1; else if len > lengte; lengte = len; begin = n+1-lengte; eind = n; else ; end len = 1; end end if len > lengte; 56 APPENDIX C. MATLABR CODE lengte = len; begin = n+2-lengte; eind = n+1; else ; end clear len n; serie = rec(2:3,begin:eind); sd = ones(1,lengte); % Creating extra points if needed if lengte < periode; n = [rec(1,eind)+1 : rec(1,eind)+periode-lengte]; serie(:,lengte+1:periode) = data(:,n); sd(1,lengte+1:periode) = ones(1,periode-lengte); lengte = periode; eind = begin+periode-1; end clear n; % Gathering all points in each others vicinity for n = [1:begin-1 , eind+1:length(rec)]; for m = 1:lengte; dx = rec(2:3,n) - serie(:,m); dx = [dx(1,:)/xrange ; dx(2,:)/yrange]; if norm(dx,2) < ksi_grens; sd(1,m) = sd(1,m) + 1; serie(:,m,sd(1,m)) = rec(2:3,n); break else ; end end end clear n m dx; % Averaging all points perpunt = serie(:,1:periode,:); diepte = sd(1,1:periode); for n = 1:lengte-periode; ratio = ceil(n/periode)-1; oud = diepte(1,n-ratio*periode); diepte(1,n-ratio*periode) = oud + sd(1,n+periode); perpunt(:,n-ratio*periode,1+oud:diepte(1,n-ratio*periode)) = serie(:,n+periode,1:sd(1,n+periode)); end clear n sd serie ratio oud; for n = 1:periode; pm(:,n) = sum(perpunt(:,n,1:diepte(1,n)),3)/diepte(1,n); end clear n; Now pm contains all m points of the period m orbit. C.3.2 Estimating A The following function estimates A: function [A,C] = algorithm_a(data,pn,ksi_grens,grootte,fignr); periode = size(pn,2); dim = size(pn,1); % Looking for points to estimate with [orig,afb] = zoeka(data,pn,grootte,ksi_grens); % Calculate A and the small perturbation C for i = 1:periode; temp_afb = afb(:,:,i); while temp_afb(:,end) == [0;0]; temp_afb = temp_afb(:,1:(end-1)); 57 APPENDIX C. MATLABR CODE end temp_orig = orig(:,1:size(temp_afb,2),i); n = size(temp_orig,2); x = [ones(1,n) ; temp_orig]’; y = temp_afb’; c = x\y; A(:,:,i) = c(2:end,:)’; C(:,:,i) = c(1,:)’; end This function uses a function to find points close to the orbit: function [orig,afb] = zoeka(data,p,grootte,ksi_grens); xrange = max(data(1,:))-min(data(1,:)); yrange = max(data(2,:))-min(data(2,:)); % ’grootte’ should be as long as p if length(grootte) == 1; grootte = ones(1,size(p,2))*grootte; elseif length(grootte) == size(p,2); else error(’De vector grootte heeft niet dezelfde lengte als p’); end % Searching points within ’ksi_grens’ punt = [ p , p(:,1) ]; k = ones(size(p,2),1); for i = 1:(length(data)-1); for j = 1:size(punt,2)-1; ddata = data(:,i) - punt(:,j); ddata = [ddata(1,1)/xrange ; ddata(2,1)/yrange]; ksi1 = norm(ddata,2); clear ddata; if ksi1 < grootte(j)*ksi_grens; ddata = data(:,i+1) - punt(:,j+1); ddata = [ddata(1,1)/xrange ; ddata(2,1)/yrange]; ksi2 = norm(ddata,2); clear ddata; if ksi2 < grootte(j)*ksi_grens; orig(:,k(j),j) = data(:,i) - punt(:,j); afb(:,k(j),j) = data(:,i+1) - punt(:,j+1); k(j) = k(j)+1; break; else ; end else ; end end end C.3.3 Estimating B function B = algorithm_b(serie,pn,A,ksi_grens,grootte,dp_grens); periode = size(pn,2); % Looking for points close to the orbits [orig,afb] = zoekb(serie,pn,grootte,ksi_grens); % Estimating B for i = 1:periode; temp_afb = afb(:,:,i); while temp_afb(:,end) == [0;0]; temp_afb = temp_afb(:,1:(end-1)); end temp_orig = orig(:,1:size(temp_afb,2),i); n = size(temp_orig,2); x = temp_orig’; y = temp_afb’; 58 APPENDIX C. MATLABR CODE ball = temp_afb - A(:,:,i)*temp_orig; nul = zeros(1,n); bave = mean(ball,2); B(:,:,i) = bave/dp_grens; end The function uses a function to find relative points: function [orig,afb] = zoekb(serie,p,grootte,ksi_grens); xrange = max(max(serie(1,:,:)))-min(min(serie(1,:))); yrange = max(max(serie(2,:,:)))-min(min(serie(2,:))); punt = [ p , p(:,1) ]; k = ones(size(p,2),1); for i = 1:(length(serie)-1); for j = 1:size(punt,2)-1; dserie = serie(:,i,1) - punt(:,j); dserie = [dserie(1,1)/xrange ; dserie(2,1)/yrange]; ksi1 = norm(dserie,2); clear dserie; if ksi1 < grootte(j)*ksi_grens; dserie = serie(:,i,2) - punt(:,j+1); dserie = [dserie(1,1)/xrange ; dserie(2,1)/yrange]; ksi2 = norm(dserie,2); clear dserie; if ksi2 < grootte(j)*ksi_grens; orig(:,k(j),j) = serie(:,i,1) - punt(:,j); afb(:,k(j),j) = serie(:,i,2) - punt(:,j+1); k(j) = k(j)+1; break; else ; end else ; end end end C.3.4 Estimation adjustments tol = 1e-4; % Stopping criterium, absolute tolerance on dp dpn = [1 ; 1]; % Initial fixed point adjustment Cold = [1;1]; while max(abs(dpn)) > tol; % Estimation of A and C % The function zoeka was already used before [orig,afb] = zoeka(data,pn,2,ksi_grens); n = size(orig,2); x = [ones(1,n) ; orig]’; y = afb’; c = x\y; A = c(2:3,:)’ C = c(1,:)’ if C == Cold; disp(’No improvement possible’); break; end Cold = C; % New estimation fixed point y1 = (afb(1,:)-A(1,:)*orig)’; y2 = (afb(2,:)-A(2,:)*orig)’; yn = [y1;y2]; x1 = [ones(1,n)*(1-A(1,1)) ; -ones(1,n)*A(1,2)]’; x2 = [-ones(1,n)*A(2,1) ; ones(1,n)*(1-A(2,2))]’; xn = [x1;x2]; dpn = xn\yn if max(abs(dpn)) > tol; pn = pn+dpn; 59 APPENDIX C. MATLABR CODE else pn = pn; end end C.4 The OGY algorithm C.4.1 Fixed point Here the example of the Hénon map is used. % Parameters p = a; dp_grens = 0.05*a; fp = max(roots([a (1-b) -1])) % Theoretical fixed point % Linearize: A = [-2*a*fp , 1; b , 0]; B = [0 ; fp]; lam = eig(A); % Eigenvalues of A % Setting unstable eigenvalues to zero i = 1; while i <= length(lam); if abs(lam(i)) >= 1 k(i) = 0; i=i+1; else k(i) = lam(i); i=i+1; end end % Pole placement C = ctrb(A,B); if size(B,1) == rank(C) % Controllability demand K = acker(A,B,k); K = K’; else error(’Matrices A and B are not controllable!’) end % Application to 1000 iterations Xfp = [fp;b*fp] X = [0;0]; % Initial condition regelstap = [0]; a = p; for i = 1:1000; dp = -K’*(X(:,i)-Xfp); if abs(dp) <= dp_grens a = p + dp; regelstap = [regelstap , dp]; else dp = 0; a = p + dp; regelstap = [regelstap , dp]; end X(1,i+1) = X(2,i)+1-a*X(1,i)^2; X(2,i+1) = b*X(1,i); end tijd_X = 0:(length(X)-1); % Visualization figure(1) subplot(2,1,1) hold on, grid plot(tijd_X,X(1,:),’b.’,’MarkerSize’,5) title(’System response’,’FontSize’,18) ylabel(’Response x’,’FontSize’,15) subplot(2,1,2) 60 APPENDIX C. MATLABR CODE hold on, grid plot(tijd_X,regelstap,’r.’,’MarkerSize’,5) xlabel(’timestep’,’FontSize’,15),ylabel(’Control effort \deltab’,’FontSize’,15); C.4.2 Higher periodic orbits File to create the matrix Φi,j: function phi = makephi(A,u,i,j); periode = size(A,3); if j > u-1; phi = zeros(0,size(A,1)); else while i+j > periode; i = i-periode; end phi = A(:,:,i+j); while j < u-1; j = j+1; while i+j > periode; i = i-periode; end phi = A(:,:,i+j) * phi; end end File to create the matrix C: function [C,u] = makec(A,B); periode = size(A,3); % Calculation number of stable and unstable eigenvectors prod = A(:,:,periode); for i = 1:periode-1; prod = prod*A(:,:,periode-i); end clear i; d = eig(prod); s = 0; u = 0; for i = 1:length(d); if abs(d(i)) < 1; s = s+1; elseif abs(d(i)) > 1; u = u+1; else ; end end clear i prod d; % Calculation stable eigenvectors for every point for i = 1:periode; stab = A(:,:,i); j = i-1; for n = 1:periode-1; if j == 0; j = periode; else; end stab = stab*A(:,:,j); j = j-1; end [v,d] = eig(stab); m=1; 61 APPENDIX C. MATLABR CODE for n=1:length(d); if abs(d(n,n)) < 1; vs(:,m,i) = v(:,n); m=m+1; else; end end end clear i j n m v d stab; % Creation of C (by using makephi) for i = 1:periode; iu = i+u; iumin = i+u-1; while iu > periode; iu = iu-periode; end while iumin > periode; iumin = iumin-periode; end temp = [ B(:,:,iumin) , vs(:,:,iu) ]; if u-1 < 1; ; else for j = 1:u-1; temp = [chaos09phi(A,u,i,u-j) , temp]; end end C(:,:,i) = temp; end clear i j temp; File to create control matrix K: function K = makek(A,C,u); periode = size(C,3); kappa = zeros(1,size(C,1)); kappa(1,1) = 1; for i = 1:periode; temp = kappa*inv(C(:,:,i))*chaos09phi(A,u,i,0); K(:,:,i) = temp’; end clear temp i; OGY control of a period m orbit then becomes as simple as: % Calculation of K [Cm,um] = makec(Am,Bm); Km = makek(Am,Cm,um); % Application of OGY regel = m; for i = 1:1000; for j = 1:regel; dp(j,1) = -Km(:,:,j)’*(X(:,i)-pm(:,j)); if abs(dp(j,1)) > dp_grens; dp(j,1) = 0; else ; end end test = find(dp); [e,f]=min(abs(dp(test))); dp=dp(test(f)); if dp == []; dp = 0; else ; end a = p + dp; regelstap = [regelstap , dp]; 62 APPENDIX C. MATLABR CODE X(1,i+1) = X(2,i)+1-a*X(1,i)^2; X(2,i+1) = b*X(1,i); clear test e f; end C.4.3 Delay coordinates When OGY is implemented using delay coordinates as in section 5.2.3, K has to be recalculated. Using the same A and new defined matrices B1 and B2, the code becomes: % Defining new A and B An = [A , B_2; zeros(1,size(A,2)) , 0]; Bn = [B_1 ; 1]; % Calculation of K ev = findev(An); i = 1; while i <= length(ev); if abs(ev(i)) >= 1 k(i) = 0; i=i+1; else k(i) = ev(i); i=i+1; end end C = ctrb(An,Bn); if size(Bn,1) == rank(C); K = acker(An,Bn,k); K = K’; end The application of OGY is then calculated with the following code: % Using fp = fixed point, and K = control matrix p = F; regelstap = [0]; period = 2*pi/omega; eind = 10000; nop_end = ceil(eind/period); for i = 1:nop_end; tijd = [(i-1)*period , i*period-delay , i*period]; dp = -K’*(rdata(:,end) - fp); if abs(dp) > dp_grens dp = 0; F = p + dp; else F = p + dp; end [t,x] = ode45(@duffing,tijd,begin,options,ksi,omega,F); regelstap = [regelstap , dp]; rdata(:,i+1) = [ x(3,1) ; x(2,1) ; F]; rtijd(1,i+1) = t(end); begin = x(end,:); end 63 Appendix D Simulink R models UU(R,C) p F control parameter data05.mat To File Switch State Sine Wave Product point A point B Point selection x state Making of the delay variable UU(R,C) K continu05.mat For Reconstruction input F_in dx x Duffing K Error dF Control law Control Pulses Applied control x F_nieuw A B (a) Complete SimulinkR model 1 dF Switch 0 Nul −1 Gain Dot Product |u| Abs 2 Error 1 K dp dp (b) Submodel: OGY control algorithm Figure D.1: Specific SimulinkR models for period 1 orbits 65 APPENDIX D. SIMULINKR MODELS F control parameter data06.mat To File State Sine Wave Product p2_2 Point2 p2_1 Point1 x state Making of the delay variable K2_2 K2K2_1 K1 continu06.mat For Reconstruction input F_in dx x Duffing K2_1 K2_2 Error_1 Error_2 dF Control law Control Pulses Applied control x F_nieuw (a) Complete SimulinkR model 1 dF control switch Switch1Switch 0 Nul −1 Gain1 −1 Gain Dot Product1 Dot Product |u| Abs2 |u| Abs1 |u| Abs 00 4 Error_2 3 Error_1 2 K2_2 1 K2_1 dp dp dp (b) Submodel: OGY control algorithm Figure D.2: Specific SimulinkR models for period 2 orbit 66 APPENDIX D. SIMULINKR MODELS 2 x 1 dx Product 1 s Integrator1 1 s Integrator −K− Gain4 0.5 Gain3 0.5 Gain1 −K− Gain u^3 Fcn 2 F_in 1 input dx ddx x (a) Duffing oscillator 1 state Zero−Order Hold1 Zero−Order Hold z 1 Unit Delay 1 x [x(t) ; x(t−delay)] (b) Construction of delay coordinate vector Figure D.3: Other SimulinkR submodels 67