# State Space, Part 2: Pole Placement

From the series: State Space

In this video, we’re going to talk about a way to develop a feedback controller for a model that’s represented using state-space equations. And we’re going to do that with a method called pole placement, or full state feedback. Now, my experience is that pole placement itself isn’t used extensively in industry; you might find that you’re using other methods like LQR or H infinity more often. However, pole placement is worth spending some time on because it’ll give you a better understanding of the general approach to feedback control using state-space equations and it’s a stepping stone to getting to those other methods. So I hope you stick around. I’m Brian, and welcome to a MATLAB Tech Talk.

To start off, we have a plant with inputs u and outputs y. And the goal is to develop a feedback control system that drives the output to some desired value. A way you might be familiar with doing this is to compare the output to a reference signal to get the control error. Then you develop a controller that uses that error term to generate the input signals into the plant with the goal of driving the error to zero. This is the structure of the feedback system that you’d see if you were developing, say, a PID controller.

But for pole placement, we’re going to approach this problem in a different way. Rather than feed back the output y, we’re going to feed back the value of every state variable in our state vector, x. We’re going to claim that we know the value of every state even though it’s not necessarily part of the output y. We’ll get to that in a bit, but for now, assume we have access to all of these values. We then take the state vector and multiply it by a matrix that is made up of a bunch of different gain values. The result is subtracted from a scaled reference signal, and this result is fed directly into our plant as the input.

Now you’ll notice that there isn’t a block here labeled “controller” like we have in the top block diagram. In this feedback structure, this whole section is the controller. And pole placement is a method by which we can calculate the proper gain matrix to guarantee system stability, and the scaling term on the reference is used to ensure that steady state error performance is acceptable. I’ll cover both of these in this video.

In the last video, we introduced the state equation x dot = Ax + Bu. And we showed that the dynamics of a linear system are captured in this first part, Ax. The second part is how the system responds to inputs, but how the energy in the system is stored and moves is captured by the Ax term. So you might expect that there is something special about the A matrix when it comes to controller design. And there is: Any feedback controller has to modify the A matrix in order to change the dynamics of the system. This is especially true when it comes to stability.

The eigenvalues of the A matrix are the poles of the system, and the location of the poles dictates stability of a linear system. And that’s the key to pole placement: Generate the required closed-loop stability by moving the poles or the eigenvalues of the closed-loop A matrix.

I want to expand a bit more on the relationship between poles, eigenvalues, and stability before we go any further because I think it’ll help you understand exactly how pole placement works.

For this example, let’s just start with an arbitrary system and focus on the dynamics, the A matrix. We can rewrite this in non-matrix form so it’s a little bit easier to see how the state derivatives relate to the states. In general, each state can change as a function of the other states. And that’s the case here; x dot 1 changes based on x2 and x dot 2 changes based on both x1 and x2. This is perfectly acceptable, but it makes it hard to visualize how eigenvalues are contributing to the overall dynamics. So what we can do is transform the A matrix into one that uses a different set of state variables to describe the system.

This transformation is accomplished using a transform matrix whose columns are the eigenvectors of the A matrix. What we end up with after the transformation is a modified A matrix consisting of the complex eigenvalues along the diagonal and zeroes everywhere else. These two models represent the same system. They have the same eigenvalues, the same dynamics; it’s just the second one is described using a set of state variables that change independently of each other.

With the A matrix written in diagonal form, it’s easy to see that we’re left with a set of first-order differential equations where the derivative of each state is only affected by that state and nothing else. And here’s the cool part: The solution to a differential equation like this is in the form Z = a constant times e ^ lambda t. Where lambda is the eigenvalue for that given state variable.

Okay, let’s dive into this equation a little bit more. Zn shows how the state changes over time given some initial condition, C. Or another way of thinking about this is that if you initialize the state with some energy, this equation shows what happens to that energy over time. And by changing lambda, you can affect how the energy is dissipated or, in the case of an unstable system, how the energy grows.

Let’s go through a few different values of lambda so you can visually see how energy changes based on the location of the eigenvalue within the complex plane.

If lambda is a negative real number, then this mode is stable since the solution is e raised to a negative number, and any initial energy will dissipate over time. If it’s positive, then it’s unstable because the energy will grow over time. And if there is a pair of imaginary eigenvalues, then the energy in the mode will oscillate, since e ^ imaginary number produces sines and cosines. And any combination of real and imaginary numbers in the eigenvalue will produce a combination of oscillations and exponential energy dissipation.

I know this was all very fast, but hopefully it made enough sense that now we can state the problem we’re trying to solve. If our plant has eigenvalues that are at undesirable locations in the complex plane, then we can use pole placement to move them somewhere else. Certainly if they’re in the right half plane it’s undesirable since they’d be unstable, but undesirable could also mean there are oscillations that you want to get rid of, or maybe just speed up or slow down the dissipation of energy in a particular mode.

With that behind us, we can now get into how pole placement moves the eigenvalues. Remember the structure of the controller that we drew at the beginning? This results in an input u = r*Kr - k*x. Where r Kr is the scaled reference, which again we’ll get to in a bit. And kx is the state vector that we’re feeding back multiplied by the gain matrix.

Here’s where the magic happens. If we plug this control input into our state equation, we are closing the loop and we get the following state equation: Notice that A and -Bk both act on the state vector so we can combine them to get modified A matrix.

This is the closed-loop A matrix and we have the ability to move the eigenvalues by choosing an appropriate K. And this is easy to do by hand for simple systems. Let’s try an example with a second-order system with a single input. We can find the eigenvalues by setting the determinant of A - lambda I to zero and then solve for lambda. And they are at -2 and +1. One of the modes will blow up to infinity because of the presence of the positive real eigenvalue and so the system is unstable. Let's use pole placement to design a feedback controller that will stabilize this system by moving the unstable pole to the left half plane.

Our closed-loop A matrix is A - BK and the gain matrix, k, is 1x2 since there is one output and two states. This results in - K1, 1 - k2, 2 and -1. We can solve for the eigenvalues of Acl like we did before and we get this characteristic equation that is a function of our two gain values.

Let’s say we want our closed-loop poles at -1 and -2. In this way, the characteristic equation needs to be L^2 + 3L + 2 = 0. So at this point, it’s straightforward to find the appropriate K1 and K2 that make these two equations equal. We just set the coefficients equal to each other and solve. And we get K1 = 2, and K2 = 1 and that’s it. If we place these two gains in the state feedback path of this system, it will be stabilized with eigenvalues at -1 and -2.

Walking through an example by hand, I think, gives you a good understanding of pole placement; however, the math involved starts to become overwhelming for systems that have more than two states. The idea is the same; just solving the determinant becomes impractical. But we can do this exact same thing in MATLAB with pretty much a single command.

I’ll show you quickly how to use the place command in MATLAB by recreating the same system we did by hand. I’ll define the four matrices, and then create the open-loop state-space object. I can check the eigenvalues of the open-loop A matrix just to show you that there is, in fact, that positive eigenvalue that causes this system to be unstable.

That’s no good, so let’s move the eigenvalues of the system to -2 and -1. Now solving for the gain matrix using pole placement can be done with the place command. And we get gain values 2 and 1 like we expected.

Now the new closed-loop A matrix is A - BK, and just to double check, this is what Acl looks like and it does have eigenvalues at -1 and -2. Okay, I’ll create the closed-loop system object and now we can compare the step responses for both.

The step response of the open-loop system is predictably unstable. The step response of the closed-loop system looks much better. However, it’s not perfect. Rather than rising to 1 like we’d expect, the steady state output is only 0.5. And this is finally where the scaling on the reference comes in. So far, we’ve only been concerned with stability and have paid little attention to steady state performance. But even addressing this is pretty straightforward. If the response to the input is only half of what you expect, why don’t we just double the input? And that’s what we do. Well, not double it, but we scale the input by the inverse of the steady state value.

In MATLAB, we can do this by inverting the DC gain of the system. You can see that the DC gain is 0.5, and so the inverse is 2. Now we can rebuild our closed-loop system by scaling the input by Kr. and checking the step response. No surprise; its steady state value is 1.

And that’s pretty much what there is to basic pole placement. We feed back every state variable and multiply them by a gain matrix in such a way that moves the closed-loop eigenvalues, and then we scale the reference signal so that the steady state output is what we want.

Of course, there’s more to pole placement than what I could cover in this 12-minute video, and I don’t want to drag this on too long, but I also don’t want to leave this video without addressing a few more interesting things for you to consider. So in the interest of time, let’s blast through these final thoughts lightning-round style. Are you ready? Let’s go!

Pole placement is like fancy root locus. With root locus you have one gain that you can adjust that can only move to the poles along the locus lines. But with pole placement, we have a gain matrix that gives us the ability to move the poles anywhere in the complex plane, not just along single-dimensional lines.

A two-state pole placement controller is very similar to a PD controller. With PD, you feed back the output and generate the derivative within the controller. With pole placement, you are feeding back the derivative as a state, but the results are essentially the same: 2 gains, one for a state and one for its derivative.

Okay, we can move eigenvalues around, but where should we place them? The answer to that is a much longer video, but here are some things to think about. If you have a high-order system, consider keeping two poles much closer to the imaginary axis than the others so that the system will behave like a common second-order system. These are called the dominant poles since they are slower and tend to dominate the response of the system.

Keep in mind that if you try to move a bunch of eigenvalues really far left in order to get a super-fast response, you may find that you don’t have the speed or authority in your actuators to generate the necessary response. This is because it takes more gain, or more actuator effort, to move the eigenvalues further from their open-loop starting points.

Full state feedback is a bit of a misnomer. You are feedback every state in your mathematical model, but you don’t, and can’t, feed back every state in a real system. For just one example, at some level, all mechanical hardware is flexible, which means additional states, but you may choose to ignore those states in your model and develop your feedback controller assuming a rigid system. The important part is that you feed back all critical states to your design so that your controller will still work on the real hardware.

You have to have some kind of access to all of the critical states in order to feed them back. The output, y, might include every state, in which case you’re all set. However, if this isn’t the case, you will either need to add more sensors to your system to measure the missing states or use the existing outputs to estimate or observe the states you aren’t measuring directly. In order to observe your system, it needs to be observable, and similarly, in order to control your system it needs to controllable. We’ll talk about both of those concepts in the next video.

So that’s it for now. I hope these final few thoughts helped you understand a little more about what it means to do pole placement and how it’s part of an overall control architecture.

If you want some additional information, there are a few links in the description that are worth checking out that explain more about using pole placement with MATLAB.

If you don’t want to miss the next Tech Talk video, don’t forget to subscribe to this channel. Also, if you want to check out my channel, control system lectures, I cover more control theory topics there as well. Thanks for watching. I’ll see you next time.