Open access

Simulation of Piecewise Hybrid Dynamical Systems in Matlab

Written By

Fatima El Guezar and Hassane Bouzahir

Submitted: 06 December 2011 Published: 26 September 2012

DOI: 10.5772/48570

From the Edited Volume

MATLAB - A Fundamental Tool for Scientific Computing and Engineering Applications - Volume 3

Edited by Vasilios N. Katsikis

Chapter metrics overview

4,744 Chapter Downloads

View Full Metrics

1. Introduction

A hybrid dynamical system is a system containing on the same time continuous state variables and event variables in interaction. We find hybrid systems in different fields. We cite robotic systems, chemical systems controlled by vans and pumps, biological systems (growth and division) and nonlinear electronics systems.

Because of interaction between continuous and discrete aspects, the behavior of hybrid systems can be seen as extremely complex. However, this behavior becomes relatively simple for piece-wise affine hybrid dynamical systems that can, in contrast, generate bifurcation and chaos. There are many examples such as power electronics DC-DC converters.

The common power electronics DC-DC converters are the buck converter and the boost converter. They are switching systems with time variant structure [9].

DC-DC converters are widely used in industrial, commercial, residential and aerospace environments. These circuits are typically controlled by PWM (Piece Wise Modulation) or other similar techniques to regulate the tension and the current given to the charges. The controller decides to pass from one configuration to another by considering that transitions occur cyclically or in discrete time. In order to make the analysis possible, most of mathematical treatments use some techniques that are based on averaging or discretization. Averaging can mean to wrong conclusions on operation of a system. Discrete models do not give any information on the state of the system between the sampled instants. In addition, they are difficult to obtain. In fact, in most cases, a pure analytic study is not possible. Another possible approach to analyze these converters can be done via some models of hybrid dynamical systems. DC-DC converters are particularly good candidates for this type of analysis because of their natural hybrid structure. The nature of commutations of these systems makes them strongly nonlinear. They present specific complex phenomena such as fractals structures of bifurcation and chaos.

The study of nonlinear dynamics of DC-DC converters started in 1984 by works of Brockett and Wood [4]. Since then, chaos and nonlinear dynamics in power electronics circuits have attracted different research groups around the world. Different nonlinear phenomena have been observed such as routes to chaos following the period doubling cascade [16], [5], [19], [20] and [23] or quasi-periodic phenomena [6], [7] and [8], besides border collision bifurcations [23] and [2].

Switched circuits behavior is mostly simulated by pure numerical methods where precision step is increased when the system is near a switching condition. Those numerical tools are widely used mainly because of their ease-of-use and their ability to simulate a wide range of circuits including nonlinear, time–variant, and non–autonomous systems.

Even if those simulators can reach the desired relative precision for a continuous trajectory, they can miss a switching condition and then diverge drastically from the trajectory as in figure 1. This could be annoying when one is interested by border collision bifurcations, or when local behavior is needed with a good accuracy. In those applications, an alternative is to write down analytical, or semi–analytical, trajectories and switching conditions to obtain a recurrence which is very accurate and fast to run. Building and adapting such ad’hoc simulators represent a lot of efforts and a risk of mistakes.

Generic and accurate simulators can be proposed if we are restricted to a certain class of systems. A simulation tool with no loss of events is proposed in [14] and [15] for PWAHSs defined on polytopes (finite regions that are bounded by hyperplanes). This class of PWA differential systems has been widely studied as a standard technique to approximate a range of nonlinear systems.

But closed polytopic partition of the state space does not allow simulation of most switching circuits where switching frontiers are mostly single affine constraints or time–dependent periodical events.

This chapter follows our previous study in [13], [12] and [11].

We focus on planar PWAHSs with such simple switching conditions which can model a family of switched planar circuits: bang–bang regulators, the Boost converter, the Charge-Pump Phase Locked Loop (CP-PLL),...

This class of systems has analytical trajectories that help to build fast algorithms with no loss of events. We propose a semi-analytical solver for hybrid systems which provides:

  • A pure numerical method when the system is nonlinear or non-planar;

  • A pure analytic method when all continuous parts of the system and switching conditions can be solved symbolically. This can be the case for the boost converter [3], [21], the second order charge-pump phase locked loop [17], [22].

  • A mixed method using analytical trajectories and numerical computation of the switching instant when those solutions are transcendent. This has been used for the third order CP-PLL [17]. It can also be the case for the Buck converter [10], [21],...

This chapter is organized as follows. Section 2 contains our main results. We describe the problem to be deal with, we introduce a general algorithm to solve planar HSs, we present the algorithm that detects events’ occurrence and devote a subsection to our approach efficiency. Section 3 Illustrates the current-mode controlled Boost converter example. Finally, a conclusion is stated in Section 4.

Figure 1.

Numerical simulation versus semi–analytical simulation.


2. Main results

2.1. A HS(X,E,t): general definition

A general definition of HSs is presented here. This type of dynamical systems is characterized by the coexistence of two kinds of state vectors: continuous state vector X(t) of real values, and discrete state vector E(t) belonging to a countable discrete set.

Definition 1 A continuous-time, autonomous HS is a system of the form:


=n×is called the hybrid state space. X(t)nis the continuous state vector of the HS at time instant t and E(t):={1,,N} is its discrete state. E+(t)denotes the updated discrete state right after time instantt. ϕ:describes the discrete dynamic, it is usually modeled by Petri Nets. A transition from E(t)=i to E+(t)=j is valid when the state X reaches a switching set calledSEi,Ej. Such transitions are called state dependent events. A HS is called piece-wise affine if for eachE, F(X,E)can be defined byF(X,E)=AEX+BE,X.

Remark — For non–autonomous HSs, the function ϕ can also depend on timeϕ(X,E,t):n××. Then time dependent events can occur and validate a transition, such as periodic events.

2.2. HSs class of interest

We consider a two dimensional PWAHS (X(t)2). Fhas then the affine piece-wise form, F(.,.)is defined for each E and X2 byF(X(t),E(t))=AE(t)X+BE(t), where AE(t)2×2 and BE(t)2 are two matrices that depend on the discrete stateE(t). Hence, a two dimensional PWAHS is a HS that take the form:


We consider two kinds of events: state dependent events and periodic events.

The state dependent event transition SEiEj is defined by an affine state border of the formNij.X<lij. In this case an event can occur when the continuous state reaches the border of the setSEiEj={X(t)2:Nij.Xlij}.

Note that the set SEiEj is not polytopic in the sense that the domain is not the interior of a closed bounded polytope.

Remark — We consider, without loss of generality, the case where a transition occurs at time dSEiEjif and only if the state X(dSEiEj) reaches a border of the set SEiEj from outside. Figure 2 defines a transition with the complimentary setS¯, which allows to detect the event in both directions.

Figure 2.

Oriented polytopic state dependent transitions.

Both transitions can be met with the setB=SS¯. Periodic events are simply defined by time instantst=dEiEj, where dEiEj belongs to the set EiEj={t:t=kT+φ,k}. T is the period and φ is the phase of such periodic events.

2.3. Event–driven simulation of PWAHSs

The simulation will compute the hybrid state from event to event. Knowing the states X(tk) andE(tk+), one can compute the trajectoryX(t>tk)=tktf(X(tk),E(tk+))dt+X(tk), assuming that the discrete state is constantE(t>tk+)=E(tk+). Then the following algorithm runs the simulation determining the date at the next event as the smallest:

Algorithm 1. Algorithm computing the hybrid state attk+1.

2.4. Event detection occurrence: description and algorithm

We consider the affine Cauchy problem in2:


where X0 is the initial value. We compute the smallest strictly positive time ti* so that the trajectory of X(t) intersects the fixed border Bi arriving from the part of the plan whereNi'.X<li. The function fi(t)=Ni.X(t)li defines the guard condition for a borderBi. Thus, the problem can be formulated as follows:


If fi does not have any strictly positive root or the last condition is not satisfied, ti*is given the infinite value.

2.4.1. Analytical trajectories

Definition 2 For any square matrix A of order n and t in, the exponential matrix etA is defined by


where I is the identity matrix.

It is well known that the analytical trajectory X(t) of the initial value matrix differential equation (3) is given in terms of the exponential matrix and the variation of constants formula by the general integral form:


When A is invertible, the above expression becomes linear:


The analytical expression of the exponential matrix eAt takes two forms depending on whether the eigenvalues p1 and p2 of the matrix A are equal or not:



, then




, then


whereA=(a11a12a21a22), A=(a22a12a21a11)andI=(1001).

Using these expressions, we can determine the function f(t) of the problem (4) as follows:


where ai are real scalars.

Depending on the eigenvalues p1 andp2, there are five cases that determine the values of the coefficients ai as shown in Table 1.


Table 1.

Expressions of f(t) depending on the eigenvalues p1 andp2.

Remark — Coefficients ai are real scalars that depend on the eigenvalues p1 andp2, the initial point Xk and the border parameters are Ni andli.

In some cases, (p1=p2=0, gray cell in Table 1) roots of f(t) can be found analytically and the problem is solved with machine precision.

In other cases, the solution can not be found with classical functions and then a numeric algorithm should be used. Using classical methods like Newton does not guaranty existence or convergence of the smallest positive root. To meet these conditions, let us use analytical roots of the derivative function f(t) expressed in Table 2.


Table 2.

Expressions of f(t) depending on the eigenvalues p1 and p2

We can then compute analytically the set L of ordered roots off(t), those roots determines monotone intervals off(t). The following algorithm is used to return the solution t* when it exists or the value if not.

Remark — When (p1,p2)*×* the set L is infinite: when the real part of pi is positive, the algorithm

Algorithm 2. Algorithm computing t* when a solution is transcendent.

will end by finding a root. In the other case, the set L should be reduced to its three first elements, to find a crossing point when it exists.


3. Matlab modelling

Our semi-analytical solver is composed of different main programs that define the studied affine system. First, we create the affine system given with a specifically chosen name. Then, we define the matrices Ai andBi. After that, we give the switching borders with the sign of transitions and all necessary elements or we give the period if it is about a periodic event. Finally, we execute the simulation by specifying the initial state and the time of simulation.

3.1. Application: Current-mode controlled Boost converter

A current-mode controlled Boost converter in open loop consists of two parts: a converter and a switching controller. The basic circuit is given in figure 3.

This converter is a second-order circuit comprising an inductor, a capacitor, a diode, a switch and a load resistance connected in parallel with the capacitor.

The general circuit operation is driven by the switching controller. It compares the inductor current iL with the reference current Iref and generates the on/off driving signal for the switchS. When S is on, the current builds up in the inductor.

When the inductor current iL reaches a reference value, the switch opens and the inductor current flows through the load and the diode. The switch is again closed at the arrival of the next clock pulse from a free running clock of periodT.

The Boost converter controlled in current mode is modeled by an affine piece-wise hybrid system defined by the same sub-systems given in equation as follows:


Figure 3.

Boost converter controlled in current mode.

In the case of the Boost converter controlled in current mode, there are two types of events:

A state event defined by a fixed border of the setSE1E2:


and another periodic event defined by the datest=dEiEj, where dEiEj belongs to the set:


where T is the period of this periodic event. The different simulations are obtained using our planar PWA solver.

Before performing any study of the observed bifurcations in this circuit, a numerical simulation in the parametric plane is needed.

The following program calcule_balayage_mod.m is used to obtain the parametric plane:

After calculating the necessary points of the parametric plane saved in the file named dat_balais, the next program affiche_balayage.m plots the figure given in Fig.4

The figure 4 of the parametric plane allows to emphasize the parameters values for which there exists at least one attractor (fixed point, cycle of orderk, strange attractor).

Figure 5 shows a bifurcation diagram (Feigenbaum type) in the plane(Iref,iL). However, figure 6 shows the bifurcation diagram in the space plane(I,iL,vC).

To draw these two figures we use programs: calcule_figuier.m and affiche_figuier.m

In these two figures, the voltage Vin is fixed to 10V and the current Iref varies in the interval[0.5,1.6]. We observe a period cascade doubling leading to a chaotic regime, interrupted by a border collision bifurcation at Iref=1.23A (see figure 7). In this figure, a distinction is given between the attractors of attractive cycle type of the order 1 to14. Each cycle of order k is associated with one color.

For example, the blue area O1 represents the parameters’ values for which there exists an attractive fixed point (fundamental periodic regime). The red area O2 represents the existence of an attractive cycle of order2. The yellow area O4 represents the existence of an attractive cycle of order 4 and so on until getting the cycles O14 of orderk=14. The black area O+ corresponds to parameters values (Iref,Vin) for which there exist cycles of order k15 or other types of attractors. In this last area, a chaotic phenomenon could be observed. This bi-dimensional diagram shows some bifurcation curves. In fact, for the rectangle defined by the interval of parameter Vin[7,15] and the parameterIref[0.5,1.6], we observe an area of blue color (existence of attractive fixed point) followed by an area of red color (existence of cycle of order2), an area of yellow color (existence of cycle of order4) and another area of black color (existence of cycle of order k15 or another attractor type); this succession of zones corresponds to the existence of period doubling cascade.

This representation of the parametric plane is not enough to establish a bifurcation structure of the hybrid model of the Boost converter, but it is useful for the initialization of programs to draw bifurcation curves..99 The simulation results (temporal domain and voltage-current plane (vC,iL)) are obtained using the planar PWH solver in the case of the Boost converter controlled in current mode for periods: 1T(figure 8) for Iref=0.7A, 2T(figure 9) for Iref=1A, 4T(figure 10) for Iref=1.3A and the chaotic regime (figure 11) for Iref=1.5A. For these plots we used the code below by choosing the bifurcation parameter Iref corresponding to each period case.

Figure 4.

Parametric diagram of the Boost converter in the plane (Iref,Vin) for Iref[0.5,1.6]A and Vin[5,20]V.

Figure 5.

Bifurcation diagram of the Boost in the plane (Iref,iL) for Iref[0.5,1.6]A and Vin=10V fixed.

Figure 6.

Bifurcation diagram of the Boost in the space (Iref,iL,vc) for Iref[0.5,1.6]A and Vin=10V fixed.

Figure 7.

Zoom of figure 5: Border collision for Iref=1.23A.

Figure 8.

Fundamental periodic regime for Iref=0.7A: (a) (up) temporal waveform of the voltagevC, (down) temporal waveform of the currentiL; (b) phase plane (vC,iL).

Figure 9.

Cycle of order 2 for Iref=1A:(a) (up) temporal waveform of the voltagevC, (down) temporal waveform of the currentiL; (b) phase plane (vC,iL).

Figure 10.

Cycle of order 4 for Iref=1.3A: (a) (up) temporal waveform of the voltagevC, (down) temporal waveform of the currentiL; (b) phase plane (vC,iL).

Figure 11.

Chaotic regime for Iref=1.5A: (a) (up) temporal waveform of the voltagevC, (down) temporal waveform of the currentiL; (b) phase plane (vC,iL).


4. Conclusion

In this chapter, we have showed an accurate and fast method to determine events’ occurrence for planar piece-wise affine hybrid systems. As a result, we have implemented our algorithm in Matlab toolbox version (free downloadable on

This toolbox has also been completed by analysis tools such as displaying the bifurcation and parametric diagrams. The algorithm takes the advantage of the analytical form that appears in the planar case. Our approach can not be extended to a higher dimension. DC-DC converters like Boost converter are known to be simple switched circuits but very rich in nonlinear dynamics. As application, we have chosen the example of Boost converter controlled in current mode.


The authors would like to thank Pascal Acco and Danièle Fournier–Prunaret for crucial discussions on the original version of our work on this subject.


  1. 1. AccoP. .December2003Etude de la boucle à verrouillage de phase par impulsions de charge: Prise en compte des aspects hybrides. Ph D thesis, Institut National des Sciences Appliquées de Toulouse, France.
  2. 2. BanerjeeS.2000Bifurcations in two-dimensional piecewise smooth maps- theory and applications in switching circuits, IEEE Trans. on Circuits and Systems-I, 47633647
  3. 3. BouzahirH.El GuezarF.UetaT.2007On Scicos simulation of a hybrid dynamical system. Proceedings of the 15th IEEE International Workshop on Nonlinear Dynamics of Electronic Systems, Tokushima, Japan, 6265
  4. 4. BrockettR. W.WoodJ. R.1984Understanding power converter chaotic behavior mechanisms in protective and abnormal modes. Proceedings of POWERCON 11, pp. E-14.
  5. 5. DeaneJ. H. B.HamillD. C.1990Instability, subharmonics, and chaos in power electronic systems. IEEE Trans. Power Electronics, 5260268
  6. 6. El AroudiA.BenaderoL.ToribioE.MachicheS.2000Quasiperiodicty and chaos in the DC-DC buck-boost converter. International Journal of Bifurcation and Chaos, 10359371
  7. 7. El AroudiA. .February2000Study of nonlinear phenomena and quasiperiodicity route to chaos in PWM DC/DC convertersPh D thesis, Universitat Politécnica de Catalunya, Spain.
  8. 8. El AroudiA.LeyvaR.2001Quasi-periodic route to chaos in a PWM voltage-controlled DC-DC boost converterIEEE Trans. on Circuits and Systems, 488967978
  9. 9. El AroudiA.DebbatM.GiralR.OlivarG.BenaderoL.ToribioE.2005Bifurcations in DC-DC switching converters: review of methods and applicationsInternational Journal of Bifurcation and Chaos, 515491578
  10. 10. El GuezarF.BouzahirH.2008Chaotic behavior in a switched dynamical systemModelling and Simulation in Engineering2008Article ID 798395, 6 pages.
  11. 11. El GuezarF.AccoP.BouzahirH.Fournier-PrunaretD.2008Accurate and Fast Event Detection Occurrence in Planar Piecewise Affine Hybrid Systems. Proceedings of the International Symposium NOLTA (NOn Linear Theory and its Applications), September 7-10, Budapest-Hungary, 341344
  12. 12. El GuezarF. .December2009Modélisation et simulation des systèmes dynamiques hybrides affines par morceaux. Exemples en électronique de puissance. Ph D thesis, Institut National des Sciences Appliquées de Toulouse, France.
  13. 13. El GuezarF.BouzahirH.Fournier-PrunaretD.2011Event Detection Occurrence For Planar Piecewise Affine Hybrid Systems. Nonlinear Analysis: Hybrid Systems, 5626638
  14. 14. GirardA.2002Detection of event occurrence in piece-wise linear hybrid systems. Proceedings of the 4th International Conference on Recent Advances in Soft Computing, Nottingham, United Kingdom, December, 1925
  15. 15. Girard,A. (September2004Analyse algorithmique des systèmes hybrides. Ph D thesis, Institut National Polytechnique de Grenoble, France.
  16. 16. HamillD. C.JeffriesD. J.1988Subharmonics and chaos in a controlled switched-mode power converterIEEE Trans. Circuits Systs. I, 35810591060
  17. 17. HedayatC. D.HachemA.LeducY.BenbassatG. .March-April1997High-level modeling applied to the second-order charge-pump PLL circuit. Technical report, Texas Instrument Technical Journal. 142
  18. 18. MiraC. (1987). Chaotic dynamics. World scientific Publishing.
  19. 19. TseC. K.1994Chaos from a Buck switching regulator operating in discontinuous modeIEEE Transactions on International Journal of Circuit Theory and Application. 227262278
  20. 20. TseC. K.1994Flip bifurcation and chaos in three-state boost switching regulatorsIEEE Transactions on Circuits and Systems I: Theory and Applications, 4111623
  21. 21. TseC. K.2003Complex behavior of switching Power convertersCRC Press.
  22. 22. Van PaemelM. .July1994Analysis of a charge pump PLL: a new modelIEEE Transactions on Communications42724902498
  23. 23. YuanG. H.BanerjeeS.OttE.YorkeJ. A.1998Border-collision bifurcations in the buck converterIEEE Trans. on Circuits and Systems-I, 45707715

Written By

Fatima El Guezar and Hassane Bouzahir

Submitted: 06 December 2011 Published: 26 September 2012