So the outcome of last lecture was on one hand a little bit exciting because what we did is we took the measurements that we get and we try to use them as a, for as a way of designing controllers to stabilize the system. We actually know how to stabilize systems. We need the real parts of the eigen values are all strictly negative. On the other hand, the outcome of the last lecture was wildly disappointing because we couldn't actually do it. And the reason for that was that we only looked at the output and not at the full state information. So today, we're going to look at How do we design controllers when we take all of x into account, and not just y. so if you recall this picture. What we're going to do today is simply say, you know what? I don't care about y. In fact, forget about measurements. What comes out here is x itself. And then, what can we actually do? Now, obviously. What we need to which is the topic of the next modal is create a way of actually sucking out x from y but for now lets just pretend for a moment that we do have access to the full state information. Well if we have that first off we dont have to worry about y what so ever So x dot is Ax plus Bu, forget about y. Then what we do is instead of saying u is negative Ky, we're now going to say u is negative Kx, where K is the matrix of various gains in it. In the previous example, it was just a scalar with a 1 in it, but in general it could be a matrix. Now, just like last time, we plug this choice of u Back into the equation for x., and then we get x., this ax, plus bu, well u is negative kx. So then we can put everything together in this matrix, a minus bk. And if we call this A hat, we all of a sudden have a new system matrix and our job is to make A hat as pretty as possible. Well in particular A hat is known as the closed loop dynamics because now we have closed the loop of the system. We're feeding back the state information. Into the system and in that way we are getting rid of the Ax's or x dot is Ax plus Bu and we are getting x dot is A minus BKx and they control the sign task from a stability point of is simply pick if possible K such that the closed-loop system is stabilized and luckily for us we now know. Exactly what this means. It means that the real part of the eigenvalues of the closed-loop dynamics, A minus BK, has to be strictly negative. So, let's go back again to our simple robot to see how can we understand this in the context of the simple robot. And arguably, the entire next module, module 4, is going to be devoted to this question. How do we pick K such that we can stabilize this system, get the eigen values we want? And on top of that, how do we get around this rather peculiar conundrum where we only have y but we would like to have x and we're going to pretend that we have X. Well, that, we will have wait for. But for now, let's go back to the robot. Let's note, though, first of all, that u is in r, and x is in r squared, or r2. And, in fact, if u is negative kx. It's always useful to write down this kind of dimensional analysis. Where x is n by 1. In this case, u is in general, let's say that u is m x 1, in this case it's actually 1 x 1, then, from a dimensional point of view, K has to be m x n, because otherwise it doesn't work out, so we have to be able to cancel these things out, and out comes soemthing that's m x 1. So in general, K is a m x 1 Matrix where m is the dimension of the output and the n is the dimension of the state. Okay, in this case m by 1 means 1 by 2, we pick k1 and k2 here, those are our control gains, we plug it to the A-Bk equation here. So this is. This is a, this is b, and this is k, right? So if we do that, we get this system. And we perform the matrix multiplication. I would encourage you to make sure that I got the matrix multiplication right by doing it yourselves. But, for now, let's just accept the fact that the close loop dynamics becomes x dot, is 0, 1 minus k1 minus k2x. Okay, so now we have this 2 knobs that we can tweak, k1 and k2, and w hen we tweak them, the eigen values of the closed loop dynamics are going to move around. So, in the next module we'll be systematic in terms of how we actually pick this case. For now. Let's just put some case pull some case out of a hat. Oh, and I'm a lazy man, so I'm pull once out of the hat. So let's just try k1 equals k2 equals to 1. Why not? As a first, first attempt, at least. Well, if I plug this in to my A mius BK equation, I get the following closed-loop system dynamics. And let's check the eigenvalues of these things. So list write eig in MATLAB or whatever system you want to use. if you do that, you'll find out that the eigenvalues are negative 0.5 - plus minus something, something, something, j. What are the real parts of the eigenvalues? Well the real parts of the eigenvalues. ,, . There, -0.5, so there strictly negative, which of course is what we needed for stability. So we have asymptotic stability, so we have in fact Achieved asymptotic stability. Now, the other thing to note is that the fact that we have a J hanging around there, meaning we have an imaginary component to our eigenvalues, that means that we can expect oscillations in the way the system behaves. So we have an asymptotically stable system with some oscillations floating around, and they are in fact damped oscillations because, since the system is stable, the oscillations are going to become smaller and smaller in amplitude, and as t goes to infinity, they are going to in fact go away completely. So if I do this, then here is what it looks like. As you can see very quickly we get close to the origin we overshot a little bit and this because of these osculations. So lets see if we can do something about these osculations. Well here is another attempt completely arbitrary. I am going to make k1 smaller which means k1 tells me how much I react to position and k2 tells me how much I react to volicity You can always think of, almost think of this as a p parameter in a PID regulator, and this is the d parameter i n the PID regulator. Because p is the position in this case, and d is the derivative of position, which is velocity. And that's what k2 is, is affecting. Okay. If I do that, then my new system matrix becomes this beast here. Well, let's check its eigenvalues. In this case, the eigenvalues end up being these 2 numbers. And they're real, which means we cannot expect, really, any oscillations. and even better yet. The real and strictly negatives. So this is an asymptotically stable system with no oscillation. Oscillations. So, this seems like a pretty decent design to me. Let's see what it would actually do to the robot. So the robot, eh, well, it's not oscillating but it's unbearably slow. So, what we saw here is that we actually got rid of the oscillations but we got assistance that was much more or sluggish in the sense that iti's slow and borderline annoying from a performance point of view. But for now asymptotic stability is achieved and what we saw we need to do is to be able to achieve stability while doing other things at the same time. But one thing that is absolutely clear is that some eigenvalues are better than others. And our design of control gain, somehow, should be reflected by, what are good eigenvalues. So, some eigenvalues cause oscillation. Some eigenvalues cause instability. Some eigenvalues make the system Respond too slowly and so forth. So what I want to leave you with now is it seems like state feedback is the way to go. Even though we don't really know how to get to state yet. But we will by the end of the next module. And we have to be careful and creative and clever in terms of how we select our eigenvalues. And that's another topic for the next module. which is how do we actually Select the appropriate eigenvalues to get the closed loop system behavior that we want.