State-Space Modeling and Conversions
Transfer functions describe the input-output behavior of linear systems, but they hide internal variables. State-space modeling exposes those variables directly. Nise introduces state space as the time-domain representation built from first-order differential equations, useful for simulation, multi-output systems, controllability, observability, and modern controller design.
The shift is conceptual. Instead of asking only for , we choose a vector of state variables whose present values, together with the input, determine the future motion. The state model can then be converted to and from transfer-function form, but many design questions are easier to state using the matrices , , , and .
Definitions
The continuous-time linear time-invariant state-space representation is
Here is the state vector, is the input vector, and is the output vector. The matrix describes internal dynamics, maps inputs into states, maps states to outputs, and is direct feedthrough.
A state variable is one member of a minimal set of variables that describes the system memory. In electrical networks, capacitor voltages and inductor currents are natural choices because they represent stored energy. In mechanical systems, positions and velocities are common choices.
The transfer function associated with a single-input single-output state model is
The eigenvalues of are the system poles for a minimal realization. They are found from
A similarity transformation changes coordinates without changing input-output behavior. If
then
Key results
For a monic transfer function
one phase-variable realization is
with
when the numerator order is less than the denominator order and the realization is arranged in this phase-variable form. Nise uses this form because the pattern makes the denominator coefficients visible in the last row.
State equations are not unique. Infinitely many coordinate choices describe the same input-output map. This matters because some coordinates are physically meaningful while others are computationally convenient. For example, capacitor voltages and inductor currents are easy to interpret in a circuit, while controller canonical form is easy to use for pole placement.
The time-domain solution separates zero-input and zero-state responses:
The first term is due to initial conditions. The second term is due to the input. This is the state-space counterpart of natural and forced response.
The matrix exponential is the state-space equivalent of modal exponentials from differential equations. If has eigenvalue , the response contains an mode. If has eigenvalues , the response contains a sinusoid at rad/s under an envelope. When is diagonalizable, a coordinate transformation can expose independent modal coordinates. When it is defective, Jordan forms introduce polynomial factors multiplying exponentials.
State selection affects interpretability but not the underlying physics. Energy variables such as capacitor voltage and inductor current often lead to sparse equations and clear physical meaning. Phase variables lead to a standard companion form that is convenient for converting from transfer functions. Modal variables decouple the dynamics when possible. Balanced or scaled coordinates can improve numerical conditioning. A poor coordinate choice can make a simple system look complicated, especially when units differ by many orders of magnitude.
The feedthrough matrix deserves attention. Many strictly proper physical plants have because the output cannot change instantaneously in response to the input. Some measurement equations or algebraic interconnections do have direct feedthrough. In simulation, direct feedthrough can create algebraic loops when systems are interconnected. In transfer functions, nonzero corresponds to a numerator with the same degree as the denominator after polynomial division.
Minimality connects controllability and observability to transfer functions. A realization can contain a mode that the input cannot excite or the output cannot see. Such a mode may cancel from , but it still exists in the state equations. For design, this is not a minor bookkeeping issue. An uncontrollable unstable mode cannot be stabilized by state feedback. An unobservable unstable mode cannot be detected from the measured output. Later state-space design therefore begins with rank tests rather than gain selection.
State-space models also handle multiple inputs and outputs naturally. A motor drive may have voltage input, load-torque disturbance input, position output, and current output. Transfer-function notation can represent each input-output pair, but the state model represents all of them in one set of equations. This is why modern control, observers, Kalman filtering, and multivariable design use state-space notation as their default language.
Conversion from transfer function to state space is not unique, and software may return a different realization from the phase-variable form shown in class. MATLAB, SciPy, and python-control often use controller or observer canonical forms with state ordering choices that differ from a hand derivation. If the transfer function matches and the realization is minimal, the difference is usually just a coordinate transformation.
For simulation, state-space form handles arbitrary inputs and initial conditions cleanly. Numerical integrators update directly, and outputs are computed from . This avoids repeated inverse Laplace transforms and makes it straightforward to include disturbances, saturation blocks, or time-varying commands in a simulation environment.
When comparing a transfer function and a state model, check both poles and dc gain. Matching eigenvalues alone is not enough; the input and output matrices determine how modes are excited and observed. Matching dc gain alone is also not enough; the transient modes may still be wrong. The complete transfer function is the reliable comparison.
Document the state ordering next to every matrix.
Otherwise even correct matrices become difficult to review and reuse.
Visual
| Representation | Best for | Main limitation |
|---|---|---|
| Differential equation | direct physical law statement | cumbersome for interconnection and design |
| Transfer function | input-output poles, zeros, block diagrams | hides internal state and initial conditions |
| State space | simulation, MIMO systems, modern design | coordinate choices are not unique |
| Signal-flow graph | visual interconnection and Mason formula | can become cluttered for large systems |
Worked example 1: transfer function to phase-variable state space
Problem: Convert
to phase-variable state-space form.
Method:
- Cross-multiply:
- Convert to the differential equation:
- Choose phase variables:
- Differentiate:
- Solve the differential equation for :
Therefore
- Write matrix form:
Checked answer: The characteristic equation of is , matching the transfer-function denominator.
Worked example 2: state space to transfer function
Problem: Given
find .
Method:
- Compute :
- Find its determinant:
- Invert the matrix:
- Multiply by :
- Multiply by :
Checked answer: after cancellation. The cancellation also warns that this realization is not minimal for this input-output map.
Code
import numpy as np
from scipy import signal
A = np.array([[0.0, 1.0], [-6.0, -5.0]])
B = np.array([[0.0], [1.0]])
C = np.array([[2.0, 1.0]])
D = np.array([[0.0]])
num, den = signal.ss2tf(A, B, C, D)
print("numerator coefficients:", np.round(num[0], 8))
print("denominator coefficients:", den)
print("A eigenvalues:", np.linalg.eigvals(A))
tf = signal.TransferFunction(num[0], den)
t, y = signal.step(tf)
print("step final value approx:", y[-1])
Common pitfalls
- Assuming the state variables are unique. A coordinate transformation can change , , and without changing .
- Forgetting direct feedthrough for transfer functions whose numerator and denominator have equal degree.
- Calling eigenvalues of a nonminimal realization the visible poles of the transfer function. Pole-zero cancellations can hide modes from the input-output transfer function.
- Choosing too few state variables for a mechanical system. Each independent displacement usually contributes position and velocity states.
- Confusing zero-input response with transient response. Zero-input response is caused by initial state; transient response can also be input driven.
Connections
- Transfer functions and linearization introduce the input-output model converted here.
- Block diagrams and Mason rule includes signal-flow graphs of state equations.
- State-space controller design uses controllability and observability.
- Routh-Hurwitz stability applies to as well as transfer-function denominators.
- Simulation often uses state-space models directly.