CMU
UM


Example: A State-Space Controller for DC Motor Speed

Designing the full-state feedback controller
Adding a reference input

From the main problem, the dynamic equations in state-space form are the following:

For the original problem setup and the derivation of the above equations, please refer to the Modeling a DC Motor page.

With a 1 rad/sec reference added to the system, the design criteria are:

Create a new m-file and type in the following commands (refer to the main problem for the details of getting these commands).

Designing the full-state feedback controller

Since both of the state variables in our problem are very easy to measure (simply add an ammeter for current and a tachometer for the speed), we can design a full-state feedback controller for the system without worrying about having to add an observer. The schematic for a full-state feedback system is:


Recall that the characteristic polynomial for this closed-loop system is the determinant of (sI-(A-BK)) where s is the Laplace variable. Since the matrices A and B*K are both 2x2 matrices, there should be 2 poles for the system. By designing a full-state feedback controller, we can move these two poles anywhere we want them. We shall first try to place them at -5 + i and -5-i (note that this corresponds to a zeta = 0.98 which gives 0.1% overshoot and a sigma = 5 which leads to a 1 sec settling time). Once we come up with the poles we want, Matlab will find the controller matrix,K, for us. Simply add the following code to the end of your m-file : Now look at the schematic above again. We see that after adding the K matrix into the system, the state-space equations become:


We can see the closed-loop response by simply adding the following line to the end of your m-file: Run your m-file in the command window, You should see the following plot:

Adding a reference input

From this plot we see that the steady-state error is too large. In contrast to the other design methods, where we feed back the output and compare it to the reference to compute an error, here we are feeding back both states. We need to compute what the steady-state value of the states should be, multiply that by the chosen gain K, and use this new value as our reference for computing the input. This can be done in one step by adding a constant gain Nbar after the reference:


We can find this Nbar factor by using the Matlab command rscale: Note that the function rscale is not a standard function in Matlab. You will have to copy it before you use it. Click here for more information. Now we can plot the step response by adding the following line of code to your m-file:

This time, the steady-state error is much less than 1%, and all the other design criteria have been met as well.


User feedback

We would like to hear about suggestions you have for improvement, difficulties you had with the tutorials, errors that you found, or any other comments that you have. This feedback is anonymous.


State Space Examples
Cruise Control | Motor Speed | Motor Position | Bus Suspension | Inverted Pendulum | Pitch Controller | Ball and Beam

Motor Speed Examples
Modeling | PID | Root Locus | Frequency Response | State Space | Digital Control: PID

Tutorials
Basics | Modeling | PID | Root Locus | Frequency Response | State Space | Digital Control | Examples

8/28/1996 YS
8/24/97 WM