Leslie Kaelbling: 6.01 Lecture 03

Search transcript...

PROFESSOR KAELBLING: So last time-- hi. Last time we introduced the idea of restricting the class of state machines we're going to think about and use to the systems that are linear time invariant. And what we saw in lab was that we could-- I don't know, we could make a model of both the program that we were writing and of the world. And if those were both models of linear time invariant systems then when we composed them we got a joint model of the system which was a linear time invariant system. And we saw that we could combine those things and get a difference equation that described how the whole system worked, right? How the combination of the robot and the world work together.

So that seemed good. And what we found was that if we combined those things we got this difference equation. And then if we wanted to know how the combined system was going to behave, the tool we had was basically running that difference equation forward, simulating it to see what the effects were when we gave it a particular kind of input.

So that's already kind of a useful thing because we can simulate it. But of course we can simulate programs by we can just run them and see what they do. So what we're going to do today and next week is see if we can dig deeper into the math of system functions and actually quite quickly predict some things about how they're going to behave in the long run without doing step-by-step simulations. So just to be clear, we have this already one way of understanding what an LTI system is going to do by simulating it at looking at the plot, and now we're going to see another way of understanding what an LTI system can do.

So because what we're interested in-- what we saw last time was, well, we could put some signal into the system of the WallFinder and robot, right? So this signal here represents the step function that says hey, robot, I want you to be this far away from the wall. And this output signal here represents what the robot might actually do if it has a certain controller and the world, or the plant, operates in a certain kind of way.

And we might want to predict things like, well, is it going to overshoot? Is it going to eventually arrive at the right distance? And those kinds of things. And we want to be able to ask those questions-- we want to be able to ask them efficiently. In fact, what we want to do is eventually close the loop in the sense that we want to be able to use this mathematical analysis to help us when we're designing the controller of the robot. To say, ah, this design of a robot controller is going to work out well given what I wanted to do, and that design of a robot controller is going to work out poorly. So we want to be able to do mathematical analysis of the controller in such a way as to help us actually ultimately design the systems we're trying to build. So that's our plan.

OK, so everybody's used to functions. When we were in math we've defined functions, in programs we've defined functions. And what's useful about a function is that it's sort of-- it's anonymous. It doesn't have built into it what its arguments are going to be. It says, whatever my argument is, here's what the answer's going to be. Whatever my argument is, here's what the output's going to be. Whatever my input is, here's what the output's going to be.

So what we saw last time was a way of using operator equations to talk about how some particular signal was related to some particular other signal, right? So we wrote things like, V is equal to KE. We wrote something like that. And there we're talking about a particular relationship between a signal V and a signal E. What we're going to do today now is do the same thing we did with functions and math and procedures and programming, which is abstract away from the particular signals that we're talking about the relationship among, and just talk about a function-- a system function.

So a system function is a way of characterizing the relationship between the input to a system and the output from a system without, say, naming those signals. So it's just a way of describing, how does this box work? What does this box do? And we call them H. I don't know why, but we call them H. And it's really-- you can think of it as a relationship of how does Y vary given X, right? So it's a Y over X. And in fact, if you write down the operator equation for Y, how Y relates to X, and simply do this division-- and we'll do a whole bunch of it today so don't worry about it yet-- that is, that ratio of Y over X is the system function for the box that transforms signal X into signal Y.

So the cool thing, the important thing, is that the system functions are all, for LTI systems, are always describable as a ratio of 2 polynomials in R. The numerator is a polynomial in R and the denominator is a polynomial in R. And you guys are already good at doing stuff with R and with polynomials and so we're going to build on what we've been doing to-- in fact, that the software that I have for today and tomorrow is to build a python set of procedures for operating on system functions in terms of polynomials and R.

OK. So there is a crazy notational maneuver which, I don't know, we're sort of agreeing with tradition in various ways, but it makes for some kind of confusion. And in fact, I've written this on the board up here for reference just so you guys kind of know what we're doing. So let me just talk to you about this for a minute. What we did last time, we spent all our time thinking about writing these equations for difference equations where we had y of n on the left-hand side and everything else on the right-hand side, right? It told us how to compute y of n given old values for the inputs and old values for the outputs, right? We give old x's and old y's-- well, maybe a new x, new x, old x's, old y's, compute the new y. And so we had these coefficients, the c's and d's. And you got used to putting those in to describe a difference equation.

Now we're going to want to do something that's a little bit more symmetric. It puts sort of all the inputs on one side of the equation and all the outputs on the other side of the equation. And so we're going to think of it instead as looking like this. And so what I've done is taken all the y's and put them over on the left hand side of the equals sign and I made a new set of coefficients called a's. And here the a's are just the negation of the c's and the indices are off by 1.

So it's just a recipe for some kind of confusion and maybe we'll break with tradition and cause it to be more sensible in some future date. But anyway, this is the thing. It's not going to turn out to be too painful, but just so that you know what the relationship is between the c's and d's when we describe difference equations normally, and these a's and b's when we start to describe system functions. It's just that. It's not a big thing.

OK. So here's the maneuver, right? So if we take a difference equation and we rewrite it like this, with a's and b's, no problem. So we just gather all the y's on one side, gather all the x's on the other side. Then we can turn it into an operator equation where we start to talk about the whole signal Y and how it relates to the whole signal X. So here we have a polynomial in R times Y equals a polynomial in R times X.

So now I can just sort of divide over and I end up with Y over X is one polynomial in R divided by another polynomial in R. And so that's just algebra, the same kind that we were doing last time on these operator expressions. So we have a numerator and a denominator.

So what we'll see today and make use of a lot is the fact that-- and in some sense it's not surprising-- that the numerator of this ratio governs the immediate response to the input in some sense, but the denominator says what the long term behavior of the system is going to be. So the denominator tells us about the long term behavior of the system. So that's important sentence number one for this lecture.

OK. So first we'll develop a PCAP system-- primitives, methods of combination, ways of abstracting, for system functions, and then we'll see what good system functions are. Now we're used to PCAP systems this is going to go pretty quickly. OK. So system functions. What are our primitives when we make these systems, their gains and delays? So the system function for a gain is just k. OK, so let's be sure that this makes sense.

So if I have a system which is a gain, k, and I ask, what is the ratio between the output and the input? So what's Y-- oh, this chalk is not good-- Y over X, Y over X, Y over X is just k. So that's a system function. That's a pretty easy system function, right? Everybody good with that?

OK. Similarly for a delay, if I ask how does the output depend on the input? I get Y over X is R. Those are primitives. Easy primitives. That make sense? Nothing surprising?

All right. This is where it starts to be nice. So now, what happens when we combine, when we add up two systems, the outputs of two systems. Now we're in the combination mode. So this system and this system-- they might be primitives, or they might be arbitrarily big, hairy complicated things that we made yesterday. It doesn't matter. Whatever they are, they're going to be describable in terms of system functions. The system functions, they're ratios of polynomials.

And what we can see is that we can say well, look. Y here is equal to some signal Y1 plus Y2 where Y1 is what you get by running the signal X through H1, and Y2 is what you get by running the signal X through H2. So if we take these two guys and add them up, we can see that Y is equal to H1 of X plus H2 of X. And we can gather the H1 and H2. And so what we see is that Y is equal to some H of X where H is H1 plus H2.

OK. So that was all-- looks like a bunch of trivial algebra on the face of it, but the cool thing is just understand this, right? If you want to be able to describe how Y depends on X as a polynomial ratio, you take the polynomial ratio describing this box and the polynomial ratio describing this box, and you add them. OK, so you just add these two polynomial ratios, that's high school algebra, and that gives you a new polynomial ratio that relates X to Y. Is that good? OK.

Cascade is actually even easier. So, again, another favorite combination method is cascade. If we have two systems and we know their descriptions in terms of system functions [? reaches ?] and polynomials, then we can say, well, Y, we know that Y is H2 of H1 of X, right? Because we run X through here to get Y. And so if we wanted to draw a box around this combined system we could do that. We could call it H. And we would know that H was H2 times H1. Is that the same as H1 times H2? Yes-- put your hand up if yes. Yeah? OK, yes? The answer is yes under a condition which is-- starts at rest. Woo-hoo, all right, good. That's what we do this class, start at reset, yeah. Some of us finish at rest too.

So, yeah. So H1 H2, H2 H1, you can commute them as long as they kind of start up with 0s in their memory. Think of it that way. OK. And that corresponds to being able to commute these guys on the wire.

OK. So cascade, you just multiply the system functions to get the system function of the whole thing.

OK. Here's one more. This is a famous formula from historic early control theory called Black's formula. It's not a special thing. We could derive-- for any contraption that you can make out of H1's and H2's and H3's, we can derive the formula that combines them. But this is one that's a pattern that comes up a lot and it's useful to kind of know, but you should also always just be able to derive it.

So let's see how this goes. So imagine now I have-- this is a feedback subtract arrangement. We're already kind of familiar with this arrangement. So we have H1 and H2. So we've got these two systems, they're as complicated as we want them to be. They're described now using polynomial ratios. So if I do this algebra, I say, well, okay. Y is equal to H1 of something, right? It's equal to H1 of whatever the signal is here on this wire.

The signal on this wire is the sum of two signals. One of them is X. That's easy. The other one is negated, that sneaky little minus there, so that we get a minus sign. And it's H2 of something, and what is it H2 of? Y. So this formula, this is an operator equation that describes the constraint on how the system works. So that should be sort of familiar from last time.

So I do some algebra, I bring all the Y stuff on one side, the X stuff on the other side, so it looks like the form of the equation down on the bottom there. Then I can solve for the relationship between X and Y, and I get H1 over 1 plus H1 H2. So again, that says that if you give me a polynomial ratio for this box and a polynomial ratio for that box, you can just do some polynomial arithmetic which you guys know how to do-- at least you computer programmers know how to do it-- and you'll get out a polynomial, you can get out a polynomial ratio that describes the way that this whole contraption works. OK?

So from primitives we can build up this representation of the system. So notice this look superficially like what we did last week. Last week we had gains and delays, but they were described as state machines. And when we built a bigger state machine out of more state machine pieces we got a bigger machine that we could run. But we didn't get a mathematical expression for what that machine was doing, right? We got a piece of python code, essentially. But we didn't get a new difference equation. We didn't get a new system function.

What we're doing here is saying, if you give me the mathematical descriptions of these machines, I can give you back a mathematical description of the composition. So that's the important difference. Last time was, you give me something for each of those machines I can execute, and I'll give you back something we can execute. Today is, you give me something analyzable, and I'll give you back something analyzable. OK. I'm just going to skip this.

So what we found in lab last time-- that's just an analysis of the stuff that we did last week. What we found in the lab last week was that depending on how you picked K, or, in fact, what really matters is the product of K and T, you could get really different behavior in the robot. And in order to find-- we were trying to mess around and find interesting, good values of K or KT, and we did that by experimenting. We tried one, we ran it, we looked to see how loopy it was, we tried a different one, we tried-- so you spent some time messing around with the K's trying to find some that had different kinds of behaviors.

So messing around is OK, but it's a little slow. So what we're going to do now is see that we can actually mathematically predict those behaviors given the K and T and the description of the system function.

OK. And we're going to do this in stages. We're going to have a system, so some system, H. A signal comes in, and what comes out is a signal that gets transduced by the system H. So H operates on the input signal S. It gives us a new signal as output.

And what we're going to do is study how these things work, depending on the properties of H. So if we want to predict properties of the output of a system, that depends on some properties of the system itself and some properties of the signal that we put in. What we're going to do today is study the very simplest signal that's interesting that we can think of to put in and see what happens with it. And then next time we'll look at putting more complicated signals in.

So as a way of sort of taxonomizing signals and thinking about how complicated they are, our favorite simple simple signal is the unit sample signal, which has got a 1 at 0 and 0s everywhere else. So that's like the prototypically simple signal to deal with.

The next more complicated class of signals are what are called transient signals. They have only finitely many nonzero values. And what we saw when we played with the system class was that if you had some signal with finitely many nonzero values, you could always just scale and shift copies of the unit sample signal and add them up to make that signal.

The other class of signals which is interesting to us is bigger than transient. So that means that in fact, they're nonzero in infinitely many places, but bounded means that there is some upper and lower bound such that the signal never gets bigger or smaller than those bounds. It never goes outside that interval. We won't even think about unbounded signals. So we'll think about unit sample inputs today. Next time we'll talk about transient and bounded inputs.

OK. So for today, we're really only going to consider delta, which is the unit sample signal. For those of you whose Greek is a little rusty, we've been writing delta of n. That's a lowercase delta, this is an uppercase delta. So this is a sample of that unit sample signal. Then that big delta is the name for the whole unit sample signal. Just to keep our nomenclature straight. There's a ton of seats for those you who like the concrete--

OK. OK, good. So we're going to restrict our attention to unit sample input. So then what we have to think about is how different properties of H will affect the output. Because we're only going to think about that one input signal for right now. So what we're going to see is that we can predict the long term behavior of this system not only by executing it, but just by looking at the denominator of the system function.

OK. So let's look at some systems. We'll start simple and get the system to be more and more complicated. So the simplest kind of H that we know how to think about is a feedforward system. And in a feedforward system there's no dependence on the old outputs of the machine. The dependence is only on the inputs. So all of those A coefficients are 0. So we just have Y is equal to some scaled and shifted versions of X. OK?

And what do we know about that output signal? Where if the input is the unit sample and the output is described by a polynomial that looks like this. It depends only on X. And it's only got finitely many coefficients. So the output signal is going to be like one of the signals you made in software lab last week which has spikes in some particular places that you got by shifting the unit sample signal over and multiplying it by something.

OK? So if your system is a feedforward system, then the output is transient. It can only have finitely many nonzero values. Does that make sense to everybody? This is like the simplest case. And what it means is that in the long term, it's not very interesting. In the long term, what's the value of this signal? 0. Oh, is that a question in the very, very back?

STUDENT: Are those coefficients supposed to be different in the two equations?

PROFESSOR KAELBLING: Yeah, no, that's kind of an editing error in my part. You'll see that the B's and the D's aren't any different in those two regimes, but I should have picked one and stuck with it. So I'm sorry about that. Yeah, good question. That's, in fact, what made me write that up there on the board. These B's and the D's are the same. And the denominator coefficients are what get mucked around between those two ways of doing things.

OK. So feedforward systems. Not that exciting. We already kind of pretty much understand that. So let's now think about feedback systems, and we'll work our way up to really complicated feedback systems by starting with simple ones. So let's start out by thinking about a feedback system where really there's-- maybe there's some dependence, there's some complicated set of dependence on the inputs, but where there's also a piece of it that looks like this. So what we're going to do right now is focus down completely on a very simple system that looks like this. And we'll see that we can describe really complicated systems as sums of these little guys. So if we can understand what this little guy does, we'll be good.

OK. So here's the system. It's got input, it feeds back through a delay and a gain, and it comes back in and gets added in. So that's going to be the system of interest here for a while. OK. So what we can see-- I'm sorry, I'm skipping somehow. OK, good. So what's the system function for this guy? I don't need this anymore. So we will write this up. So we have X goes here, comes out to Y, comes through here, through a delay, through a gain, like that.

So let's just write the system function for this so that we're sure we know what we're doing. OK, so we're going to get Y is equal to X plus P0-- I'll say why it's called P0 in a minute, RY. Right? And then I get all the Y's on this side. I get Y1 minus P0R is equal to X. So Y over X is 1 over 1 minus P0R. So that's this simple feedback loop described as a system function.

Now we're going to look down at the denominator but we're going to say, well, what could this system function mean? What could it mean, 1 over 1 minus P0R? And we thought about this last time when we thought about feedback. And there's kind of a little proof using synthetic division, which is probably something you also did once upon a time. have to worry about it too much, but it's a justification again for this expansion that's a lot like the expansion that we looked at last time. So we have 1 over 1 minus P0 of R. That's a system function. It's a description of a system. And what this bit of algebra shows us is that we can think of that system really as an infinite sum of systems. We have 1 plus P0R plus P0 squared R squared plus P0 cubed R cubed, and so on.

So it's the sum of systems that describes what's going on farther and farther out, right? It's feedforward. It says farther and farther out in the future the value is going to be this P0, which we'll now call a pole, this pole raised to the power of how far out in the future it is. So this system is describable as a sum of these systems that is feedforward now, and it says this far out, n steps out into the future, my value is going to be pole to the n.

OK, so another way to think about it, sometimes this is an easier way to think about it, is to say, well, if I put the unit sample signal into this machine, what would happen? So If I put the unit sample signal in, on the first step it flies straight through and we get a 1. Now on the second step, that 1 comes around, goes through the delay, that makes it the second step, gets multiplied by the pole, has the X added in, but after the first step X is 0, right, because it's a unit sample signal. So this flies around and it becomes P0 delayed by 1. And then it flies around again becomes P0 squared delayed by 2. And it flies around again and so on. So that's another way to see this sequence that's going exponentially with time.

OK. A couple of people have been bitten by this before. In this formalism, if you have a cycle with no delay in it, it's just a mathematical impossibility. So a well-formed LTI system with a diagram like this, you need to have a delay in any loop. Because otherwise you're equating things that can't be equated.

OK. So what's the consequence of this? Why do we care? Well, if you look at now the pole in these systems, so here's a case of a pole of 0.5 and a pole of 1.2, those poles generate really different kinds of behavior. So a pole of 0.5 means that each subsequent sample is going to be half of the previous one, right? Because each time around we multiply by 0.5. A pole of 1.2 means each subsequent sample is going to be 1.2 times the previous one.

So this one is going to decay exponentially to 0, this one is going to grow exponentially. So by knowing that root, that P0, the pole, by knowing the pole, we can predict in the long term what's the system going to do? Is it going to decay or is it going to grow? So that's pretty cool. Pretty important. So that's pretty much what I just did.

Here's another case. Another case is what happens if the pole is 1. If the pole is 1 that's like not having this box here at all, right? We just come around, feed this back around. What machine is that that you've played around with before? The one where the pole is 1? It's the accumulator, right? It just says, my output is the sum of my current input plus my previous outputs. So it just adds up what it gets in.

Its response to the unit sample signal is what? What shape? It's another signal that you're used to. Step signal, right? If you put the unit sample signal into something that accumulates the value so far, you get a step. So that's what happens here. So this one pole is sort of special. It neither decays to 0, nor grows exponentially. The step signal's response-- I mean, the pole 0 response to a unit sample is a step signal.

OK, so here's a question. Here's a signal. It's a response to the unit sample input. It's a machine of this form. What value is P0? OK, put up the number of fingers you think is the answer. 2. 2. OK, we're rolling with 2. Excellent. Right. OK. So poles can be negative, no trouble with that? If the poles are negative, then the sign alternates, right? Because each time here, we're multiplying the previous value by minus 0.5. So the magnitudes are decreasing exponentially. If you took the absolute value and looked at what it was doing, it would be decreasing exponentially in the way that we understand, but the signs alternate. OK, that's fine.

All right. So this is kind of a recap of what could happen in a system with one pole. A system with one delay, one little feedback unit like this. There's four kind of cases that can occur all the time, and then a couple of special points. So if the pole is less than negative 1, that means it has a magnitude that's bigger than 1, but the sign is negative, then it's going to diverge in magnitude, the magnitudes are going to get bigger and bigger, but the sign is going to flip-flop. If it's between negative 1 and 0, that's the case that we just saw, the magnitudes will get smaller but the sign will alternate. If it's between 0 and 1, the magnitudes get smaller and it goes monotonically to 0, and if it's bigger than 1, then it grows monotonically.

Now I know that students in the class often want to memorize this as a table, or they ask me for a chart. And the chart's going to get bigger because there's going to be more cases. But don't try to memorize this as a table. Just understand that we have exponential growth that's governed by the magnitude of the pole, and we're taking that pole to a power. And then in this case, if the sign's negative, it makes it alternates up and down negative.

OK, so does that make sense kind of from first principles? I hate memorization. Don't memorize anything, just learn it.

OK. What happens at 0? if the pole is 0, it just goes straight through, right? So then we're back to a feedforward system. Pole at minus 1, constant value, alternating sign. Constant magnitude, I should say. Alternating sign.

So now we understand everything that you could do with a system that looks like that. So we'll make it a little more complicated system now. So what if we have a system now that has a path with 2 delays in the feedback? We could draw a picture like this. It's easy to read the system function off of that picture, right? I hope. So what happens when you run that is you don't get something that's like what you get from this guy. It doesn't just go up, it doesn't just go down, it doesn't just alternate sign, it doesn't do something that we expect, because it actually goes up and then it goes down again.

So we have to understand how that can work. So first of all, what we'll do is we can write down an operator equation that describes this guy. And then we can do the division and get the system function. And the system function looks like this down here. It's 1 over 1 minus 1.6R plus 0.063R squared. So that's the system function. And we could factor the system function. That seems like kind of an interesting thing to do. It looks like somebody probably picked the number so it would factor, which is probably true.

But that factoring doesn't help us understand this really yet as a composite system. What will help us understand it as a composite system is if we can make it actually look like this, right? So this block diagram doesn't look like this one. It's not obviously a sum of 2 separate systems. If we can make this picture look like this one, then what we'll be able to do is to say that, well, Y is the sum of 2 signals. It's a signal that happens when you put X through H1 plus the signal that you get when you put X through H2. So if you can divide it up into the sum of 2 signals, that's the kind of a thing that it feels like we're already pretty well-equipped to understand.

So now we're going to kind of use the PCAP idea in reverse. Here we have a complicated thing, but if we can take it apart in just the way we want to, we'll be able to analyze our system better. We have been using PCAP to build complicated things out of simple pieces. Now we're kind of here using PCAP to take a complicated thing and see if we can take it apart in a way that will let us analyze it better.

So our goal is to take this expression and turn it into something like this. Now you probably-- everybody learned this one in high school, too. I know that I allegedly did, but it certainly fell out of my head immediately afterwards. And we're not going to make you do it now. But you should remember that it's possible, and there's an algorithm and it doesn't require insight or anything.

So lacking insight, you could do-- a robot could do partial fraction expansion. So partial fraction expansion says, if I have something that has a factored expression down here in the bottom, I can find some expressions, A and B upstairs, so that it comes apart into a sum. OK, so don't worry about the details. Just know that you can do that. And something is going to happen and we're going to get some values and in this case, if we put 4.5 over 1 minus 0.9R, and minus 3.5 over 1 minus 0.7R, we get an expression that's equivalent to the one that we started out.

OK. Why does this make us happy? It makes us happy because it has the form Y over X, the system function H, is the sum of two system functions. And not only is it the sum of two system functions, it's the sum of two system functions that look like a system function that we already understand really well. So we've reduced this complicated thing to 2 pieces of something simple we already understand. So that's good.

So here's a different picture, right? So now from this way of rewriting the expression, we can draw a different block diagram. Which if everything is at rest, is equivalent to the one that we started with. So what does it look like? It looks like one of these simple feedback loops with a delay and a gain, scaled by 4.5, added to another simple feedback loop with a different gain, scaled by minus 3.5, and then added together.

So are you happy-- is everybody happy with the transformation that got us from this picture to this one? Questions about that? No. OK. Good. So. Here we go. So now what we've seen is that we can do an additive decomposition. We can take this second order system and divide it into the sum of two first order systems.

OK. So now we know that if we put a unit sample into H1, we're going to get back to some geometric sequence, right? That just means it's exponentially growing or decaying possibly with the sign alternating. And if we put the unit sample signal through H2 we're also going to get a geometric sequence, and so the response of this whole thing to the unit sample signal is going to be the sum of 2 geometric sequences. That's the kind of thing that we can understand.

All right. So now here's the other next important thing to remember. This is for the rest of the term, the rest of your life, I don't know, at least the rest of the term. The mode with the biggest base, with the biggest pole, is eventually going to govern the system behavior. So we'll see some examples of that.

So here's the problem we were looking at. So here's a 0.7 to the n. So that's the response of the piece of the system that has a pole of 0.7. So it decays. It decays more quickly than 0.9 to the n. So now if we take 4.5 0.9 to the n and subtract 3.5 0.7 to the n, what happens? Well, at the beginning, the combination of these two signals really matters. But as we go farther and farther out, the 0.7 to the n guy has died away. By stepping, he's almost zero. So by stepping he's not really contributing much to this sum. So eventually, the one with the bigger exponent is going to take over.

So we'll see some more examples of that. Here's one that's much more dramatic and colorful. So here I've got a signal. This one is 0.1 over 1 minus 1.2 to the r. So it has a very small multiplier. At the beginning it's not contributing very much. This one is 200. OK, what's the first sample of this signal? You can't see it from the chart but you could tell me. [? A feet and unit ?] sample signal, what's the first value of the signal this guy generates? 0.1, good. First value of this one? 200. OK. If I add them together, the first value of this signal is 200.1.

OK, so at the beginning this guy with the big multiplier is driving the bus. Right, he's in charge, he's governing the output. We have a really big output value. You see it here. But it falls off very quickly. The pole is 0.5, so each one is half of the previous one. So this signal falls off really fast. This guy meanwhile is gearing up. He's growing very quickly, but with a small multiplier. If you add these two signals together, you get this signal. It started out really high, it fell down, and now it's growing. In the long term, the guy with the small pole has no effect.

STUDENT: Does the magnitude of the pole matter? Or just like, if it's negative, does it make a difference?

PROFESSOR KAELBLING: If it's negative, you would see this-- the big guy, if it's negative, you would see this red guy oscillating back and forth above and below. And that means that eventually you'll see this signal only oscillating back and forth above and below. It's the magnitude that matters. So the pole with the largest magnitude governs long-term behavior. Did I not say that properly? Oh, biggest. Yeah, that was sloppy. OK, I will fix that in the future. I say it much better in some other places. That's right. It's the magnitude of the pole with the biggest magnitude that really matters. We'll call that the dominant pole.

All right. More complicated systems. I'm going to go through this a little bit quickly. Just you need to know that it's possible. So we looked at first order systems and second order systems. Now we'll just, like, open the door and say, all right, whatever kind of system you want. So whatever kind of system I want, we can write it-- the system function this way. That's a general polynomial in the numerator, a general polynomial in the denominator. And we can build a block diagram that makes that where you just read the values in the block diagram directly off these coefficients. Right, this block diagram should make sense.

It says I take X in, I multiply by b0 possibly, and that goes straight through. I also might delay X by 1 and multiply by b1. Delay by 2 and multiply by b2. Delay by as many as you want and multiply by that. There's finite, there's got to only be a finite number of these terms. But that's finite. And then similarly, whatever that value is comes around and that's going to be the output. But then I can delay it and multiply it and send it around, delay it, multiply it and send it around and so on.

So I can build a machine directly by looking at the system function. However, looking at this machine, it doesn't give us very much insight into how it's going to behave. So what can we do? So what can we do to that machine to make it into a machine that we can understand more easily? Well, we can do more of that previous thing we discussed, which is factor the denominator and do partial fraction expansion.

Now with the caveat about complex poles which we're going to get to now in the next section of the lecture, if everything stays real, then we'll get something that looks like this. Where we have a whole bunch of individual little feedbacks here through one delay. And some terms that are just transient, that just depend on the input. And that gives us a general picture that looks like this.

So we can always take a machine that looked like that and turn it into a machine that looks like this. Where we have these simple feedback modes scaled and added up. And notice that these guys don't cascade or anything. This is just sort of like a parallel sum of a whole bunch of individual modes. Plus, some transient dependence is on the input.

And now we really, we're business because we know that each one of these things is going to be a geometric sequence. So the output is going to be the sum of a whole bunch of geometric sequences plus some scaled or delayed copies of the input. Does this make-- OK, conceptually? Questions about this picture?

STUDENT: In the previous picture, we go through so the X value will sometimes go through 2 or 3 delays. So the other picture, you always go through 1 delay.

PROFESSOR KAELBLING: Well, I actually just-- I have some dot dot dots down here. So the X's, we're going to end up with some terms that just go straight through. So-- excuse me?

STUDENT: [INAUDIBLE].

PROFESSOR KAELBLING: That's right. So when I take this thing and I factor it and do [INAUDIBLE] expansion thing, if the numerator is higher order than the denominator, then we'll end up with some of these terms over here that just add in some scaled and delayed copies of the input signal. That's a good point. Other questions?

OK. So now we know-- what do we know? We know that we can-- that the response is going to be the sum of the responses-- the unit sample response is going to be the sum of the unit sample responses of these individual modes. That the response of a mode is an exponential and what matters in governing the behavior of that exponential is the pole.

And we know that the pole with the largest magnitude is eventually going to win the battle of who gets to say what the system is going to do. So the pole with the largest magnitude will govern the long-term behavior of the system. It doesn't matter how many poles there are. The pole with the largest magnitude is eventually going to be the one who says what happens.

OK. So how do we find the poles? This is kind of a decomposition that we're not used to looking at, right? So we have this denominator, 1 minus 1.6r plus 0.063r squared. And we want to get it into a form that looks like this. So we get it into a form that looks like that, then we can read the poles off. And those are the things that are going to tell us how the system behaves.

So it turns out that the way this factors into this kind of an expression is like this. We get 1 minus 0.7r, 1 minus 0.9r. But the question is, algorithmically, how do we find these numbers 0.7 and 0.9 from this polynomial? And there is a cool trick which, when you take 003, you'll learn as the z transform, and the story is very complicated. But the practice of it is very beautiful and very simple.

If we take this polynomial, if we take this expression and we substitute 1 over z in for R, just we're changing variables, 1 over z in for R, and we get this expression, this is just the direct substitution, 1 over z in for R, we now multiply everybody by z squared, and we get this new polynomial ratio now in z. Polynomial ratio in z. And this polynomial now, the denominator, if we factor that in the usual way, if we find the poles-- excuse me, find the roots of this polynomial. The roots of this polynomial in z are 0.7 and 0.9. Using the standard quadratic root finding, or whatever root finding method you want. So the roots of this polynomial in z are the poles of the system.

Now some percentage of the people in this room will go to do this and they won't do the substitution 1 over z, and they'll find the roots of this polynomial and those will not be the poles of the system. So the poles of the system are the roots of the polynomial of the denominator polynomial after you've substituted 1 over z in for R. OK?

OK. We take a deep breath. It's been almost an hour. We have one more hard topic to do. Like, move around or do something. OK. So what's the one more hard topic? Well, the one more hard topic is that as you know, even from negative b plus or minus b squared minus 4ac over 2a is that sometimes you get a complex number out. If you get 1 complex number, you get 2 complex numbers. And so that's going to be an important thing in general, right? They come in pairs.

So what happens if we do this and the roots have imaginary parts? What does it mean to have imaginary roots? It can be especially perturbing to think about imaginary roots, because imaginary roots give us complex poles. But we have these difference equations that have real value coefficients, right? We have things like bank accounts, and the WallFinder, and whatever. The coefficients are real numbers. And yet it may be that the poles are complex. And so first of all, we're going to have to understand what a complex pole could possibly mean. And secondly we're going to have to understand that even though the poles are complex, the response of the system can still just be real.

So we're going to keep it real. All right. So-- oh good, boy, lame jokes, I'm so happy. Lame jokes are all I have, so if you laugh, you just make my day. OK good. OK. So complex numbers. So we all saw this was once upon a time. So let me just talk about another way to think about have another way to think about complex numbers. So first of all, imagine that we start with some pole, p. And it's complex, written a plus jb. j, remember, electrical engineers insist on writing i as j because i means current and that just can't be changed, so a plus jb. So what can you do with a plus jb? Well one thing you can do with it is convert it to polar coordinates, right?

So you can think of it as a point in the complex plane. So the a is the real part, b is the imaginary part, this is the point ab. You can think of it instead as r omega, where omega is the angle and r is the magnitude. Square root of a squared plus b squared. So here we get r and omega. So that's another way to think about this point in the complex plane.

OK. Then what we can do is, and again we're not going to derive this one, although it's not hard, you could go read about it. It comes from series expansions, the Euler's equation is a beautiful thing. You can-- there's an interpretation of exponentiation. Exponentiation as-- we can take this number, right? r cos omega plus j sin omega, and that is equivalent to saying re to the j omega. So raising e to an imaginary power omega.

And there's some stuff in the notes that works through this more slowly. For now, I'm just going to ask you to kind of come along. You could do some substitutions and kind of comfort yourself to see that you get back the thing that you started with. So maybe that's OK on this side. But anyway, this is the important relationship.

So this now gives us a really different way of representing a complex number. We put the magnitude out here. Magnitude times e raised to the power of j angle. Magnitude e to the j angle is what we have. OK. This is a really different representation from a plus jb. It's multiplicative. What's important about it is that it's multiplicative, right? Here we have 2 pieces of the complex number which we add up. Here we have 2 pieces of the complex number which we do different things to when we multiply.

The reason that we care about this is that we're going to be looking at infinite-- we're going to be looking at exponential series at the pole raised to higher and higher powers. And so if we have a complex pole like a plus jb and we think about taking a plus jb and raising it to the 10th power. Just think of the pages of multiplication that you would get if you did that, right? There's nothing nice about taking a plus jb to the 10th. It just multiplies out.

On the other hand, if you have something multiplicative and you raise it to a power, good stuff happens. It doesn't grow crazily in representation. So if we take re to the j omega and raise it to the power n, we get r to the n, e to the j n omega. Is that OK with everybody? OK.

So what is that? So this is a representation of a complex number. This is a representation of a complex number. This new complex number has a magnitude which is exponentially bigger than the magnitude of the first one.

So for instance, it's always good to think of the case of the complex number where b is 0. Let's think about that just for a minute, right? If b is 0, then r is equal to a. You buy that? Right? If b is 0, r is a. Right? That's the real part. And if b is 0, omega is 0. Or 2 pi. 0 is good. Let's think of it as 0. Omega 0. So this guy turns into 1. So everything's-- in our normal case, right, if there's no imaginary part, if it's just a real number, then when we take this and exponentiate it, we just get r to the n. So that's good, right? We used to have a, now we've got a to the n.

But what happens-- how do we think about this, in particular about the series of complex numbers we get, as we raise them to higher and higher powers? Well we see that the magnitude goes exponentially, and the angle goes linearly. Right, so this is the angle. And every time we increment n, the angle increments by omega. So now we get to make some cool pictures. Actually I'm going to do this one-- well, I'll show you, and then I'll do it on the board.

All right. So remember that we can take this mode and think of it as a geometric series where we raise the pole to higher and higher powers. And we can express the pole as re to the j omega. Then we can substitute that in and we get 1 plus re to the j omega delayed by 1 plus r squared e to the j2 omega delayed by 2, r cubed ej to the 3 omega delayed by 3 and so on. So what's this series going to look like? It's hard to draw. I need 3 dimensions to draw it. But I will just illustrate it for you in time. Someone could do an interpretive dance.

So here's the real imaginary-- so imagine that we start out here with the unit sample. So what we're going to do is think about the response of that pole to the unit sample signal. So what's the first output for the unit sample signal? 1. It's still 1. It's always 1. It's been 1. 1 comes in here, 1 flies out there, 1 on this picture is, let's say, there. 1.

Now let's take a case-- so here, omega is pi over 4. OK. So now when we look at the next sample, it's going to be 0.85e to the j pi over 4. OK. So that means the angle's going to be pi over 4, and the magnitude is going to be 0.85. So it's going to be-- I'm going to draw some-- OK. So this is going to be the angle, and it's going to be sort of shorter, right?

Now when it-- oh, pi over 4, oh good. I did pi over 8. Thank you. And that makes my drawing task easier, too. Good, OK. So pi over 4, smaller magnitude. Excellent. Good. Pi over 4, smaller magnitude.

Now at the next increment, the magnitude is going to be 0.85 squared. And the angle is going to be pi over 2. So here's pi over 2, but sort of shorter, and then 3 pi over 2, but sort of shorter, and here, and here, and here, and here, and here and we get like this nice nautilus shell in time.

So I can't draw just one real output as a function of time the way we normally draw signals. This is a signal, but it's a signal that's living in the complex plane. So time-- there's a picture in the notes where I have time kind of growing out of the page. As well as I can make it grow out of the page. OK, does the snail shell make sense to you, this picture? OK. So that's the sequence that we get that's the response of this mode with a complex pole to the unit sample signal.

So magnitude of samples is a geometric sequence with the ratio being the magnitude of the pole. It's not the real part, it's the magnitude, right? Which is the real part squared-- the root of the real part squared plus the imaginary part squared. The angle grows linearly with time, and we can now think of the period of this signal as 2 pi over omega. That's sort of how many samples it takes to get back to where it started.

OK. So this was the snail shell that we just looked at. Oh, no it's a different one. It's pi over 8. OK, good. So this one has period-- I mean this one has omega pi over 8. That was the one I started to draw on the board. Omega pi over 8 means that we get 16 samples before we go all the way around. So it's going around more slowly and the base is pointing at 5.

Here's one where it's still pi over 8 but now the base is 1.1. So what's interesting-- the most interesting feature of these two plots is the axes. So this one started at 1. This one also started at 1 which is somewhere over here. And it's growing like crazy. So this is 10,000. So this is growing exponentially in magnitude. Going around at the same rate but growing in magnitude. This one's going around at the same rate but shrinking in magnitude. It's tempting to see one going around in the other direction, but no. They're all going around this way. It's just whether they're growing or increasing as they go around that way.

We're not going to do this but whatever polynomial you have, if you factor it, the roots if they're going to be complex come in conjugate pairs. So a plus and minus bj. OK. Why do we care about that? Let's look at a simple case. OK. So I said the one thing that-- that there were two important things about complex roots. One is how do they behave? So here's an idea about how they behave.

Another one is how is it that we can have somehow systems with real valued coefficients and real valued outputs, but we have this complex number stuff going on inside? And the answer is that stuff cancels. So if you have a pair-- a conjugate pair of complex poles, so let's just look at a second order system with a conjugate pair of complex poles. So we have 1 minus re to the j omega R and 1 minus re to the minus j omega R. Because r, the magnitude, the little r, the magnitude is the same in both cases. It's just that the angle's different. So it's one steps around one way, the other one steps around the other way.

But if you just multiply this all out you will find that the complex parts cancel. No, that's not right. I shouldn't say that the complex parts cancel. The I's cancel. So in the end we're not left with any complex parts. The complex parts here matter. I mean the imaginary parts matter. The imaginary parts contribute to the answer here. But there is no j left in the expression once we work it all the way out. So that's another one you could do on your time if you want to.

OK. So let's just understand how, again, how complex modes can give us real results. So here's one complex mode. It's the one that starts at 1 and it's decaying very nicely around like this. Its conjugate looks like this. It starts at 1. It goes around at the same rate, but in the other direction. And it decays at the same rate. So if you take those two guys and add them together, what happens?

So let's just kind of watch it on the real line, right? So first of all, you can see that when you add this guy plus this guy, the imaginary part goes away, right? Add these two guys and you get a point on the axis right here. Add these two guys and you get a point on the axis. So the sum of the blue signal and the red signal is going to be real.

Now what's its projection onto the real axis going to be like over time, right? We're going to get-- do I have that picture? I do. It's not very helpful. OK. We'll stick with this one. OK. So we start here. If we add the red point and the blue point, in fact we'll get out the value 2, right? Because the response of this guy is 1, the response of that guy is 1, the output will be 2. But as we add these guys together, the real parts are getting smaller, right?

So in fact as time passes it's becoming less real and more complex, more imaginary, less real and more imaginary as we go this way, as we go out here. And then the real part gets negative, because again as we are adding the blues and reds everything's projecting down on the axis.

So over time we're moving this way until we get out here. And then as time passes we move in here, and as time passes we move here and here and here and here and here. Right? So the projection onto the real axis is oscillating. But you need to look at the axis going this way. It's hard to see in this picture.

STUDENT: We're adding and not multiplying, because it's [INAUDIBLE] signal composition.

PROFESSOR KAELBLING: We did the additive decomposition-- remember that we did this partial fraction expansion thing. So we know-- you're right, that the denominators is factored, but we know using partial fraction expansion that there's some stuff that we can put in the numerator. It will be complex in general also, but it will also cancel in the ways that we need for it to cancel.

STUDENT: Right, but like in our actual formula, it's p times the conjugate of p, not p plus the conjugate of p, right?

PROFESSOR KAELBLING: No, in what we're going to get is-- we're going to get-- so let's just look at the top two pieces here. So we'll get p and the conjugate of p, right? So, that's right. So the additive decomposition still works even if it's a complex pole. Good.

OK. So this signal is going to go in time back and forth on the real line. It's the sum of two things that are moving around on the complex plane but if you add them together it just moves on the real line. How are we doing for time? We're not too good. OK. I'm going to keep going just so that I can say the last couple things. You can work through these things and let us know on Piazza if you have questions. OK. Because I just want to be sure that we get this review burned into our head.

OK. So what we've seen is that all LTI systems can first of all be described in that top form. We knew that already. We can convert it to the bottom form. That lets us convert it to a system function. And through the additive decomposition we can describe it as the sum of the responses of a bunch of these simple modes plus some delayed copies of the input. And we can take this version, this way of representing the pole as re to the j omega, another way of representing a complex number, which of course represents real numbers, too, it's just that the omega is 0. Then we can get this. This is the unit sample response.

And furthermore we're going to define the dominant pole to be the pole with the largest magnitude. So we're going to let p star be the pole with the largest magnitude. Now magnitude, because p could be complex, we have to take potentially the complex magnitude, the pole with the largest magnitude.

Now the question is what do we know? If we do all this algebra, we take our thing, we find the system function, we find the poles, we figure out which pole has the biggest magnitude, now what do we know? So this is the takeaway of all this. What do we know once we have in our hand the pole with the largest magnitude?

So if the pole with the largest magnitude is 0, then Y-- So Y is the response to the unit sample signal of the system H. Then if the biggest pole is 0 then it's transient. We talked about that already. OK. But now there's two kinds of things that we want to think about. We want to think about whether the system is going to converge to a value and if so, how? Or if not, how is it not going to do it?

So first let's think about convergence. So if the magnitude of the dominant pole is less than 1, no matter whether it's negative or imaginary or complex, whatever it is, if its magnitude is less than 1, then the unit sample response will be converging. So that means that there's-- you can think of it as an envelope through which the signal won't exceed and that envelope goes exponentially.

So what do I mean? It might be that we end up with a unit sample response that looks like this. Here's one we know about. This is what we get-- what do we know about the magnitude of the pole of a system that looks like this? That's not so good. OK. Magnitude of the pole? Less than 1. Good. What else do we know about that pole? It's negative. OK, good.

So here's another one. Starts at 1. I don't know. So like this, roughly. So this is now just an exercise in sort of approximation. Signal like that. What do you suppose the pole is like? Is it-- magnitude? That's not a very good [INAUDIBLE]. The magnitude is going to be less than 1. So we're going to say it's convergent. And it's going to be that it's kind of oscillating up and down because there's this extra rotational business going on. It's going to be-- so it's going to be that the poles are complex and their projection onto the real line when we add up the responses from two of those poles is going to go back and forth. So that going back and forth when we added up the two nautilus shells, that going back and forth corresponds to getting smaller, going negative, coming up and going down and so on. But if the magnitude of the pole is less than 1, then the magnitude of those guys is going to be shrinking as it goes around.

So there's going to be an envelope like this, which is exponentially decreasing from above and below, and if you can promise that your signal stays inside there, we'll say that it's convergent. So that's one of the caveats here. So we might not be able to say, oh yeah, the signal value goes down exponentially, or it goes down monotonically, because of the fact that it gets kind of confused by the fact that we also have this rotational thing going on. So that's one piece of care that we have to take when we talk about convergence.

Another one is that of course our systems might be the sum of a whole bunch of individual modes. And each of those modes generates some exponential response. It might be like that one, oscillating, it might just grow, it might just shrink. We know that it's the mode with the biggest-- the pole with the biggest magnitude that governs what's going on. But it might not take charge until some particular time, t. Because as we saw in the example, there was something with a really big-- something that decayed quickly but had a big initial constant. So it was in charge at the beginning. But what we can say is for any system, there is some time, some finite time t, after which these properties of the behavior of the dominant pole will actually govern what the signal does.

The other guys are still added in there. It's not like they're not making contribution. But they're no longer able to change the main character of what's happening. So the magnitude of the pole governs whether it's going to converge or diverge. Magnitude of the dominant pole governs convergence or divergence.

The second feature is how does the period of the signal depend on the pole? So again let's-- this turns out not to be a special case, right? So sometimes we can think of, well, we have positive poles and negative poles and complex poles. But positive poles and negative poles are complex poles, too. So we can just think about it that way. So here we have a complex pole and if the imaginary part is 0, and a is positive, then you can think about omega as being either 2 pi or 0, as you wish. So you can think about it going all the way around in one sample. So it's always out there on the real axis no matter what. So that's like-- here we're stepping around in pi over [? step ?], so pi over 4. If the imaginary part is 0, then we're stepping around 2 pi on each step.

If the real part is negative and the imaginary part is 0, how far do we step on each step? Pi, right? You can think of-- what gives rise to something that looks like this is a pole whose magnitude is shrinking exponentially. But the sign is alternating. You can think of that as going around the circle in steps of pi. So first it's here, and then it's here, and then it's here, and then it's here, and it goes like this. So this picture corresponds to getting a signal like this out. So negative pole is no different than complex pole. We handle it the same way. Just think of it as stepping halfway around the circle each time.

OK. Then let's see. OK. So if it's not complex, if there's no imaginary part, if the real part is positive, then it's either going to increase monotonically or decrease monotonically. If there's no imaginary part and the real part is negative, then it's going to alternate signs, but again for that reason. And otherwise it's going to oscillate with a period of 2 pi over omega.

Now a bunch of people could complain a lot about what does period mean because things here are discreet and so on, just it's going to help you give intuition about what's going on with these signals and we can talk about some stuff precisely. Period is a little funny, but we'll define it to be 2 pi over omega. Even though it may never exactly get back to where it came from.

OK. So this week in software lab, we're going to build a class for manipulating system functions and then we're going to apply what we've learned about analysis to the actual robot in design lab.