Now what makes something a Lyapunov function? And these are the three conditions. We just talked about positive definite. But if you can argue in a paper that something is really a Lyapunov function for this dynamical system. You have a reference, I want to point here or I want to have a time varying reference, right? There is a neighborhood for local results about the reference for which X is positive definite about X R. So if X is equal to X R, it has to be zero outside it's positive in this neighborhood. The dot has continuous partial derivatives. It's a reason if you take the non leading controls course with dale Lawrence right now, he's covering that. Khalil has a textbook out that does very mathematical developments of all these proofs and stuff. Henry, good question. >> [INAUDIBLE] >> Someone has a dot missing. >> [INAUDIBLE] >> Yeah, this dot should be down here. V has continuous partial derivatives, and then the dot has negative semi definite has to be negative cemetery. Yeah, that dot for some reason wandered on me, let me just fix that quickly. There we go. And it's back down. Okay, good, thanks. So we need partial derivatives, which with them rps was actually going to challenge when we switch but that's why we have to kind of take arguments from the switch theory to prove stability there. But the big thing is positive, definitely negative semi definite v dot, then this is the Lyapunov function, right? And that's easy to do. When you these always a scalar, right? What states go into your Lyapunov function and that set X? How many things do you have to put in there? >> [INAUDIBLE] All states. >> So let's say you have a spring mass system. Do you have to put X and X dot in there? Right, that's kind of the question. What do you think Josh? >> I think if your rates are stable, then what the rates are of [INAUDIBLE] >> Not necessarily because your rates can go to zero, but depending on the spring math, if you have a non modeled torque on it, you won't settle to X equal to zero necessarily. So, it depends- >> [INAUDIBLE] >> That system is, yes, but just because the system is, it doesn't mean the mathematical arguments making that statement are correct. So we often deal with simple ones as an analogy. But really, so I'm trying to think through this stuff, where was I going with this? What's the question I asked you? >> What we put on X? >> What states go in there? And Henry, you said the state you care about. So even with the spring mass system, maybe you want to control it to the origin. But maybe I don't, maybe my goal is just to have a certain velocity profile. We're just doing rate control. I mean spacecraft often we do that when we run tumbling a spacecraft after kick off. I just want to bring it to rest or maybe it's a spinner. I don't care how I'm pointing. I just need to be rotating at one degree per second while looking at that star, and that's what I need to do. So that's a case where I don't care about my orientation, I care about the rates, and even though it's a second order system, I still just put the rates in here. The Xs appear in your math potentially, but the positive definiteness needs to be about the things you care about for the control. So what's the control goal? So that's why when you construct the Lyapunov function, my first question is always Abby, what's the goal of this control? Right? What are we trying to drive to zero? And that's what you're hoping to function should be, okay? So that's what goes into X. Then you have one or multiple states, you do your typical gradient. It's basically a projection. Think of these as bowls, like you've seen all that, and if you can guarantee their negative that V dots, this V is a positive definite bold. If you guarantee on that ball, your projection of the emotion is always going to move downwards or at worst, keep the same altitude. That's a spring mass system. Then you've got constant energy, you're bouncing but you're not losing or gaining, that would be the Lyapunov stable. That's what we've guaranteed. So Lyapunov stability basically says, if you can find the Lyapunov function, started buying these properties. It is Lyapunov stable. We have not guaranteed convergence, simple example spring mass system. You put it in here, I'm using actual energy, you've seen this before, and then your V dot happens to be zero always. So no matter how you start out with, it's just going to keep bouncing and that is stable but not asymptotic, what has to happen to make it as asymptotic stable. What's the modification we need? V dot is semi definite if it's stable, but I wanted to be- >> [INAUDIBLE] >> Has to be negative definite. So now we can only bring the rates to zero at R reference, because otherwise you have this flat spot somewhere. Essentially if you have a the function think of it this if it does this then comes up, has a flat spot, here's my reference and I want to go there. But somewhere you could actually just come to rest here, or maybe it has something that looks like a local minima. Your V dots come to rest elsewhere, and you could get stuck like the plane or pendulum. You could give it a speed where this system just asymptotically stands up, it's a very particular speed, but that is possible, right? And that's means it's not asymptotic stable. Not all states will drive it down to this kind of orientation, whereas if it's negative definite, the derivative, it only comes there's only one flat spot and that is at your reference and that is where it will come to rest, right? So, cool, we love asymptotic stability. With second order dynamical systems, when we derive our controls, can we usually prove V dot is negative definite? >> [INAUDIBLE] >> Most of the time we can't, if it's a second order system and you care about states and rates, then we can't. If we only care about rates, and we'll get to that hopefully today 8:30. Okay, I've still got till 9:45. Okay, so that's something we'll have to look at now. Sometimes we can, sometimes we can't. So this is a nice theorem, but that's not always everything we need. So, asymptotic stability, it's same as before. But you also need V dot to be negative definite. So, if we add a spring mass damper system, this is RV dot, is this V dot negative definite. This just came up before a lot and we'll see this a lot now. So here I'm caring about states and rates, right? My V has X and X dot, and my V dot is minus c times X dot squared. Why is it not? >> Coz there's always zero for any X. >> Exactly, X doesn't appear in the right hand side. So X dot has to go to zero for V dot to go to zero. So it actually proves that X dot will your rates will go to zero. I just don't know what happens to my states, and this is a common thing for a second order system when you care about states and rates, right? So how do we still prove stability? Because right now we cannot we know it's stable but are proof doesn't guarantee it. What did we have to do? >> Take extra derivative. >> Yeah, that's one method. The other one, some of you, especially if you're taking the teaching nonlinear dynamics again this semester, there's something called Lasalle's invariance principle. It gives you the same results. It's a way to prove asymptotic stability when this condition arises. I like the higher order derivatives. Because we're engineers, we've taken one derivative. I can do two, I can do three. All right, so you have a set of states omega where V dot vanishes, in this example, my rates went to zero. That's a common thing we'll see. So then we take higher order derivatives and we evaluate the derivatives on the set where V dot vanished. We know x dot will go to zero, that we've already proven here. We just don't know if x will go to zero, right? So you take derivatives and apply it. And then it has to be an odd derivative where you get a non zero V dot on that set, and it needs to be negative definite in terms of the unknown states X. That's where you're playing a pendulum problem here all of a sudden it gave you something that was negative, semi definite globally or it was only locally negative definite because at 180 that V dot went back to zero again. That's why we only had local as asymptotic stability for that one. Okay, remember that. So those are examples. When you evaluate this, you take the derivatives, you plug it in on the set where this vanishes, you could plug in the equations of motion. I often don't do that because the X double dot, I often just leave it. Why can I argue that X doubled up time zero will be zero. When is something times zero going to be zero? >> [INAUDIBLE] >> No. >> Bounded. >> When it's bounded. How do we know X double dot is bounded? That you don't have something crazy happening all of a sudden. >> Because your function is continuous. >> No, because we've already proven stability of the system. From the stability, yes, there's a smoothness of everything else that comes with it. But basically the control is not going to accidentally just drive it to infinity and then come back down again and do something wild. We've already proven stability of the system. And yeah, so anyway, so I know it's a stable bounded system. So therefore this is something times zero. I don't even have to plug that in, because then if you did it another derivative the other way, I want to highlight is you could have an extra, triple dot times x dot plus x double dot times x double dot. Then you have to plug in your equations of motion on the set that made x dot vanish. And you end up with some algebra with this exact same expression. So different ways to do it. We'll do it next week with MRPs again, that is a good practice. But this one is negative definite, proving this thing is globally asymptotically stabilizing, of course has been you spring mass damper linear. So for convergence, sometimes we have to do this. Not always, but sometimes. If you have a linear system, you can prove and I'm just doing this quickly. We not do this much. But if you have a linear system you can create a Lyapunov function and there's a thing that you have your plant matrix here. And if the system is stable and that means actually strictly stable to all the routes on the left hand side of the imaginary plane, then it is stable if and only if for any symmetric positive or the existing core. So basically if this a you looked at the linear system theory and it's stable, then you can construct an R. That is going to be negative or minus, R. Will be negative definite. And make this a negative definite function. Now, why would you do that? It's sometimes you have parts of your systems are nonlinear and parts of it are linear. So I'm trying to talk about stability in a nonlinear sense and you can break up this part is stable. And from the linear stuff, I can include arguments at the stable, the linear system and the nonlinear combined is still going to be stable. That's when you might come across, we're not going to do this explicitly in this class. But some of you might have something similar in the project or a paper you might be reading. >> [INAUDIBLE] that A as [INAUDIBLE] stable, right? >> Yeah, you look at the roots- >> You just picked P and then we get R. >> Yeah, for any positive symmetric P, you can do that, yeah.