6 State-Space Models

6.1 Theory

The transfer function models discussed in the previous chapter are a frequency-domain representation of the system because they describe how the system responds to sinusoidal inputs at specific frequencies. In contrast, differential equation models are time-domain representations of the systems that directly model the time-evolution of the system. The state-space model is also a time-domain representation that is essentially a reformatting of the differential equations. In essence, the state-space model represents the system by an input, an output, and a memory element, called the state. In this book, the input will always be denoted as \(u(t)\), the output as \(y(t)\), and the state as \(x(t)\). The state represents all of the memory elements in the system. For example, the state may represent a storage register, the altitude of an aircraft, the velocity of a car, the voltage across a capacitor, or the current through an inductor.

The state-space model is composed of two equations. The first equation is called the state evolution equation and represents how the memory elements, or states, change as a function of the current state and the inputs to the system. The second equation is called the output equation and describes how the current output of the system depends on the current state and the current input. The general state-space equations for a continuous time system are written as \begin{align} \dot{x} &= f(x,u) \tag{6.1} \\ y &= h(x,u), \tag{6.2} \end{align} where Equation 6.1 is the state evolution equation and Equation 6.2 is the output equation. Note that for continuous time systems the state evolution equation is a system of coupled first order nonlinear differential equations. The general state-space equations for a discrete time system are written as \begin{align} x[k+1] &= f(x[k],u[k]) \tag{6.3} \\ y[k] &= h(x[k],u[k]), \tag{6.4} \end{align} where again Equation 6.3 is the state evolution equation, this time given by a system of coupled first order difference equations, and Equation 6.4 is the output equation.

Any nonlinear \(n^{th}\) order differential equation can be transformed into state-space form. For example, consider the nonlinear differential equation \[\dddot{y} + y^2\ddot{y} + \sin(y\dot{y}) + e^y = u,\] where \(u\) is the input and \(y\) is the output. Define the state as \[x=\begin{pmatrix}x_1 \\ x_2 \\ x_3 \end{pmatrix}\stackrel{\triangle}{=}\begin{pmatrix} y \\ \dot{y} \\ \ddot{y} \end{pmatrix}.\] Then the state evolution equation can be derived as \[\begin{aligned} \dot{x} &= \begin{pmatrix} \dot{x}_1 \\ \dot{x}_2 \\ \dot{x}_3 \end{pmatrix} = \begin{pmatrix} \dot{y} \\ \ddot{y} \\ \dddot{y} \end{pmatrix} = \begin{pmatrix} \dot{y} \\ \ddot{y} \\ -y^2\ddot{y} - \sin(y\dot{y}) - e^y + u \end{pmatrix} \\ &= \begin{pmatrix} x_2 \\ x_3 \\ -x_1^2x_3 - \sin(x_1x_2) - e^{x_1} + u \end{pmatrix} \stackrel{\triangle}{=}f(x,u), \end{aligned}\] and the output equation is \[y = x_1 \stackrel{\triangle}{=}h(x,u).\] As another example, consider the coupled differential equations \[\begin{aligned} \ddot{y}_1 + \dot{y}_1y_2 + y_2 &=u \\ \ddot{y}_2 + \dot{y}_2\cos(y_1)+\dot{y_1} &=0. \end{aligned}\] Defining the output as \(y=(y_1, y_2)^{\top}\) and the state as \[x=\begin{pmatrix} x_1 \\ x_2 \\ x_3 \\ x_4 \end{pmatrix} \stackrel{\triangle}{=}\begin{pmatrix} y_1 \\ y_2 \\ \dot{y}_1 \\ \dot{y}_2 \end{pmatrix},\] the state evolution equation can be derived as \[\begin{aligned} \dot{x} &= \begin{pmatrix} \dot{x}_1 \\ \dot{x}_2 \\ \dot{x}_3 \\ \dot{x}_4 \end{pmatrix} = \begin{pmatrix} \dot{y}_1 \\ \dot{y}_2 \\ \ddot{y}_1 \\ \ddot{y}_2 \end{pmatrix} = \begin{pmatrix} \dot{y}_1 \\ \dot{y}_2 \\ -\dot{y}_1y_2 - y_2 +u \\ -\dot{y}_2\cos(y_1)-\dot{y_1} \end{pmatrix} \\ &= \begin{pmatrix} x_3 \\ x_4 \\ -x_3x_2 - x_2 +u \\ -x_4\cos(x_1)-x_3 \end{pmatrix} \stackrel{\triangle}{=}f(x,u), \end{aligned}\] and the output equation is given by \[y = \begin{pmatrix} x_1 \\ x_2 \end{pmatrix} \stackrel{\triangle}{=}h(x,u).\]

6.1.1 Jacobian Linearization Revisited

Jacobian linearization of the system is more straightforward when the equations are in state-space form. Given the nonlinear state-space equations \begin{align} \dot{x} &= f(x,u) \tag{6.5} \\ y &= h(x,u) \tag{6.6} \end{align} an equilibrium point is defined as any \((x_e,u_e)\) such that \(f(x_e,u_e)=0\). In other words, equilibrium points are combinations of states and inputs where the state stops evolving in time. To linearize about an equilibrium point, Equations 6.5 and 6.6 can be expanded in a Taylor series about \((x_e,u_e)\) as \begin{align} f(x,u) &\approx f(x_e,u_e) + \left.\frac{\partial f}{\partial x}\right|_e (x-x_e) + \left.\frac{\partial f}{\partial u}\right|_e(u-u_e) + H.O.T. \tag{6.7}\\ h(x,u) &\approx h(x_e,u_e) + \left.\frac{\partial h}{\partial x}\right|_e (x-x_e) + \left.\frac{\partial h}{\partial u}\right|_e(u-u_e) + H.O.T., \tag{6.8} \end{align} where the Jacobian matrices are defined as \[\begin{aligned} \frac{\partial f}{\partial x} &\stackrel{\triangle}{=}\begin{pmatrix} \frac{\partial f_1}{\partial x_1} & \dots & \frac{\partial f_1}{\partial x_n} \\ \vdots & & \vdots \\ \frac{\partial f_n}{\partial x_1} & \dots & \frac{\partial f_n}{\partial x_n} \end{pmatrix} \\ \frac{\partial f}{\partial u} &\stackrel{\triangle}{=}\begin{pmatrix} \frac{\partial f_1}{\partial u_1} & \dots & \frac{\partial f_1}{\partial u_m} \\ \vdots & & \vdots \\ \frac{\partial f_n}{\partial u_1} & \dots & \frac{\partial f_n}{\partial u_m} \end{pmatrix} \\ \frac{\partial h}{\partial x} &\stackrel{\triangle}{=}\begin{pmatrix} \frac{\partial h_1}{\partial x_1} & \dots & \frac{\partial h_1}{\partial x_n} \\ \vdots & & \vdots \\ \frac{\partial h_p}{\partial x_1} & \dots & \frac{\partial h_p}{\partial x_n} \end{pmatrix} \\ \frac{\partial h}{\partial u} &\stackrel{\triangle}{=}\begin{pmatrix} \frac{\partial h_1}{\partial u_1} & \dots & \frac{\partial h_1}{\partial u_m} \\ \vdots & & \vdots \\ \frac{\partial h_p}{\partial u_1} & \dots & \frac{\partial h_p}{\partial u_m} \end{pmatrix}. \end{aligned}\] Therefore, \(\frac{\partial f}{\partial x}\) is an \(n\times n\) matrix, \(\frac{\partial f}{\partial u}\) is an \(n\times m\) matrix, \(\frac{\partial h}{\partial x}\) is a \(p\times n\) matrix, and \(\frac{\partial h}{\partial u}\) is a \(p\times m\) matrix.

Defining \(\tilde{x}\stackrel{\triangle}{=}x-x_e\) and \(\tilde{u}=u-u_e\) and letting \(A=\left.\frac{\partial f}{\partial x}\right|_e\) and \(B=\left.\frac{\partial f}{\partial u}\right|_e\), and noting that \(\dot{\tilde{x}}=\dot{x}-\dot{x}_e=\dot{x}\), results in the linearized state evolution equation \[\dot{\tilde{x}}=A\tilde{x} + B\tilde{u}.\] At the equilibria, the output may not necessarily be zero. If we define the equilibrium output to be \(y_e=h(x_e,u_e)\) and the linearized output as \(\tilde{y}=y-y_e\), and define \(C\stackrel{\triangle}{=}\left.\frac{\partial h}{\partial x}\right|_e\) and \(D\stackrel{\triangle}{=}\left.\frac{\partial h}{\partial u}\right|_e\), then using Equation 6.8 in 6.6 gives \[\begin{aligned} \tilde{y} &= y-y_e \\ &\approx h(x_e,u_e)+C\tilde{x} + D\tilde{u} - h(x_e,u_e) \\ &= C\tilde{x} + D\tilde{u}. \end{aligned}\] The linearized state-space equations are therefore \[\begin{aligned} \dot{\tilde{x}} &= A\tilde{x} + B\tilde{u} \\ \tilde{y} &= C\tilde{x} + D\tilde{u}. \end{aligned}\]

6.1.2 Converting State-Space Models to Transfer Function Models

Linear state-space models can be converted to transfer function models using the following technique. Suppose that the linear state-space model is given by \begin{align} \dot{x} &= Ax + Bu \tag{6.9} \\ y &= Cx + Du. \tag{6.10} \end{align} Defining the Laplace transform of a vector to be the Laplace transform of each element, i.e., \[\mathcal{L}\left\{\begin{pmatrix} x_1 \\ \vdots \\ x_n \end{pmatrix}\right\} = \begin{pmatrix} \mathcal{L}\left\{x_1\right\} \\ \vdots \\ \mathcal{L}\left\{x_n\right\}\end{pmatrix},\] and noting that the Laplace transform is a linear operator, which implies that \[\mathcal{L}\{Ax\} = A\mathcal{L}\{x\},\] taking the Laplace transform of Equations 6.9 and 6.10, and setting the initial conditions to zero, gives \begin{align} sX(s) &= AX(s) + BU(s) \tag{6.11} \\ Y(s) &= CX(s) + DU(s). \tag{6.12} \end{align} Solving 6.11 for \(X(s)\) gives \begin{align} & sX(s)-AX(s) = BU(s) \notag \\ \implies & (sI-A)X(s) = BU(s) \notag \\ \implies & X(s) = (sI-A)^{-1}BU(s), \tag{6.13} \end{align} where \(I\) is the \(n\times n\) identity matrix. Substituting 6.13 into 6.12 gives \[\begin{aligned} & Y(s) = C(sI-A)^{-1}BU(s) + DU(s) \\ \implies & Y(s) = \left[ C(sI-A)^{-1}B + D\right]U(s). \end{aligned}\] The transfer function from \(u\) to \(y\) is therefore \[\tag{6.14} H(s) = C(sI-A)^{-1}B + D.\] As an example, suppose that the state-space equations are given by \[\begin{aligned} \dot{x} &= \begin{pmatrix} 0 & 1 \\ -4 & -3 \end{pmatrix} x + \begin{pmatrix} 0 \\ 2 \end{pmatrix} u \\ y &= \begin{pmatrix} 1 & 0 \end{pmatrix} x + (0)u, \end{aligned}\] then the transfer function from \(u\) to \(y\) is given by \[\begin{aligned} H(s) &= C(sI-A)^{-1}B + D \\ &= \begin{pmatrix} 1 & 0\end{pmatrix}\left(s\begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix} - \begin{pmatrix} 0 & 1 \\ -4 & -3 \end{pmatrix}\right)^{-1}\begin{pmatrix} 0 \\ 2\end{pmatrix} + 0 \\ &= \begin{pmatrix} 1 & 0\end{pmatrix}\begin{pmatrix} s & -1 \\ 4 & s+3\end{pmatrix}^{-1}\begin{pmatrix} 0 \\ 2\end{pmatrix}\\ &= \begin{pmatrix} 1 & 0\end{pmatrix}\frac{\begin{pmatrix} s+3 & 1 \\ -4 & s\end{pmatrix}}{s^2+3s+4}\begin{pmatrix} 0 \\ 2\end{pmatrix}\\ &= \frac{\begin{pmatrix} s+3 & 1 \end{pmatrix}}{s^2+3s+4}\begin{pmatrix} 0 \\ 2\end{pmatrix}\\ &= \frac{2}{s^2+3s+4}. \end{aligned}\]

The form of the transfer function in Equation 6.14 allows us to derive a simple relationship between the poles of the transfer function \(H(s)\) and the eigenvalues of \(A\). Recall (see Appendix 31) that for any square invertible matrix \(M\), we have that \[M^{-1} = \frac{\text{adj}(M)}{\text{det}(M)},\] where \(\text{adj}(M)\) is the adjugate of \(M\) defined as the transpose of the cofactors of \(M\), and \(\text{det}(M)\) is the determinant of \(M\). Therefore \[\begin{aligned} H(s) &= C(sI-A)^{-1}B+D \\ &=\frac{C\text{adj}(sI-A)B}{\text{det}(sI-A)}+D \\ &= \frac{C\text{adj}(sI-A)B+D\text{det}(sI-A)}{\text{det}(sI-A)}. \end{aligned}\] This expression implies that the zeros of \(H(s)\) are given by the roots of the polynomial \[C\text{adj}(sI-A)B+D\text{det}(sI-A) = 0,\] and that the poles of \(H(s)\) are given by the roots of the polynomial \[\tag{6.15} \text{det}(sI-A) = 0.\] Recall from linear algebra (see Appendix 31) that Equation 6.15 also defines the eigenvalues of \(A\). Therefore, the poles of \(H(s)\) are equivalent to the eigenvalues of \(A\).

In Chapters 14 and 16 we will show two general techniques for converting SISO transfer function models into state-space models.

6.2.1 image Example Problem 3.1.9

For the feedback linearized equations of motion for the single-link robot arm given in Equation 4.7, define the states as \(x=(\theta,\dot{\theta})^{\top}\), the input as \(\tilde{u}=\tilde{\tau}\), and the measured output as \(y=\theta\). Find the linear state-space equations in the form \[\begin{aligned} \dot{x} &= Ax + B\tilde{u} \\ y &= Cx + D\tilde{u}. \end{aligned}\]

Design Study A guided exercise

Work through the arm state-space model

Use the feedback-linearized arm equation and the state definitions in the problem statement. For compact entry, use \(a = 3b/(m\ell^2)\) and \(\beta = 3/(m\ell^2)\).

Step 1. Convert the second-order equation to state derivatives

With \(x_1 = \theta\) and \(x_2 = \dot{\theta}\), enter the two state derivative equations in coefficient form.

Step 2. Fill in the state-space matrices

Enter the entries of \(A\), \(B\), \(C\), and \(D\). Use \(a\) and \(\beta\) as defined above.

\(A =\)
\(B =\)
\(C =\)

Step 3. Check the transfer function from the state-space model

The transfer function should match the result from Chapter 5. Enter the numerator and denominator coefficients of \(H(s)=C(sI-A)^{-1}B+D\).

6.3 Design Study B. Inverted Pendulum

6.3.1 image Example Problem 3.2.9

Defining the states as \(\tilde{x}=(\tilde{z},\tilde{\theta},\dot{\tilde{z}},\dot{\tilde{\theta}})^{\top}\), the input as \(\tilde{u}=\tilde{F}\), and the measured output as \(\tilde{y}=(\tilde{z},\tilde{\theta})^{\top}\), find the linear state-space equations in the form \[\begin{aligned} \dot{\tilde{x}} &= A\tilde{x} + B\tilde{u} \\ \tilde{y} &= C\tilde{x} + D\tilde{u}. \end{aligned}\]

Design Study B guided exercise

Construct the pendulum state-space model

Confirm the state, output, and key matrix structure for the four-state linear model.

Step 1. State and output definitions

Step 2. Matrix sizes

Step 3. Input channel

6.4 Design Study C. Satellite Attitude Control

6.4.1 image Example Problem 3.3.9

Suppose that a star tracker is used to measure \(\theta\) and a strain gauge is used to approximate \(\phi-\theta\). Defining the states as \(x=(\theta,\phi,\dot{\theta},\dot{\phi})^{\top}\), the input as \(u=\tau\), and the measured output as \(y=(\theta,\phi-\theta)^{\top}\), find the linear state-space equations in the form \[\begin{aligned} \dot{x} &= Ax + Bu \\ y &= Cx + Du. \end{aligned}\]

Design Study C guided exercise

Build the satellite state-space model

The state vector is \(x=(\theta,\phi,\dot{\theta},\dot{\phi})^T\), the input is body torque \(\tau\), and the measured output is \(y=(\theta,\phi-\theta)^T\).

Step 1. Assign the states

Step 2. Fill the kinematic rows of \(A\)

Step 3. Place the torque input

Step 4. Build the measured output

6.5 Interactive State-Space Check

Chapter 6 activity

Build and test a state-space model

Start with y” + a1y’ + a0y = b0u. Define x1=y and x2=y’, then compare the state equation with the separate output equation.

State definitions

State equation

A matrix

B matrix

Current derivative

Output equation

Current output

Key separation: A and B determine how the state moves. C and D determine what is measured as the output. Changing C or D changes y(t), but it does not change the state trajectory.

6.6 Knowledge Check

Q1. State meaning

What role does the state play in a state-space model?

Q2. Output equation

What does y = Cx + Du describe?

Q3. State count

How many first-order state equations are typically needed for a third-order differential equation?

Show solution

Answer: 3, because an nth-order differential equation becomes n first-order state equations.

Q4. State derivative

For the state equation

dx2⁄dt = -2x1 - 3x2 + 4u,

enter dx2⁄dt when x1 = 1, x2 = 0, and u = 1.

Show solution

Answer: 2, because dx2⁄dt = -2(1) - 3(0) + 4(1) = 2.

Q5. Direct input path

In y=Cx+Du, what term names the direct path from input to output?

Show solution

Answer: The D matrix, often called the direct feedthrough term.

Q6. State dimension

A third-order ordinary differential equation is normally represented with how many states?

Q7. Output matrix

If A and B are unchanged but C is changed, what changes most directly?

Q8. Matrix dimensions

For a model with two states, one input, and one output, which dimensions are consistent?

Q9. Transfer function from state-space

Which expression maps a state-space model to its transfer function?

Q10. Stability from A

For A with rows (1, 0) and (2, -3), what can you conclude about the open-loop state dynamics?

6.7 Notes and References

There are numerous resources that derive state-space models from differential equations and transfer functions. For example [4–6, 17].