No history yet

State-Space Representation

Beyond the Black Box

So far, you've likely used transfer functions to model systems. They're powerful tools, giving a direct relationship between a single input and a single output. A system is treated like a black box; you put something in, and the transfer function tells you what comes out. This works well for many simple systems.

But what about more complex scenarios? Consider a modern drone. It has multiple inputs (the thrust of each of its four motors) and multiple outputs (its position, orientation, and velocity in 3D space). This is a Multi-Input Multi-Output (MIMO) system. Trying to describe it with a single transfer function is cumbersome and often impractical. More importantly, a transfer function doesn't tell us what's happening inside the system. It hides the internal workings.

State-space representation offers a more detailed and flexible approach. Instead of just modeling the input-output relationship, it models the internal state of the system itself. This allows us to handle complex MIMO systems and gives us a clearer picture of the system's dynamics.

Defining the State

The core of this method is the concept of state variables. A set of state variables is the smallest possible group of variables that, along with the system's inputs, can completely describe the future behavior of the system. Think of them as a snapshot of the system's internal energy-storing elements at a specific moment.

Let's take a classic mechanical example: a mass-spring-damper system. The energy in this system is stored in two ways: as potential energy in the compressed or stretched spring, and as kinetic energy in the moving mass. The state of this system can be fully described by two variables: the position of the mass, y(t)y(t), and the velocity of the mass, y˙(t)\dot{y}(t). Knowing just these two values at any given time, plus any external force being applied, is enough to predict the mass's future motion.

Lesson image

We group these state variables into a single column vector called the state vector, denoted as x\mathbf{x}. For our example, the state vector would be:

x(t)=[y(t)y˙(t)]\mathbf{x}(t) = \begin{bmatrix} y(t) \\ \dot{y}(t) \end{bmatrix}

The Standard Form

State-space models are universally expressed with a pair of equations. These equations describe how the state vector and the output evolve over time.

The first equation, called the state equation, describes the system's dynamics. The second, the output equation, relates the internal state to the measurable output.

x˙=Ax+Bu\dot{\mathbf{x}} = A\mathbf{x} + B\mathbf{u}
y=Cx+Du\mathbf{y} = C\mathbf{x} + D\mathbf{u}

These four matrices, A, B, C, and D, define the entire system. Let's break down what each one does:

  • A: The System Matrix. This matrix describes the internal dynamics of the system. If there were no external inputs (u=0\mathbf{u}=0), the states would evolve according to x˙=Ax\dot{\mathbf{x}} = A\mathbf{x}. It shows how the state variables are coupled and how they change on their own.

  • B: The Input Matrix. This matrix determines how the inputs affect the state variables. It acts as a bridge, mapping the external forces or signals in u\mathbf{u} to changes in the internal state x\mathbf{x}.

  • C: The Output Matrix. Often, we can't directly measure every state variable. The output matrix defines what we can measure. It selects or combines state variables to form the output vector y\mathbf{y}.

  • D: The Feedforward Matrix. This matrix represents a direct path from the input to the output, bypassing the system's internal dynamics. In many physical systems, especially mechanical ones, this matrix is zero, meaning the input must first affect the state before it can influence the output.

From Equations to Matrices

Let's convert our mass-spring-damper system into state-space form. Newton's second law gives us the governing differential equation, where f(t)f(t) is the input force:

my¨+cy˙+ky=f(t)m\ddot{y} + c\dot{y} + ky = f(t)

To get this into state-space form, which uses first-order equations, we first isolate the highest derivative:

y¨=1mf(t)cmy˙kmy\ddot{y} = \frac{1}{m}f(t) - \frac{c}{m}\dot{y} - \frac{k}{m}y

Now, we define our state variables, as we did before: x1=yx_1 = y and x2=y˙x_2 = \dot{y}. We need to find expressions for their derivatives, x˙1\dot{x}_1 and x˙2\dot{x}_2. The first one is simple:

x˙1=ddt(y)=y˙=x2\dot{x}_1 = \frac{d}{dt}(y) = \dot{y} = x_2

For the second, we use our rearranged differential equation:

x˙2=ddt(y˙)=y¨=kmx1cmx2+1mf(t)\dot{x}_2 = \frac{d}{dt}(\dot{y}) = \ddot{y} = -\frac{k}{m}x_1 - \frac{c}{m}x_2 + \frac{1}{m}f(t)

We now have our set of first-order differential equations. We can write them in matrix form x˙=Ax+Bu\dot{\mathbf{x}} = A\mathbf{x} + B\mathbf{u}:

[x˙1x˙2]=[01kmcm][x1x2]+[01m]f(t)\begin{bmatrix} \dot{x}_1 \\ \dot{x}_2 \end{bmatrix} = \begin{bmatrix} 0 & 1 \\ -\frac{k}{m} & -\frac{c}{m} \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} + \begin{bmatrix} 0 \\ \frac{1}{m} \end{bmatrix} f(t)

Finally, let's say we're interested in measuring the position of the mass as our output. This means our output equation is simply yout=x1y_{out} = x_1. In matrix form, y=Cx+Du\mathbf{y} = C\mathbf{x} + D\mathbf{u}, this becomes:

yout=[10][x1x2]+[0]f(t)y_{out} = \begin{bmatrix} 1 & 0 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} + \begin{bmatrix} 0 \end{bmatrix} f(t)

And there it is. We've successfully modeled a physical system using the A, B, C, and D matrices. This compact representation is not just neat; it's the foundation for modern control theory, enabling analysis and design for systems far more complex than this simple example.

Quiz Questions 1/6

Why is state-space representation often preferred over transfer functions for modeling complex systems like a modern drone?

Quiz Questions 2/6

In the standard state-space equations, which matrix describes the internal dynamics of the system, i.e., how the state variables would evolve without any external input?