Example: Solution to the Cruise Control Problem Using State Space

The state equations for this problem are:

where

• m=1000 kg
• b=50 N*sec/kg
• u=500 N
• v=velocity
• y=output

The design criteria are:

Rise time < 5 sec
Overshoot < 10%

To see the original problem setup , see Cruise Control Modeling page.

## Control design using pole placement

The schematic of a full-state feedback system is shown below.

where

• K=Control matrix
• U=-Kv=input
• R=Reference

Recall from the State-Space Tutorial page, we should use the technique called "pole placement" to obtain the desired output. Poles of a closed-loop system can be found from the characteristic equation: the determinate of [sI-(A-B*K)] matrix. If desired poles can be placed into the system by designing right control matrix (K), then the desired output can be obtained. In this tutorial, poles will be chosen first, then use MATLAB to find the corresponding control matrix (K).

Now, we need to determine where to place poles for our system. Since our [sI-(A-B*K)] matrix is 1x1, we have only one pole to place. Let the pole to be at -1.5 (arbitrary). Just as in the State-Space Tutorial, the MATLAB function called place will be used to find the control matrix K . Create an new m-file and enter the following commands.

```m = 1000;
b = 50;
t = 0:0.1:10;
u = 500*ones(size(t));

A = [-b/m];
B = [1/m];
C = [1];
D = [0];
cruise = ss(A,B,C,D);

x0 = [0];

p1 = -1.5;

K=place(A,B,[p1])

sys_cl=ss(A-B*K,B,C,D);
lsim(sys_cl,u,t,x0);

```
Running this m-file in the MATLAB command window should give you the control matrix and the following step response.

As you can see, the rise time is satisfactory, but the steady-state error is too large.

## Reference input

Once again from the State-Space Tutorial, a scaling factor called Nbar (the schematic is shown below) should be used to eliminate the steady-state error. We can use the rscale function to compute the scaling factor. The input is already multiplied by 500, and we want the steady-state speed to be 10 m/sec, so we need to account for these factors as well.

Copy the following commands to an m-file and run it in the MATLAB command window. You should get the step response shown below.

```m=1000;
b=50;
t=0:0.1:10;
u=500*ones(size(t));

A=[-b/m];
B=[1/m];
C=[1];
D=[0];

x0=[0];

p1=-1.5

K=place(A,B,[p1]);

Nbar=rscale(cruise,k)*10/500;
sys_cl=ss(A-B*K,B*Nbar,C,D);

lsim(sys_cl,u,t,x0);
```

As you can see, the steady-state error has been eliminated. The rise time is less than 5 seconds and the overshoot is, in fact, zero. All the design requirements are satisfied.

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

Cruise Control Examples
Modeling | PID | Root Locus | Frequency Response | State Space | Digital Control | Simulink

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