What we saw in the previous lecture was how to model switch systems in a rather general way using these things called hybrid automaton. today, I want to show that just because we know how to design good linear time invariant controllers and we know how to draw a hybrid automaton, doesn't mean that we can just say, [SOUND] we're done, we can do everything we want to be able to do. In fact, what I want to do today is talk to you about a rather famous counter example that makes thinngs hard when you're in the hybrid world. So, I'm going to answer the following question, what can possibly go wrong when you start switching between different controllers. And this tangle of yarn here is supposed to illustrate what can happen when you start switching and messing things up together in, in rather surprising manners. Well, lets let's start rather modestly. Let's say that I have two modes. I have x dot is equal to A1x and x dot is equal to A2x and this A1 and A2 matrices they look rather innocent, if you ask me. Some small negative value on the diagonals, same small diagonal negative values, their epsilons is positive. And then, on the off-diagonals, you have one and negative two here, and two and negative one there. Well, well let's check the eigen values, that's the first thing we should always do. Well, it turns out that no matter which system you have, both A1 and A2, the eigenvalues are both -epsilon plus -1.41j. Well, what does this mean? Well, the real part is equal to -epsilon, which is strictly negative, so both systems are asymptotically stable, meaning that x will die down to the origin. And both of them have a nonzero imaginary component, which means that you're going to have oscillations, alright? So, we have asymptotically stable systems with oscillations. And, in fact, let's see what happens when we start combining these different modes. Before we do that though, let's actually look at the modes a little bit more carefully by themselves. So, here is mode 1, x dot is A1x and what I've plot that here on this axis is x1 and what I've plot that here is x2. What this would look like if I have time here and let's say, x1, is I would gets decaying oscillations. Well, we don't have that now because I plotted x1 and x2. And this is where I start, in this case, I guess, I started at 1,1 and the system starts flowing. And because epsilon is small, you're going to get closer and closer to zero but slowly. And you're going to spiral in like this. And, you know, t goes to infinity. You're going to end up at the origin because you have indeed an asymptotically stable system. So, A1 is well-behaved. It spirals a little bit but what do we care? We're not afraid of spirals. Here's A2. It also looks like a spiral but instead of a tall and skinny spiral, it's a short and chunky spiral. Again, we start at 1,1. And this system starts spiraling and it goes inwards and then, [SOUND] it goes like this so it's also asymptotically stable as it should but because of the particular eigenvectors of these two systems, we end up spiraling in slightly different ways. But the point is we have two stable systems. Now, let's put them together in a hybrid automaton. So, this is hybrid automaton number 1. I'm going to spiral, tall, and skinny, until [0 1]x=0. this means that the second component, so x2=0 is what this guard means, right? And when x2=0, I switch to my short and chunky ellipsoid or inward spiraling system. And then, when x1=0, I switch back. So, this is my first hybrid automaton. Well, let's see what that actually looks like if you do it. So, as always. we start at 1,1. I start in mode 1 [SOUND] until this point, right, where x2=0, then I switch to mode 2 which as the short and chunky ellipsoid. Here, x1 becomes 0 and now I switch to mode 1 again so we have 1,2,1. Now, we switch to mode 2, to mode, mode 1, and so forth. And as we keep doing that, we spiral in, and one thing that you're going to notice then is that we're actually ending up at the origin at a much faster rate. So, this system is not just asymptotically stable, it's asymptotically stabler, which is not a word, by the way than the original systems, because it actually converges at a faster rate. So, by switching, we were able to get to the origin faster, which makes you wonder, why am I calling this a counter example? Well, this is not a counter example. But aha, hybrid automaton number 2, maybe that is the counter example. It's the same as hybrid automoton number 1, but I switched the guard conditions. So I'm switching from mode 1 to mode 2, when x1=0 and I'm switching from mode 2 to mode 1, when x2=0. This seems like a modest enough modification if you ask me, but modesty in all modesty, it turns out that that is a huge deal. Now, 1,1 is hiding somewhere here and what's happening is that we're now starting to spiral out. So now, here we have, for instance, that x1 became zero. Now, we're switching to the, the fat spiral. Here, x1 becomes 0 and we're switching to the skinny spiral. And in this way, we're going to end up getting further and further out. And this is indeed an unstable system and this is a little bothering to us because I took two stable systems and I put them together in a hybrid system, and I got instabilities. So the punchlines here is, first of all, stable modes by themselves, that's not enough to guarantee that the resulting switch to hybrid systems is stable. In fact, you may induce instabilities through switches. And that's a little bit of a downer, to be completely honest. The other thing is that you can actually reverse this and say, you could even design unstable modes, which we're never going to do. But you could and actually get a switch system that is stable. So basically, you could reverse time when we, what just looked at. And we get to unstable modes that renders the switches But here is how we actually will approach this. We will design stable modes because it would be suicidal to design unstable modes and then hopefully, miraculously hope that the switches will, will take care of it. So, we're going to design, design stable modes but we need to be aware of the fact that the new system is not stable. And, in fact, it would be nice if we could check that either analytically or at least in simulation because the hybrid world is a little bit scarier than the nonhybrid world.