Example: Modeling the Bus Suspension System using State Space
State space equation
Entering equations into MATLAB
Open-loop response

State Space Equation:

The state-space representation of a system is usually much easier to derive from the differential equations than Laplace transform method. Difficulties arise when the derivatives of the inputs appear in the differential equations, and this situation occurs here, which leads to a lot of algebra. The dynamic equations of the bus and suspension mass are:


To be a valid state-space representation, the derivative of all states must be in terms of inputs and the states themselves. At the moment we have not even determined what are good states to use. To begin, divide the first and second equations by M1 and M2 respectively. Note appears in the equation for .


The first state will be X1. Since no input derivatives appear in the equation for , choose the second state to be . We then choose the third state to be the difference between X1 and X2. After doing some algebra, we will determine what the fourth state should be. So we substitute the third state, Y1 = X1-X2, in the above equations:


Subtract the second equation from the first equation to get an expression for :

Since we cannot use second derivatives in the state-space representation, we integrate this equation to get :

No derivatives of the input appear in this equation, and is expressed in terms of states and inputs only (since X2 = X1-Y1), except for the integral. Call the integral Y2. The state equation for Y2 is:

Substitute X2 = X1-Y1 in to get the state equation for Y1:

Then substitute the derivative of Y1 into the equation of the derivative of X1 :

The state variab are X1,,Y1, and Y2. The matrix form of the above equations is.


The method used to find the state-space for this problem is an integral method, which was tricking. For most problems, however the state-space method is much easier than the Laplace transform method. ATLAB>

Entering equations into MATLAB

We can put the above space-form equations into MATLAB by defining the four matrices, A, B, C, and D, of the standard state-space equation


Now, let's create a new m-file and enter the following code:

Open-loop response

We can use MATLAB to display how the original open-loop system performs(without any feedback control). Add the following command into the m-file and run it in the MATLAB command window to see the response for unit step actuated force input and the response to a 0.1 m high step disturbance input.

From this graph of open-loop response for unit step actuated force, we can see that the system is under-damped, when the unit step actuated force is applied. People sitting in the bus will feel a very small amount of oscillation and the steady-state error is about 0.013 mm. Moreover, the bus takes an unacceptably long time to reach the steady state. The solution to this problem is to add a feedback controller into the system's block diagram.

Note that the B matrix has been multiplied by 0.1 to simulate a 10 cm high step.

To see some details, you can change the axis:

From this figure we see that when the bus passes a 10 cm bump on the road, the bus body will oscillate for an unacceptably long time. People sitting in the bus will not be comfortable with such an oscillation. The big overshoot (from the impact itself) and the slow settling time will cause damage to the suspension system. The solution to this problem is to add a feedback controller into the system to improve the performance. The schematic of the closed-loop system is the following:


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

Bus Suspension Examples
Modeling | PID | Root Locus | Frequency Response | State Space | Digital | Simulink

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