Cinvestav, Instituto Politécnico Nacional Mexico City, Mexico ENSIM, Mechanical Engineering School University of Maine Le Mans, France DELAET Thomas ENSIM Student 3rd Year Stability plots of Mathieu’s Equation two dimensions.The red regions correspond to stable response. Report submitted in partial fulfillment of the requirement to obtain: Mechanical Engineering degree specialized in Vibration and Acoustics Stability limits determination for linear parametrically excited systems Elaborated at: CINVESTAV, Centro de Investigación y de Estudios Avanzados del Instituto Politécnico Nacional, Research and Advanced studies of National Polytechnic Institute Supervised by: Joaquín Collado Summary: The purpose of this report is to explain what I learned during my internship period with the research lab at Cinvestav, Mexico D.F. in the department of Automatic Control. The subject treats of parametric resonance, which actually a hot topic in science, with its ability to modify vibration behavior. Most of case, the parametric resonance is treated as a danger for system due to the lack of knowledge and control. But using correctly these phenomenons can lead to complete new technologies of vibration amplitude control. This report focus on how to obtain the Arnold’s tongues, the stability diagrams, of equations with varying parameters. Keywords: Control, Vibration, Mathematics Résumé: Le but de ce rapport est d’exposer ce que j’ai pu apprendre lors de ce six derniers mois de stage au laboratoire de recherche de CINVESTAV, à Mexico City au département de control automatique. Le sujet traite de la résonance paramétrique, qui en effet actuellement un sujet très prisé par les centres de recherche, grâce à son influence sur le comportement vibratoire des systèmes. Dans la plupart des cas, les résonances paramétriques sont considérées comme un danger pour les différents systèmes. Cependant en utilisant correctement ces phénomènes, ceci peut aboutir à de nouvelles technologies de contrôle vibratoire. Ce rapport cible principalement sur l’obtention des Arnold’s tongues, qui correspond au diagramme de stabilité des systèmes soumis à des résonances paramétriques. Mots Clés: Contrôle, Vibration, Mathématiques Contents Acknowledgements .............................................................................................................3 1. Introduction .................................................................................................................1 2. Definition and Stability limits for Hill and Mathieu’s equation .......................................3 3. 2.1. Floquet Theorem ........................................................................................................... 3 2.2. Stability for Hill’s equation ............................................................................................ 5 2.3. Applications of Mathieu’s Equation .............................................................................. 6 Solving Meissner and Mathieu’s equations: ..................................................................7 3.1. 4. Solving Mathieu equation one dimensional ............................................................... 10 3.1.a. Finding Analytic solutions for Mathieu’s equation ............................................. 10 3.1.b. Finding Numerical solution for Ordinary Differential equation .......................... 10 3.2. Solving Mathieu equation multidimensional with/without combination: ................. 12 3.3. Angular frequency variation and Beta variation ......................................................... 14 Improving Matlab code .............................................................................................. 16 4.1. Optimizing Matlab code .............................................................................................. 18 4.1.a. First acceleration: Array Pre-allocation ............................................................... 20 4.1.b. Second acceleration: Local parallel computing ................................................... 20 4.1.c. Third acceleration: Computing on Graphic cards using GPU .............................. 22 5. Using Matlab to simulate a system 2 masses and 3 springs .......................................... 24 6. Conclusion on parametric resonance .......................................................................... 27 6.1. Appendix 1 : Matlab: Meissner's equation ................................................................. 29 6.2. Appendix2: Matlab: Mathieu's Equation x''+(alpha+beta*cos(t))x = 0 ....................... 30 6.3. Appendix 3: Finding Numerical solution for Ordinary Differential equation ............. 31 6.4. Appendix 4 : Matlab: Mathieu's Equation 2 Dimensions .......................................... 33 6.5. Appendix 5: Matlab Mathieu’s equation with Angular frequency variation .............. 34 6.6. Appendix 6: Matlab Solving and plotting negative parameters.................................. 35 6.7. Appendix 7: Simulink diagram to obtain mass displacements.................................... 36 6.8. Appendix 8: Simulation User guide: ............................................................................ 37 6.9. Appendix 9: Reprogramming ODE45 function for GPU .............................................. 37 6.10. Appendix 10 Reprogramming Eig.m ........................................................................ 39 References: ....................................................................................................................... 40 Acknowledgements Finally the time for a personal and a last word, hopefully as a Mechanical Engineering student, has come. While I was studying at ENSIM, I often wished of this moment when the final manuscript would be written symbol of the final step reached to obtain the degree “Engineer”. I would look back at this period of my life with pleasure, nostalgia and gratitude. This moment has come and I can see many wonderful people, from inside and outside the work-sphere I met during all these years, at ENSIM, at South Dakota State University, at Loughborough University and especially nowadays at Cinvestav, all contributing to my present knowledge and experience in assorted ways. In retrospect, this adventure has only been possible and even enjoyable thanks to my friendly fellows. It is indeed a pleasure to convey my gratitude to them all in my humble acknowledgement. For this last internship, in Mexico, I would specially like to thank Dr Joaquín Collado, for giving me the opportunity to complete my degree at his department. He has always been there to provide me unflinching information, support and guidance in different ways. I am impressed by his understanding in mathematics. I also have to mention all PhD students and Master students, whom heartily welcome and guide me in this new country. Thanks to them, I had the will to learn Spanish, to discover and know the Mexican cultures, beyond the traditional ideas. Thomas DELAET 2012 1. Introduction The purpose of this report is to explain what I learned during my internship period with the research lab at Cinvestav, Mexico D.F. in the department of Automatic Control. This report is also a requirement for the partial fulfillment of ENSIM, Le Mans internship program. The primary objective is focused on the theoretical analysis dealing with parametric resonances and Mathieu’s equation, followed by programming the “Arnold’s tongues” plot and an animation of a mechanical system (2 masses and 3 strings) on Matlab software. The third part is dedicated to optimize the computing time of these programs. To conclude, the final chapter deals with the following objectives in this material and in Cinvestav, the current and future interests in industry. My personal goal in this internship was to understand the parametric resonance behavior, stability/instability response depending on the theoretical parameters of the system. Then, as a final aim to use this knowledge in parametric oscillations to implement or integrate this technology in a concrete situation like a new vibration absorbing technology, or to control or limit the parametric oscillation in planes or boats. To introduce parametric resonance, the question is to know why this material nowadays is studied: In 1998, there was an incident with a post-Panamax C11 class container ship, which was caught by a violent storm and experienced parametric roll with roll angles close to 40◦. As a consequence, one third of the on-deck containers were lost overboard and a similar amount was severely damaged. The indirect causes of this event are due to the lack of knowledge on parametric roll and overall on parametric resonance, in which the suspension point is periodically oscillating, turned it into a hot topic for research. As an example of parametric resonance is the child swing. Typically, friction is the major dissipative force causing the gradual decay of the motion. So, a child has to find, to learn some pumping mechanisms in order to keep the swing running. Not only he can keep the swing running but he can increase the oscillations, transferring the system from stability to instability. Some pumping schemes can even start a swing from the rest positions. Pumping means that the child transfers energy into the swing by performing some movements at certain positions. A child can pump from a standing position by periodically standing and squatting on the swing which results in periodic displacement of the center of mass up and down, modeled by changing the length of the rod of the swing with time. Another similar approach for parametric resonance is to study the effects of vibrating support on the swing, symbolized in Physics, as showed below: . 1 Figure 1: Pendulum with vibrating base, an example of Mathieu's equation application In many engineering, physics, electrical and biological problems, oscillatory behavior of the dynamic system with periodic excitation is of great interest. The most wellknown phenomenon is the forced oscillations, which appear when the dynamical system is excited by a periodic input. If the frequency of this external excitation is close to the natural frequency of the system, then the system will experience resonance (oscillations with large amplitude). On the other hand, the similar but less known phenomenon is parametric oscillation, instability phenomenon, the result of time-varying (harmonic for Mathieu’s equation) parameters in the system. In this case, the system could experience parametric resonance, and again the amplitude of the oscillations in the output of the system will be large. When studying parametric resonance in a dynamical system, quickly a familiar equation will appear a special case of second order differential equation with a periodic coefficient, called Mathieu’s equation. Although Mathieu functions have plenty of applications, they are not commonly used and many books on “special functions” do not report them at all. This is likely due to the complexity of the solutions of the Mathieu’s equation. This is why, more than 100 years after its definition, still many papers are written on specific technical aspects of Mathieu’s Functions and their computational problems. The first chapter is devoted to present this equation, its solutions, the stability and some mechanical applications. 2 2. Definition and Stability limits for Hill and Mathieu’s equation [1] [7] [2] In Mathematics, the parametric oscillations are usually associated with the Mathieu’s equation, published since 1886. It was introduced by Mathieu when analyzing the movement of membranes of elliptical shape. Since then, many physical and astronomical problems have been reported as requiring these functions in their analysis. The simplified form, second order ordinary differential equations of this equation is: ẍ + (α + β cos(t))x = 0 (1) Where (α,β) are parameters, t is time variation, x variable and 𝑥̈ is its second derivative with respect to time. In physical problems studied by Mathieu and any other practical problems, both parameters are real. This equation presents properties listed below: 2.1. Mathieu’s equation always has one odd and one even solution. (Using Floquet’s theorem -explained below-) Mathieu’s equation (1) always has at least one solution x(t) such that x(t+T)= σ x(t), where the constant σ , called the periodicity factor, depends on the parameters α and β and may be real or complex. Mathieu’s equation always has at least one solution of the form exp(μt) φ (t), where the constant μ is called the Floquet’s exponent and φ (t) has period π . Floquet Theorem [5] [3] Floquet’s theory is a branch of the theory of ordinary differential equations, relating to the class of solutions, of the form: 𝑥̇ (𝑡) = 𝐴(𝑡)𝑥(𝑡) 𝐴(𝑡 + 𝑇) = 𝐴(𝑡) (2) This equation is a first order differential equation, where A(t) a continuous T-periodic n-by-n matrix function of time. The first reaction, compared to the Mathieu’s equation is to notice the different order of differentiation. However, in the section “Solving Meissner equation”, a solution will be quickly exposed to obtain Mathieu’s equation in a form of a first order differential equation. The main idea of Floquet’s theory is to transform periodic systems into a traditional linear system with constants, real coefficients. The solution of the equation (2) is of the form: 𝑥(𝑡) = ∅(𝑡, 𝑡0 )𝑥(𝑡0 ) Where ∅(𝑡, 𝑡0 ) is called the “state transition matrix”, and has the following properties [1]: ∅(𝑡, 𝑡0 ) is invertible, for all t, 𝑡0 ∈ 𝑅 ∅(𝑡, 𝑡) = 𝐼 3 𝜕∅(𝑡,𝑡0 ) 𝜕𝑡 ∅−1 (𝑡, 𝑡0 ) = ∅(𝑡0 , 𝑡) For all 𝑡1 , 𝑡2 , 𝑡3 ∈ 𝑅; ∅(𝑡, 𝑡3 ) = ∅(𝑡1 , 𝑡2 )∅(𝑡2 , 𝑡3 ) = 𝐴(𝑡)∅(𝑡, 𝑡0 ) Define new coordinates Z(t) as: 𝑍(𝑡) = 𝑃(𝑡)𝑋(𝑡) with 𝑃(𝑡) = 𝑒 𝑅𝑡 ∅(0, 𝑡): 𝑍̇(𝑡) = 𝑃̇ (𝑡)𝑃−1 (𝑡)𝑍(𝑡) + 𝑃(𝑡)𝐴(𝑡)𝑃−1 (𝑡)𝑍(𝑡) 𝑍̇(𝑡) = [𝑅𝑒 𝑅𝑡 ∅(0, 𝑡) − 𝑒 𝑅𝑡 ∅(0, 𝑡)𝐴(𝑡)]∅(𝑡, 0)𝑒 −𝑅𝑡 𝑍(𝑡) + 𝑒 𝑅𝑡 ∅(0, 𝑡)𝐴(𝑡)∅(𝑡, 0)𝑒 −𝑅𝑡 𝑍(𝑡) 𝑍̇(𝑡) = 𝑅𝑍 This final equation means that the periodic coordinate change 𝑍(𝑡) = 𝑃(𝑡)𝑋(𝑡), produces a linear time-invariant system. The above properties are valid for any time-varying A(t). At this moment, a new matrix from the state transition matrix can be defined as the “monodromy matrix”, M: 𝑀 = ∅(𝑡0 + 𝑇, 𝑡0 ) = 𝑒 𝑅𝑇 With B a matrix possibly complex. This monodromy matrix has the following property: 𝜎(𝑀) = 𝜎(𝑀1 ) where 𝑀1 = ∅(𝑡1 + 𝑇, 𝑡1 ) because M and M1 are similar, which means all eigenvalues are identical as long as t2=t1+T, finally: 𝜎(𝑀) = {𝑒 𝜌1 𝑇 , 𝑒 𝜌2 𝑇 , … , 𝑒 𝜌𝑛 𝑇 } ∅(𝑡, 0) = 𝑃−1 (𝑡)𝑒 𝑅𝑡 𝑥(𝑡) = 𝑃−1 (𝑡)𝑒 𝑅𝑡 𝑥(𝑡0 ) There is a T-periodic matrix P(t) as: 𝑃(0) = 𝐼 and 𝑃(𝑡 + 𝑇) = 𝑃(𝑡), is a nxn periodic matrix and R Є ℝ𝑛𝑥𝑛 is a constant matrix. Since P(t) is continuous and periodic matrix, it must be bounded. 𝑥(𝑡0 ), initial and finite value for t=0. Thus the stability is depending on the monodromy matrix (𝑒 𝑅𝑡 ), and more precisely on the eigenvalues of the matrix R. The eigenvalues of this matrix are defined as the Floquet’s multipliers. The key to study the stability is to apply this following theorem using these multipliers: If at least one of all multipliers has a modulus greater than one, then the system is said “unstable”. Otherwise, if all multipliers have modulus less than one, the system is “exponentially stable”. Another way to find out the stability is to use the Floquet’s exponents (𝜇), related to the multipliers. As a consequence of Floquet’s theory (5), the general solution of the Mathieu has this form, where A and B are constants of integration, 𝜇 and φ (t) as described previously. 𝑢(𝑡) = 𝐴𝑒 𝜇𝑡 𝜑 (𝑡) + 𝐵𝑒 −𝜇𝑡 𝜑 (−𝑡) 4 In the case Re(𝜇) = 0 and Im(𝜇) is irrational, then the general solution is aperiodic and stable (Stable solution) In the same way, if Re(𝜇) ≠ 0 and Im(𝜇) is an integer, the general solution is said unstable. Since the value of 𝜇 depends on Mathieu’s parameters, it follows that the solution of Mathieu’s equation is stable for certain values and therefore not stable for other parameters. A common use to represent these stability/instability regions is to draw plot 2D graphical with parameters as axis, the results are either scatter plot methods or boundary tracing methods, which each presents advantages and disadvantages. In this report, only the scatter plot method will be used having the advantage to be easier to program and to have less limits for usage. Nevertheless, all results from both methods have been compared and successfully declared as equal. 2.2. Stability for Hill’s equation In literature, the Mathieu’s equation can be presented on different forms and sometimes named Hill’s equation, which is a more general form of an ordinary second differential equation with varying parameters (not necessary periodic): ẍ + (α + β p(t))x = 0 (3) Mathieu’s equation is a particular case of this Hill’s equation (3) where p(t)=cos(t). The solution of this equation (3) has similar properties as Mathieu’s equation. By using Floquet’s theory, it follows that x(t) is an arbitrary solution of (3) x(t + 2π) = σ x(t) The absolute value of the periodicity factor σ gives us information on the stability of the system: |σ| > 1 , x(t) is unstable |σ| < 1 , x(t) is stable |σ| = 1 , x(t) is unstable but stable if σ is one dimension 5 2.3. Applications of Mathieu’s Equation The Mathieu equation appears in wide spectrum of application in physics: Elastic wave equations with elliptical boundary conditions, motions of particles, inverted pendulum, parametric oscillators, the motion of a quantum particle in a periodic potential, are just few examples. We can also cite the stability of structural elements such as plates and shells, which are used in aerospace and mechanical applications, the analysis of the dynamical behavior of micro-electromechanical systems used in sensors and in data communication applications, the study of parametric resonance in civil structures like bridges. With my vibration specialization, a clever choice is a link–mass–spring mechanism, a dynamical system covered by Mathieu’s equation. The block of mass m can move in the vertical direction, all other equipment (spring, link) is assumed to be massless. The spring is unforced when the mass m is at point D. The driving force for the mass in the vertical direction is 𝐹1 = 𝑦 𝑓0 𝑐𝑜𝑠(2𝜔𝑡) . Using Newton’s second law, it follows that the equation of motion of the system in the vertical direction is 𝑑𝑦 𝑚 2 + 𝑘𝑦 = 𝐹1 𝑑𝑡 𝑑𝑦 𝑚 𝑑𝑡 2 + (𝑘 − 𝑓0 cos(2𝜔𝑡))𝑦 = 0 (4) Introducing a new time variable τ=2ωt, the equation (4) turns out as a Mathieu’s equation form: 𝑑𝑦 𝑘 𝑓0 + ( − cos(𝜏))𝑦 = 0 2 𝑑𝑡 𝑚 𝑚 Figure 2: Mechanical system leading to Mathieu's equation 6 3. Solving Meissner and Mathieu’s equations: When the sinusoidal parametric modulation is replaced by a square-wave function, the new equation obtained is called Meissner’s equation, one of its form is: 𝑥̈ + (𝛼 + 𝛽𝑠𝑔𝑛(cos(𝑡)))𝑥 = 0, 𝑥 ∈ 𝑅 (5) Where (𝛼, 𝛽) are non-negative parameters and 𝑠𝑔𝑛(cos(𝑡)) is a 2π-periodic piecewiseconstant function. Unlike the Mathieu’s equation, it is possible in this case to obtain simple analytical solutions. First, the equation (5) can be divided in two different forms: For 0 < 𝑡 < 𝜋, For 𝜋 < 𝑡 < 2𝜋, 𝑥̈ + (𝛼 + 𝛽)𝑥 = 0 (6) 𝑥̈ + (𝛼 − 𝛽)𝑥 = 0 (7) To solve these equations (6-7), the system should be transformed to the first order differential equation, in order to apply Floquet’s Theory, as follows: 𝑑 𝑥 [ ] 𝑑𝑡 𝑥̇ 𝐴(𝑡) = [ 𝑥 = 𝐴(𝑡) [ ] 𝑥̇ (8) 0 1 ] −𝛼 − 𝛽𝑠𝑔𝑛(cos(𝑡)) 0 This system is autonomous in the intervals 0 < 𝑡 ≤ 𝜋, and 𝜋 < 𝑡 ≤ 2𝜋 and admits constant coefficients over these two intervals. Finding solutions using Laplace transforms, gives us a result for the Floquet Matrix 𝐹 = ∅(2𝜋, 0) = ∅(2𝜋, 𝜋)∅(𝜋, 0) Laplace transform of equation (8): [𝑠𝐼 − 𝐴]𝑥(𝑝) = 𝑥0 𝑥(𝑝) = [ 𝑠 −𝑤 2 1 −1 ] 𝑥0 𝑠 With 𝑤1 2 = 𝛼 + 𝛽 for 𝑡 ∈ [0, 𝜋], and afterwards 𝑤2 2 = 𝛼 − 𝛽 for 𝑡 ∈ [𝜋, 2𝜋]. 𝑥(𝑝) = 𝑠2 1 𝑠 [ + 𝑤2 𝑤2 −1 ]𝑥 𝑠 0 In the 2D plan (𝛼; 𝛽) we can differentiate 3 different cases: For 𝛼 > 𝛽 , we obtain 𝑥(𝑡) = [ 𝑐𝑜𝑠(𝑤𝑡) 𝑤𝑠𝑖𝑛(𝑤𝑡) F = [ 𝑐𝑜𝑠(𝜋𝑤2 ) 𝑤2 𝑠𝑖𝑛(𝜋𝑤2 ) −sin(𝑤𝑡)⁄ 𝑤 ] 𝑥0 cos(𝑤𝑡) −sin(𝜋𝑤2 )⁄ −sin(𝜋𝑤1 )⁄ 𝑤2 ] [ 𝑐𝑜𝑠(𝜋𝑤1 ) 𝑤1 ] cos(𝜋𝑤2 ) 𝑤1 𝑠𝑖𝑛(𝜋𝑤1 ) cos(𝜋𝑤1 ) 7 For 𝛼 < 𝛽 and 𝑡 ∈ [𝜋, 2𝜋], we obtain 𝑥(𝑡) = [ 𝑐𝑜𝑠ℎ(𝑤𝑡) 𝑤𝑠𝑖𝑛ℎ(𝑤𝑡) 2 𝑤 <0 F = [ 𝑐𝑜𝑠ℎ(𝜋𝑤2 ) 𝑤2 𝑠𝑖𝑛ℎ(𝜋𝑤2 ) sinh(𝜋𝑤2 )⁄ −sin(𝜋𝑤1 )⁄ 𝑤2 ] [ 𝑐𝑜𝑠(𝜋𝑤1 ) 𝑤1 ] ; cosh(𝜋𝑤2 ) 𝑤1 𝑠𝑖𝑛(𝜋𝑤1 ) cos(𝜋𝑤1 ) 1 For 𝛼 = 𝛽 & 𝑡 ∈ [𝜋, 2𝜋], 𝑤 2 = 0 we obtain 𝑥(𝑡) = [ 0 1 F=[ 0 sinh(𝑤𝑡)⁄ 𝑤 ] 𝑥0 due to cosh(𝑤𝑡) 𝜋 ]𝑥 1 0 𝜋 𝑐𝑜𝑠(𝜋𝑤1 ) −sin(𝜋𝑤1 )⁄𝑤1 ]; ][ 1 𝑤 𝑠𝑖𝑛(𝜋𝑤 ) cos(𝜋𝑤1 ) 1 1 Computing all matrices’ determinants, using this formula det(AB) = det(A) × det(B), we find det(𝐹) = 1 According to Floquet’s theory, ρ1 ρ2 = 1 , where ρ1 and ρ2 are the multipliers and stability parameters of the system, For a stable solution, both multipliers require to be complex conjugate and lie on the unit circle |ρ1 | = |ρ2 | = 1. If the multipliers are real and different, then at least one lies outside of the unit circle (instability). Stability is possible only if the multipliers merge to 1 or -1 and become double. Therefore, the boundary between the stability and instability domains in the parameter space (𝛼, 𝛽) is given by this condition: |ρ1 + ρ2 | = |trace(F)| = 2 This condition takes the form: 𝑤 𝑤 For 𝛼 > 𝛽: |2𝑐𝑜𝑠𝜋𝑤1 𝑐𝑜𝑠𝜋𝑤2 − (𝑤1 + 𝑤2 ) 𝑠𝑖𝑛𝜋𝑤1 𝑠𝑖𝑛𝜋𝑤2 | = 2 2 1 𝑤 𝑤 For 𝛼 < 𝛽: |2𝑐𝑜𝑠𝜋𝑤1 𝑐𝑜𝑠ℎ𝜋𝑤2 − (𝑤1 + 𝑤2 ) 𝑠𝑖𝑛𝜋𝑤1 𝑠𝑖𝑛ℎ𝜋𝑤2 | = 2 2 1 For 𝛼 = 𝛽: |2𝑐𝑜𝑠𝜋𝑤1 − 𝜋𝑤1 𝑠𝑖𝑛𝜋𝑤1 | = 2 The Matlab code associated is available in Appendix 1 8 Results: Coexistence point Figure 3: Stability plot of Meissner’s equation 1 dimension. The red regions corresponding to parameter values for stable quasi-periodic oscillations, the blue regions are the unstable regions. Comment on this first result: On this first resulting figure (3), when can figure out the stability of the solution of the system depending to the parameters. In this example the parameters are from 0 to 5 with a resolution of 0.015. Successfully, we obtain the special form of stable regions, called “the Arnold’s tongues” which are visible in graphical. With this chart, the user can decide which parameters of the system will lead to unstable oscillations and which parameters will lead to stability and therefore adjust his practical experience from an unstable system to a stable system. To notice the special point called coexistence point on the chart, where the two unstable regions cross each other, at this point, all solutions of the ODE are periodic regardless the initial conditions. 9 3.1. Solving Mathieu equation one dimension ([17] [16] [9] [8]) 𝑥̈ (𝑡) + (𝛼 + 𝛽 cos 𝑡)𝑥(𝑡) = 0 3.1.a. (1) Finding Analytic solutions for Mathieu’s equation Unlike the Meissner’s equation (7), it is not possible in this case to obtain simple analytical solutions of this equation. The solutions must be found numerically, in this paper, using Matlab programs. However, before presenting the results and the program, the idea of this numeric method on its origin must be explained: First, to apply the Floquet’s theory, the equation must be simplified into a first degree 𝑥 equation. Readily done by replacing the variables by: 𝑦 = [ ] , thus we obtain ordinary 𝑥̇ differential equations first order of this form: ẏ (t) = [ 0 −(α + β cos t) 1 ] y(t) 0 With & 𝛽 , the scalar parameters. The Floquet’s theory states that a fundamental matrix of this system may be expressed as 𝑦(𝑡) = 𝑃(𝑡)𝑒 𝑅𝑡 𝑦0 (11) with P(t) periodic matrix, R is a constant matrix related to the monodromy matrix . To satisfy this equation (11) at initial time, the matrix P(t=0) is necessary equal to identity matrix. Therefore, the solution of this system at the first period (t=T) obtained is: 𝑦(𝑇) = 𝑒 𝑅𝑇 𝑦0 . If we choose initial condition equal also to unity, then the eigenvalues of the matrix solution (equal to eRt ) at t=T are the Floquet’s exponents, related to the Floquet’s multipliers. These two sets of generally complex characteristic numbers are interrelated. Nevertheless, either of them governs the stability of the system (Floquet’s theory). The stability test use will be on the Floquet’s exponents, system stable if and only if all modulus are lower or equal to 1. To obtain the whole resulting graphical this equation is solve point-by-point for all combinations of parameters. So this routine is repeated for all values of each parameter. The results of stability investigations are generally and preferably presented in the form of stability charts 2 dimensions reflecting stability dependence on the two system parameters. 3.1.b. Finding Numerical solution for Ordinary Differential equation The sensitive part of this code is to find the solution of this differential equation to obtain correct eigenvalues. Matlab proposes various tools for numerically solving. After investigating on the different solutions, the solver chosen is ode45() with the options (AbsTol and RelTol) fixed to 1e-5. A explanation and quick presentation of these solver is available in Appendix 3 10 Results: Figure 4 Stability plot of Mathieu’s Equation 1 Dimension. The red regions corresponding to parameter values where there are stable periodic oscillations. The blue regions are the unstable regions. Comments on these two first figures: The resulting figure for Mathieu’s equation one dimension is similar but not equivalent with the Meissner‘s equation. Thanks to this program, users can figure out the stability of the solution of the system depending to the parameters. In this example the parameters are from 0 to 3.5 with a sharp resolution of 0.005. The points at which the “Arnold’s tongues” intersect the axis β=0 are called “critical frequencies” and are given at 𝑘2 4 𝑘 ∈ ℕ+ for 2π-periodic Hill equations. The M-file associated to this section is available in Appendix 2. Example Application: Figure 5 System 1 DOF with varying stiffness 𝑥̈ + 𝑘 𝑐𝑜𝑠(𝑡) 𝑥=0 𝑚 By analogy, A=0 and B= K/M 11 3.2. Solving Mathieu equation multidimensional with/without combination: 𝐴 𝐶1 𝐵 𝐶3 𝑥̈ (𝑡) + (𝛼 [ 1 ]+𝛽[ 1 ] cos(𝑡)) 𝑥(𝑡) = 0 𝐶2 𝐴2 𝐶4 𝐵2 In many practical cases, the Mathieu’s equation is emerging on a multidimensional case, like the example and the animation presented further of a system 2 mass and 3 springs. For this new equation, the idea is identical as illustrated before but the program is more complex using matrices. The main difference is with the appearance of 2 new matrices in the function (A,B) which are 2-by-2 matrices (for 2 dimensional case) and can incorporate coupling values (C variables) or not. The initial condition matrice turned into a 4-by-4 matrice identity. For each couple parameters, the system must be solved four times instead of two, yields to the calculus of eigenvalues of matrices 4-by-4 which considerably increase the computing time. The Matlab program “Solving Mathieu’s equation 2 degree of freedom case is available in Appendix 4. Results: Figure 6 Stability diagram of Mathieu’s Equation 2 Dimensions with coupling. The red regions correspond to parameter values where there are stable periodic oscillations. The blue regions are the unstable regions. Comments on this section: The first reaction is to figure out that the solutions are more complex than the two previous cases of dimension one, presenting more Arnold’s tongues. The explanation of the shape shows the presence of mixing regions. This system presents larger instability regions than the previous cases. The explication can be that as soon as one dimension is stated unstable, the complete system will be stated unstable, which is not the case if one dimension turns from unstable to stable whereas the other dimension is still on unstable. 12 Actually, all unstable regions for the one dimension of the previous figure are still unstable in this diagram. This figure (5) has been obtained using parameters A=[1 0; 0 2] and B=[1.4 -1;-1 2]. Example of application: Figure 7 : System MDOF 2 Masses 3 springs [ M1 0 K cos(t) + K 2 0 ] {ẍ } + [ 1 M2 −K 2 (K1 cos(t) + K 2 ) ⁄M 1 {ẍ } + [ −K 2 ⁄M 1 −K 2 ] {x} = 0 K 2 + K 3 cos(t) −K 2 ⁄M 2 ] {x} = 0 K 2 + K 3 cos(t) ⁄M 2 by analogy with Mathieu’s equation: 𝐾2 𝑀2 ⁄𝑀 𝑀 1 2 𝐴=[ −𝐾2 𝑀2 ⁄𝑀 𝑀 1 2 𝐾1 𝑀2 ⁄𝑀 𝑀 1 2 𝐵=[ 0 𝐾2 𝑀1 ⁄𝑀 𝑀 1 2 ] 𝐾2 𝑀1 ⁄𝑀 𝑀 1 2 − 0 𝐾3 𝑀1 ⁄𝑀 𝑀 1 2 ] 13 3.3. Angular frequency variation and Beta variation In this third part, the focus is different case for Mathieu’s equation with time depend frequency. A new variable, angular frequency, is added to the equation. In order to keep two variables, we now assume that the variable Alpha is fixed in time, as follows: Ẍ + (α + βcos(ωt))X = 0 Let’s define a new variable τ, 𝜏 = 𝜔𝑡 𝑋̈ + (𝛼 + 𝛽𝑐𝑜𝑠(𝜏))𝑋 = 0 Derivating twice X lead us to : dX dX dτ dX = =ω dt dτ dt dt d2 X d2 X 2 = ω dt 2 dt 2 ω2 Ẍ + (α + βcos(τ))X = 0 β Ẍ + (α⁄ω2 + ⁄ω2 cos(τ)) X = 0 (10) This equation (10) is similar to Mathieu’s equation, on which we can apply the M-files presented before. However, the code must adjusted to integrate the time depend frequency and the new values for each parameter. This code is available in Appendix 5 Figure 8: Stability diagram of Mathieu’s Equation 1 Dimension with varying angular frequency (w) 14 Figure 9: Stability diagram of Mathieu’s Equation 1 Dimension related to Period time (1/w) Comment: The figure 7 show that the stability regions turns to be larger as omega increases, and equivalently, on the second figure the instability region turns to be larger as the period (1/w) increases. 15 4. Improving Matlab code [11] [10] The first programs for Mathieu’s equation give us correct and good results. However it presents important disadvantages: Limited plotting tool (only one run plot) Limited parameters data (ℝ+) Excessive computing time Each point must be tackled to improve users’ possibilities and comfort: The first program done for finding Arnold’s tongues was limited only for positive real parameters, however in practical case this limit is not occurring, covering all real numbers. To adequate more this program with reality and practical problems, the algorithm has been considerably changed to present results also with negative parameters. M-file available in Appendix 6 Results: Figure 10 : Code for negative parameters Comment: This new feature permits to figure out that the stability regions are symmetrical according to the x-axis (alpha), meaning that the sign of B do not affect the stability of the system, only A does. Limits on plotting: The interest of this part is to be able to observe in sync the stability charts for different systems, in order to notice the evolution of the Arnold’s tongues for each modification. 16 The second consequence is to visualize the effects of multidimensional and coupling cases compared to the simplest Mathieu’s equation of dimension one. Results: Figure 11: Stability diagram of Mathieu’s Equation 2 Dimensions Figure 12: Stability diagram of three different Mathieu’s Equations with 2 Dimensions Comment on this result: This figure 11 is a study similar at the “Solving Mathieu equation multidimensional with/without combination” with A=[1 0;0 4] and B=[1 0;0 4], the result is also similar at this section, however with the ability to plot different stability regions for different system, we can now superimpose the stability regions for the 1 dimension A=1 17 B=1, A=4 B=4 and the combination on 2 dimensions. The results shows that the final stability regions are the regions previously stable in the both cases. This diagram confirms the idea announced previously. 4.1. Optimizing Matlab code The main problem of all these programs is the computing time. These durations are variable and depend on various factors: Dimension of the Mathieu’s equation Type of results wished (Simple plotting, comparison, coupling) Parameters bandwidth Resolution Range of Parameters (α,β) [0;3.2] Resolution Executing time 0.0025 19hrs 49min [0;3.2] 0.01 1 hr 19min [-1;3.5] 0.02 44 min 19s [0;3.2] 0.02 23min 43s Chart 1 Executing Time for two dimensional case without coupling As Matlab programming language is parsed, code is interpreted in real time. Languages like C++ and FORTRAN are faster because they compile directly into the computer’s native language. The advantages of parsing in real time are greater robustness, and easier debugging. The disadvantages are a significant loss in speed. Instead of writing Mathieu’s equation program in computer’s native language (difficult challenge), Matlab proposes help and functions to speed up codes. This section discusses the basic strategies used to decrease the computing time. The main disadvantage to speed up a code is to make the code more complex to read for novices, to modify and to correct in case of errors, but through this chapter the numerical solving idea and the results will remain identical of the previous chapters. N.B: Matlab is releasing each year new versions more and more powerful, the following procedures might be obsolete in the next few years. To speed up a code, the first question to ask is: Where are the most consuming time functions in my program? Matlab 5.0 and newer versions include a tool called the “profiler” that helps to determine the final computing time and where the most important consuming time functions are in a program. After a run, the profiler generates an HTML report on the program and launches a browser window with: the time computing, all functions used classed by duration. More information can be obtained by clicking on the functions, to locate the most timeconsuming lines. 18 Results Chart 2: Matlab's Profiler Comments: The most important consuming time function are ode45(), which solve the differential equation and the Mathieu2D, which builds the function. The ode45() is a builtin function so it should be already optimize in time. However, the options(AbsTol and RelTol) in this function permit us to find solution faster but with a error more important. It is user’s responsibility to choose between faster computing time and the error tolerance. Concerning the Mathieu2D functions, the way to build the function (3 lines and combining matrices) is not the fastest, this can be improved. 19 4.1.a. First acceleration: Array Pre-allocation A well-known aspect for speed up Matlab is the pre-allocation of arrays. Matlab’s matrix variables have the ability to dynamically augment rows and columns, the matrix data memory must reallocated with larger size. If a matrix is resized repeatedly like on a “for” loop, this overhead becomes noticeable. To avoid this phenomenon, the programmer must pre-allocate the matrix with the command zeros() with the right number of rows and columns. In this report, the number of rows and column are deductible with the parameter bandwidth and the resolution, like for example: >> k1=zeros(X_end/resolution+1,X_end/resolution+1); 4.1.b. Second acceleration: Local parallel computing On the hardware side, nowadays microprocessors have generally two or four computational cores, currently expending to even more. The last past years have also seen fast-growing accesses to clusters and networks of machines. In order to stay on the top, this numerical computing environment had to evolve from a simple matrix tool into a mature technical computing environment that supports large-scale projects To ensure this new feature, a new set of commands has been added to allow the user to request to parallel execution or to control distributed memory. The Parallel Computing Toolbox allows a user to run a job in parallel on a desktop machine, using up to 8 "workers" (additional copies of MATLAB) to assist the main copy. If the computer has multiple processors, each worker can activate one core, and then the computation should run faster. Executing Matlab in the regular way only engages one processor’s core using, whereas, if the processor presents more cores, the computing time can be significantly reduced. Running in parallel requires three steps: - Request a number local workers - Execute the normal command to run the program. The client call workers for help as needed - Release the workers Opening/Closing local workers is proceeded by using these functions: >>matlabpool open local 4 >>matlabpool close The word local means the workers are treating on the local machine with cores available The value “4”, value optional, is the number of workers you are asking for. It can be up to 8 (12 for Matlab 2012) on a local machine. If no values are entered, Matlab uses the maximum workers available on your computer. Adding these two lines, the program should run identically as before, but faster. Output will still appear in the command window in the same way, and the data will all be 20 available. What has happened is computations were treated by different cores in a way but not visible for users. Before any change in the code, the first question is to know if the whole program can be executed in parallel mode. Running Parallel for-Loops (parfor): Many applications in Matlab involve multiple segments of code, some are repetitive. Generally, for-loops can solve these cases. The basic concept of a “parfor” loop in Matlab is the same as the standard for-loop. Part of the parfor body is executed on the Matlab client (where the parfor is executed) and part is solved in parallel on MATLAB workers. Matlab workers execute iterations in no particular order, and independently of each other. The ability to execute code in parallel, on one computer, can significantly improve performance in the case of parameter sweep application with many iterations or long iterations. The only restriction on parallel loops is that no iteration is allowed to depend on any other iteration. Easily we can figure out, that the main loop “for” in the code (alpha, beta or omega variation) proceeds unrelated calculation. Each data point (alpha, beta or beta, omega) presents the same independent calculation. In conclusion, Parallel computing and more specially Parfor-loops suit perfectly the objective to speed up this code. The disadvantage of this technique is with all workers activated, the CPU is working 100%, instead of 50% in normal use for two cores), meaning that the computer would be barely usable for other tasks. During this internship, computations have been done on this computer CINVESTAV’s personal computer: Intel Core 2 Duo CPU E7400 2.80GHz Win XP (2 Cores) Experience Computer 1 CINVESTAV personal 1 CINVESTAV personal 2 CINVESTAV personal 2 CINVESTAV personal Methods Local Parallel Computing Normal Local Parallel Computing Normal Resolution Executing Time 0.002 9hrs 4min 20sec 0.002 15hrs 4min 58sec 0.02 9 min 05 sec 0.02 15min 40sec Chart 3: Time comparison between Local computing 1 core versus 2 cores 21 The gain in time for a very sharp definition is important 6 hours (40% time gained). Since it takes some time to set up the parallel execution and transfer data, we still won't see a speedup if the job is too small. The experience for a rough definition the parallel computing gained around 6 minutes (37.5% time gained). 4.1.c. Third acceleration: Computing on Graphic cards using GPU Originally designed to make computer games look pretty and improve performances on computer-aided design, GPUs are massively parallel processors on graphics cards (presenting over 400 cores), promising to revolutionize computing in few years. Since 2010, Nvidia and Mathworks have collaborated to offer the GPU’s advantages also for scientists and engineers through Matlab’s interface. The GPU becomes a coprocessor for the personal computer. Since 2011, Matlab proposes a new toolbox for GPU calculation suited for a variety of areas such as data analysis, image and signal processing applications including communications systems, computational finance, etc. The GPU toolbox’s charm is to enable the programmer to perform computations on powerful GPU using familiar MATLAB language and from MATLAB environment without the exigency to master advanced technical language (as C or Fortran) or having to learn the intricacies of GPU architectures. Figure 13: Architectures differences between CPU and GPU The “Alu” (Arithmetic Logic Unit) are the processing area optimized to handle mathematical computations and logic comparisons. On this schema, the GPU’s architecture presents 12 times more Alu tan the classic processor, which makes it powerful for solving paralyzed calculus. Basically, the GPU can execute 800 times more calculus than CPU but this number is very variable depending on CPU’s technology and cores. GPU computations relies on three steps process: Send data to the GPU memory, Execute code (the "kernel") to process, and receive the results to Matlab environment. In general, 22 transferring code should be designed to minimize steps to keep the overall speed of calculations. CUDA (Compute Unified Device Architecture) calculations on GPU usually start to overcome ordinary CPU calculations for large-sized problems, e.g., matrices of sizes 1000 or so. It should be noted that this sort of computation is still in its infancy, appearing a little raw, but developing rapidly. In our program, the matrices’ size depends on various factors, however for a reasonable definition, Matlab has to deal with matrices size of hundreds until thousands, beyond the limit of interest for using GPU. There are two options for performing MATLAB calculations on the GPU: You can transfer or create data on the GPU, and use the resulting GPUArray as input to enhanced built-in functions that support them. You can run your own MATLAB function file on a GPU. The suitable option depends on whether the functions you require are able to support GPUArray, and the performance impact of transferring data to/from the GPU. Supported MATLAB Code: The functions passed into “arrayfun” (to be calculate on GPU), can contain the following built-in MATLAB functions and operators: Unfortunately, Matlab does not provide all functions needed for solving Mathieu’s system, and specially the most important functions: ode45.m to solve differential equations and eig.m, to calculate the eigenvalues. The question is now would it be valuable to reprogram these missing functions to gain computing time. With Cinvestav’s investment on GPU and the promising future on GPU calculation, we share the common interest to test and create a version able to run on GPU. The reprogramming ODE45.m and eig.m function for GPU calculation are both available electronically or in Appendix 11 with the corresponding code. 23 5. Using Matlab to simulate system 2 masses and 3 springs (with two varying stiffness): Figure 14: System 2 Masses 3 Springs The purpose if this section is to make a complete test for a system presenting 2 masses and 3 springs, a basic and well used system. Solving the equations for a multi degree of freedom system normally does not lead us to the Mathieu’s equation or Hill’s equation due to the lack of variation of parameters. For a multi-degree of freedom system unforced and un-damped system, where [M] and [K] are symmetric matrices we obtain this equation from Newton’s second law: [𝑀]{𝑥̈ } + [𝐾]{𝑥} = 0 For a system: 2 masses and 3 springs: M [ 1 0 0 K + K2 ] {ẍ } + [ 1 −K 2 M2 −K 2 ] {x} = 0 K2 + K3 In order to obtain Mathieu’s equation and so parametric resonance, we assume that 2 springs has stiffness under cosines variation (k1 and k3), we obtain: [ M1 0 K cos(t) + K 2 0 ] {ẍ } + [ 1 M2 −K 2 −K 2 ] {x} = 0 K 2 + K 3 cos(t) Multiplying by [M]-1, we successfully obtain a form of Mathieu’s equation with varying parameters. The first part of this animation/simulation is to obtain the mass displacements from this equation related to time, with all parameters configurable. For this problem, a Simulink diagram has been configured according to the equation. See Appendix 7. The second part was to create all dynamic elements of the animation (masses with squares and springs with plotting functions). Mathworks proposes on its website equivalent programs by the Matlab’s community (Reference) to create these forms but needs to be slightly adapted to the problem (number, position, dimension, dynamic position). The third part was dedicated to the User’s interface. Matlab propose a very useful graphical interface called “GUI”, which does not request to write any code about the interface. This interface has for purpose to let the users choosing most of the parameters of the systems, and to adapt to 24 the maximum the simulation to their real problem. The interface generates two results. The mass displacement related to time in live and the stability or not of their systems. A User’s guide is available for users in Appendix 8. Figure 15: Configuration for the simulation In order to validate the results, tens simulations have been proceeded and compared with the stability plots from the chapter 1. All samples had been chosen differently: instability, stability, close borders, parameters. This verification procedure can be easily redone at any time, by anyone as soon as the results are obtained from both programs. The software presents as the results the animation of the two blocks and springs in space in direct time, the main interest is especially for novices using this software, to help visualizing and understanding the behavior of this system. The second results represents the displacements of the blocks related to time, this graphical is useful to figure out the behavior of the system (symmetric displacement, anti-symmetric, instability). The third result is the maximum amplitude data for the two masses blocks. However the stability results must be taken carefully because this information is only reliable for the unstable case. Actually, the simulation time is sometimes not long enough to determine with certainty the stability of the system. 25 26 6. Conclusion on parametric resonance Parametric resonance is a well-known resonant phenomenon, which determines the instability of a system in response to small perturbation. In the light of this definition, it tends to suggest that parametric resonance is a danger for any system. For the last 10 years, parametric roll resonance for ships or automotive industries has been in focus of their scientific department. However, if we look at a completely different class of systems it is possible to find applications, which actually the parametric resonance is used as an advantage. In micro-electromechanical systems parametric resonance phenomena are induced to, for example, reduce the parasitic signal in capacitive sensing [16], or to increase robustness against parameter variations in micro-gyroscopes [18]. Analogous interests in capitalizing the large energy released by parametric resonant oscillations to boost specific system features are also developing in the field of wave energy exploitation. The idea is to induce parametric resonance in order to increase the amount of energy producible by the converter [20, 21] Parametric resonance is nowadays a hot topic for research and should still be for years. Thanks to my work and to the knowledge made available at CINVESTAV, I have been able to find the instability tongues characteristics of Mathieu’s equation of different forms, to master the optimization of Matlab code and to perform a complete animation of a system 3 masses-2springs, which can be readily be adjusted to another system with different dispositions or dimensions. My work permits to this team research to have reliable tools to find the stability diagrams for different forms of equation (mono and multi dimensions). My other contribution is with the Simulink diagram and the animation, which make the parametric resonances more visible and giving information about the vibration amplitude. The next direct goal would be to write a program to find combination of parameters in order to control vibration amplitude or to minimize them, which is of great interest for industries with goal to attenuate vibration. 27 Appendix 7.1. Appendix 1 : Matlab: Meissner's equation ................................................................. 29 7.2. Appendix 2: Matlab: Mathieu's Equation x''+(alpha+beta*cos(t))x = 0 ...................... 30 7.3. Appendix 3: Finding Numerical solution for Ordinary Differential equation ............. 31 7.4. Appendix 4 : Matlab: Mathieu's Equation 2 Dimensions .......................................... 33 7.5. Appendix 5: Matlab Mathieu’s equation with Angular frequency variation .............. 34 7.6. Appendix 6: Matlab Solving and plotting negative parameters.................................. 35 7.7. Appendix 7: Simulink diagram to obtain mass displacements.................................... 36 7.8. Appendix 8: Simulation User guide: ............................................................................ 37 7.9. Appendix 9: Reprogramming ODE45 function for GPU .............................................. 37 7.10. Appendix 10 Reprogramming Eig.m ............................................................................ 39 References:.................................................................................................................................. 40 28 6.1. Appendix 1 : Matlab: Meissner's equation % Initials alpha=0;beta=0; w1=sqrt(alpha+beta); w2=sqrt(alpha-beta); resolution=0.01;X_end=5; % Functions f1 = inline('abs(2*cos(pi()*w1)*cos(pi()*w2)(w1/w2+w2/w1)*sin(pi()*w1)*sin(pi()*w2))','w1','w2') f2 = inline('abs(2*cos(pi()*w1)-pi()*w1*sin(pi()*w1))','w1','w2') f3 = inline('abs(2*cos(pi()*w1)*cosh(pi()*abs(w2))-(w1/abs(w2)abs(w2)/w1)*sin(pi()*w1)*sinh(pi()*abs(w2)))','w1','w2') % Stability analysis for alpha=0:resolution:X_end for beta=0:resolution:X_end w1=sqrt(alpha+beta)+eps; %+eps to not divide by 0 ! w2=sqrt(alpha-beta)+eps; if alpha-beta>0 f1(w1,w2) if f1(w1,w2)<2 k(round((alpha+resolution)/resolution),round((beta+resolution)/resolut ion))=[1]; else k(round((alpha+resolution)/resolution),round((beta+resolution)/resolut ion))=[0]; end end if alpha-beta==0 f2(w1,w2) if f2(w1,w2)<2 k(round((alpha+resolution)/resolution),round((beta+resolution)/resolut ion))=[1]; else k(round((alpha+resolution)/resolution),round((beta+resolution)/resolut ion))=[0]; end end if alpha-beta<0 f3(w1,w2) if f3(w1,w2)<2 k(round((alpha+resolution)/resolution),round((beta+resolution)/resolut ion))=[1]; else k(round((alpha+resolution)/resolution),round((beta+resolution)/resolut ion))=[0]; end end end end %Plotting alpha= 0:resolution:X_end; beta= 0:resolution:X_end; [X,Y] = meshgrid(beta,alpha); surf(Y,X,k,'EdgeColor','none','LineStyle','none'); XLABEL('Alpha');YLABEL('Beta') 29 6.2. Appendix2: Matlab: Mathieu's Equation x''+(alpha+beta*cos(t))x =0 % Initialization clc ; clear all; X1_int=[1 0 ]'; X2_int=[0 1 ]'; X_int=[X1_int X2_int]; % Initial Conditions % Variables global alpha beta t % Parameters resolution=0.1;X_end=2.5; Error=0.001; tspan=[0,2*pi()];options= odeset('RelTol',1e-5,'AbsTol',1e-5); %Options for ode45 %Solving for alpha=0:resolution:X_end for beta=0:resolution:X_end for n=1:1:2 [t,Y] = ode45(@Mathieu1D,tspan,X_int(:,n),options,alpha,beta); for m=1:1:2 Y_sol(m,n)=Y(end,m); % Solution at 2*pi() end end %Eigenvalue Max Eig_max=max(abs(eig(Y_sol))); if Eig_max >=1+Error k1(round((alpha+resolution)/resolution),... round((beta+resolution)/resolution))=[0]; %White or Blue else k1(round((alpha+resolution)/resolution),... round((beta+resolution)/resolution))=[1]; % Black or Red end end end % Plotting figure; alpha= 0:resolution:X_end; beta= 0:resolution:X_end; [X,Y] = meshgrid(beta,alpha); colormap(jet) hand=surf(Y,X,k1,'EdgeColor','none','LineStyle','none'); XLABEL('Alpha') YLABEL('Beta') function [dx_dt]= Mathieu1D(t,x,alpha,beta) D1=alpha+beta*sign(cos(t)); D=[-D1 0];C=[0 1]; R=[C;D]; dx_dt=R*x; return 30 6.3. Appendix 3: Finding Numerical solution for Ordinary Differential equation The sensitive part of this code is to find the solution of this differential equation to obtain correct eigenvalues. Matlab for this goal has various tools for numerically solving, finding the right function is not an easy task, in this following section, a quick presentation of the chosen function will be discussed. The two most used built-in functions are ode23() and ode45(), which implement versions of Runge-Kutta 2nd/3rd order and Runge-Kutta 4th/5th order respectively. The basic usage for these Matlab’s solvers is of this following use: > ode45(function, domain, initial conditions, options, parameters) Options: Several options are available for Matlab’s ode45 solver, giving the user a limited control on the algorithm. Two important options are relative and absolute tolerance, respectively RelTol and AbsTol in Matlab. At each step of the ode45 algorithm, an error is approximated for that step. If 𝑦𝑘 is the approximation of 𝑦(𝑥𝑘 ) at step k, and 𝑒𝑘 is the approximate er ror at this step, then Matlab chooses its partition to insure 𝑒𝑘 ≤ max(𝑅𝑒𝑙𝑇𝑜𝑙 ∗ 𝑦𝑘 , 𝐴𝑏𝑠𝑇𝑜𝑙) Where the default values are RelTol =.001 and AbsTol =.000001. As an example for when we might want to change these values, observe that if 𝑦𝑘 becomes large, then the error 𝑒𝑘 will be allowed to grow quite large. In this case, we increase the value of RelTol. Solver ode45 ode23 ode113 Implicit/Explicit Explicit Explicit Explicit Accuracy 4th order, medium accuracy 2nd/3rd order, low accuracy Very accurate (13th order) ode15s ode23s Implicit Implicit ode23tb Implicit Low to medium Low (might be more stable than ode15s) Low (might be more stable than ode15s) When to Use Most common For crude error tolerances solving computationally intensive problems For stiff problems For moderately stiff problems For moderately stiff problems with damping A basic uses in Matlab for ODE are ode45, ode23 and ode15s (the “s” signifies that it uses an implicit method). The solver able to estimate the error in the solution at each time step, and decide whether or not the time step is too large (error too large) or too small (inefficient) ODE45 (an explicit Runge-Kutta method) is efficient, but can become unstable with stiff systems. This will manifest itself by the solver taking shorter and shorter time steps to compensate. The solution will either take a long time, or the time step will be reduced to the point where machine precision causes the routine to fail. 31 ODE15s should only be used for stiff problems. Because it is an implicit scheme, it will have to solve (possibly large) sets of equations at each time step. Matlab’s Solvers do not need to specify a step size. ODE45 uses the explicit fourth order Runge-Kutta-Fehlberg method, which also gives an estimate of the truncation error at each step. The solver is able to choose a step size which meets the error tolerance we specify. Options are set by creating an options structure with the odeset command. Stiff equations are differential equations for which certain numerical methods for solving equation are numerically unstable, and lead to rapid variation unless the step size is taken to be extremely small. The question is to know if Mathieu’s equation can lead to a stiff problem. If it was the case, the basic ode solver would return an error message. For all tests done during this internship the ode45 has never return this type of error. It is fair enough to assume the Mathieu’s equation is not a stiffness equation. However, a couple specified parameters can one day leads to this problem. 32 6.4. Appendix 4 : Matlab: Mathieu's Equation 2 Dimensions % Mathieu's Equation is x''+(Alpha*A+beta*B*cos(t))x = 0 for 2 dimensons global alpha beta t X1_int=[1 0 0 0]';X2_int=[0 1 0 0]'; X3_int=[0 0 1 0]';X4_int=[0 0 0 1]'; X_int=[X1_int X2_int X3_int X4_int]; % Initial Conditions resolution=0.01;X_fin=3; tspan=[0,2*pi()];options= odeset('RelTol',1e-5,'AbsTol',1e-5); %k1=zeros(X_fin/resolution+1,X_fin/resolution+1); for alpha=0:resolution:X_fin disp([' Computing ', num2str(alpha) ,' : ', num2str(X_fin)]); for beta=0:resolution:X_fin for n=1:1:4 [t,Y] = ode45(@Mathieu2D,tspan,X_int(:,n),options,alpha,beta); for m=1:1:4 Y_sol(m,n)=Y(end,m); end end %Eigenvalues Eig_max=max(abs(eig(Y_sol))); Error=0.001; if Eig_max >=1+Error k1(round((alpha+resolution)/resolution),round((beta+resolution)/resolu tion))=[0]; %White else k1(round((alpha+resolution)/resolution),round((beta+resolution)/resolu tion))=[1]; % Black end end end % Plotting figure; disp([' Plotting ...']); alpha= 0:resolution:X_fin; beta= 0:resolution:X_fin; [X,Y] = meshgrid(beta,alpha); colormap(jet) hand=surf(Y,X,k1,'EdgeColor','none','LineStyle','none'); XLABEL('Alpha') YLABEL('Beta') function [dx_dt]= Mathieu2D(t,x,alpha,beta) A=[1 0 ; 0 1]; B=[1.4 0 ; 0 1.4]; D1=alpha*A+beta*B*cos(t); D=[-D1 zeros(2)]; C=[zeros(2) eye(2)]; R=[C;D]; dx_dt=R*x; return 33 6.5. Appendix 5: Matlab Mathieu’s equation with Angular frequency variation % Mathieu's Equation is x''+(Alpha*A+beta*B*cos(wt))x = 0 global alpha;alpha=1; X1_int=[1 0 ]';X2_int=[0 1 ]'; X_int=[X1_int X2_int ]; % Initial Conditions resolution=0.01;X_max=2;X_min=-2; options= odeset('RelTol',1e-5,'AbsTol',1e-5); for w=X_min:resolution:X_max if abs(w)< 0.1 for beta=X_min:resolution:X_max k1(round((w+resolution+abs(X_min))/resolution),round((beta+resolution+ abs(X_min))/resolution))=[0]; end else tspan=[0,2*pi()/w]; disp([' Computing ', num2str(w) ,' : ', num2str(X_max)]); for beta=X_min:resolution:X_max for n=1:1:2 [t,Y] = ode45(@hillomega,tspan,X_int(:,n),options,w,beta); for m=1:1:2 Y_sol(m,n)=Y(end,m); end end %Eigenvalues Eig_max=max(abs(eig(Y_sol))); Error=0.0008; if Eig_max >=1+Error k1(round((w+resolution+abs(X_min))/resolution),round((beta+resolution+ abs(X_min))/resolution))=[0]; %White else k1(round((w+resolution+abs(X_min))/resolution),round((beta+resolution+ abs(X_min))/resolution))=[1]; % Black end end end end % Plotting figure; w=X_min:resolution:X_max; beta= X_min:resolution:X_max; [X,Y] = meshgrid(beta,w); colormap(jet) hand=surf(Y,X,k1,'EdgeColor','none','LineStyle','none'); xlabel('Omega') ylabel('Beta') function [dx_dt]= hillomega(t,x,omega,beta) global alpha; D1=alpha/(omega*omega)+beta/(omega*omega)*cos(omega*t); Matrice_eq=[0 1;-D1 0]; dx_dt=Matrice_eq*x; return 34 6.6. Appendix 6: Matlab Solving and plotting negative parameters Mathieu's equation x''+(Alpha*A+beta*B*cos(t))x = 0 for 2 dimensions %Initialization global alpha beta t X1_int=[1 0 0 0]'; X2_int=[0 1 0 0]'; X3_int=[0 0 1 0]'; X4_int=[0 0 0 1]'; X_int=[X1_int X2_int X3_int X4_int]; % Initial Conditions X_min=-1; resolution=0.01;X_max=3.5; tspan=[0,2*pi()];options= odeset('RelTol',1e-5,'AbsTol',1e-5); for alpha=X_min:resolution:X_max for beta=X_min:resolution:X_max for n=1:1:4 [t,Y] = ode45(@Mathieu2D,tspan,X_int(:,n),options,alpha,beta); for m=1:1:4 Y_sol(m,n)=Y(end,m); end end %Eigenvalues Eig_max=max(abs(eig(Y_sol))); Error=0.001; if Eig_max >=1+Error k1(round((alpha+resolution+abs(X_min))/resolution),round((beta+resolut ion+abs(X_min))/resolution))=[0]; %Red else k1(round((alpha+resolution+abs(X_min))/resolution),round((beta+resolut ion+abs(X_min))/resolution))=[1]; % Blue end end end % Plotting figure; alpha= X_min:resolution:X_max; beta= X_min:resolution:X_max; [X,Y] = meshgrid(beta,alpha); hand=surf(Y,X,k1,'EdgeColor','none','LineStyle','none'); function [dx_dt]= Mathieu2D(t,x,alpha,beta) A=[1 0 ; 0 1]; B=[1.4 0 ; 0 1.4]; D1=alpha*A+beta*B*cos(t); D=[-D1 zeros(2)]; C=[zeros(2) eye(2)]; R=[C;D]; dx_dt=R*x; return 35 6.7. Appendix 7: Simulink diagram to obtain mass displacements 36 6.8. Appendix 8: Simulation User guide: The very first is to run your version of Matlab, followed by the file “Start Program.m”. As soon as the “Start Program.m” is running, a new window appears to the user. This unique window permits to the user to calibrate all parameters for his simulation: The mass of the two blocks (in kilograms) The stiffness, the stiffness max for varying springs (in Newton/meter) The position limits for the two block symbolized in the diagram by the two black lines(meter) As soon as one of the two blocks touches the system is declared as unstable. Initial positions of the two blocks from the limit position 1 (meter) Initial velocities for each block (meter/second) Initial acceleration for each block (meter/second*second) Simulation time (second), Maximum value of time for the simulation and animation Step size (second), if this value is too small, the animation will be considerably slowed. Angular frequency for the stiffness variations (radian/second) The animation accepts all values for all parameters, the user’s responsibility is to make sure the positions of the blocks and limits 1 and 2 are in the right order. However, Matlab might never start the simulation. The masses and the stiffness values can be entered as negative values. The animation always calibrates on the values entered by the users and should never presents out of range results. 6.9. Appendix 9: Reprogramming ODE45 function for GPU As the following program computing on GPU is much larger than the others, this GPU version is only available electronically (CD, USB key). The formula for the Euler method is yn+1 = yn + hf(xn , yn ) Which advances a solution from xn to xn+1 ≡ xn + h. The formula is unsymmetrical: It advances the solution through an interval h, but uses derivative information only at the begging of that interval. That means that the step’s error is only one power of h smaller than the correction. There are several reasons that Euler’s method is not recommended for practical use, among them, the method is not very accurate when compared to other, fancier, methods run at the equivalent step size, and neither is it very stable. 37 Consider, however, the use of a step to take a “trial” step to the midpoint of the interval. Then use the value of both x and y at that midpoint to compute the “real” step across the whole interval. In equations, k1 = hf(xn , yn ) 1 1 k 2 = hf (xn + h, yn + k1 ) 2 2 yn+1 = yn + k 2 + O(h3 ) As indicated in the error term, this symmetrization cancels out the first-order error term, making the method second order. [A method is conventionally called nth order if its error terms is O(hn+1 )]. In these equations above, the system is called the second order RungeKutta or midpoint method. By far the most often used is the classical fourth-order Runge-Kutta formula which has a certain sleekness of organization about it: k1 = hf(xn , yn ) h k1 k 2 = hf (xn + , yn + ) 2 2 h k2 k 3 = hf (xn + , yn + ) 2 2 k 4 = hf(xn + h, yn + k 3 ) yn+1 = yn + k1 k 2 k 3 k 4 + + + + O(h5 ) 6 3 3 6 The fourth-order Runge-Kutta method requires four evaluations of the right-hand side per step h. This will be superior to the midpoint method if at least twice as large a step is possible for the same accuracy. Adaptive Stepsize control for Runge-Kutta A good ODE integrator should exert some adaptive control over its own progress, making frequent changes in its step size. Usually the purpose of this adaptive step size control is to achieve some predetermined accuracy in the solution with minimum computational effort. Many small steps should tiptoe through treacherous terrain, while a few great strides should speed through smooth uninteresting countryside. The resulting gains in efficiency are not mere tens of percents or factors of two; they can sometimes be factors of ten, a hundred, or more. Sometimes accuracy may be demanded not directly in the solution itself, but in some related conserved quantity that can be monitored. 38 6.10. Appendix 10 Reprogramming Eig.m 𝑎 𝑏 Special case for matrices 2-by-2: 𝐴 = [ ] 𝑐 𝑑 Trace of this matrice: 𝑡𝑟𝑎𝑐𝑒(𝐴) = 𝑎 + 𝑑 Determinant of this matrice: det(𝐴) = 𝑎𝑑 − 𝑏𝑐 Eignevalue 1: 𝐿1 = Eignevalue 2 : 𝐿2 = 𝑡𝑟𝑎𝑐𝑒(𝐴) 2 𝑡𝑟𝑎𝑐𝑒(𝐴) 2 + √𝑡𝑟𝑎𝑐𝑒(𝐴) ∗ 𝑡𝑟𝑎𝑐𝑒(𝐴) − √𝑡𝑟𝑎𝑐𝑒(𝐴) ∗ 𝑡𝑟𝑎𝑐𝑒(𝐴) 4 4 − det(𝐴) − det(𝐴) Matlab function: function [L1 L2]=G_eig(A,B,C,D) T=A+D; % Trace Determinant=A*D-B*C; L1=T/2+sqrt(T*T/4-Determinant); L2=T/2-sqrt(T*T/4-Determinant); return 39 References: [1] C. CHEN, Linear system theory and design, Oxford University, 1999 [2] R. W. BROCKET, Finite dimensional linear system, John Wiley and sons, 1970. [3] Ô TURHAN, Generalized Bolotin’s method for stability limits determination of parametrically excited systems, 1998. [4] C. GRANT, Mathematical lecture on periodic linear system, Brigham Young University, 1999. [5] D. ROTHMAN, M.I.T. open courseware - Parametric Oscillator, http://ocw.mit.edu/courses/earth-atmospheric-and-planetary-sciences/12-006j-nonlineardynamics-i-chaos-fall-2006/lecture-notes/, 2006 [6] T.I. FOSSEN, H. NIJMEIJER, Parametric Resonances in dynamical systems, Springer, 2012. [7] D. W. JORDAN, P. SMITH, Nonlinear Ordinary Differential Equations, Keele University, 2007. [8] K. Karan, Process dynamics and numerical methods: Solving Nonlinear Equation in MATLAB, Queen’s University, 2007. [9] A. CONSTANTINIDES, N. MOSTOUFI, Numerical methods for chemical engineers with Matlab applications, 1999. [10] P. GETREUER, Writing fast Matlab code, 2006. [11] MATHWORKS, Parallel computing toolbox user’s guide, 2012. [12] X. ZHANG, W. LI, Y. ZHOU, A Variable Stiffness MR Damper for Vibration Suppression 2009. [13] P.SEYRANIAN, A. MAILYBAEV, Multi-parameter stability theory with mechanical applications, Moscow state Lomonosov University, Russia 2003. [14]J. PODEŠVA, J. POLÁK, Instable parametric oscillation during the rope track transport, Technické univerzity Ostrava, 2008. [15] J. BURKARD, G. CLI, MATLAB parallel computing, Virginia Tech, 08 February 2010 [16 ]J. GYU, Vibration simulation using Matlab, KYOTO, JAPAN MAY 2003 [17] M.TREMONT, Solving ODEs in Matlab, 2009 (http://mit.edu/voigtlab/BP205/Notes/BP205_Matlab_slides.pdf) [18] K.L., MILLER, S.A., HARTWELL, Five parametric resonances in a micro-electromechanical system, p 149–152, 1998 [19] RAMOS, L.A., BURGNER, Robust micro-rate sensor actuated by parametric resonance. Sensors and Actuators A: Physical, P80–87, 2009 [20] ZHANG, W., TURNER, K.L, Application of parametric resonance amplification in a singlecrystal silicon micro-oscillator based mass sensor. P23–30, 2005 40 [21] OLVERA, A. PRADO, E. CZITROM: Performance improvement of OWC systems by parametric resonance, European Wave Energy Conference, 2001 41