Chapter 1: Introduction to Modern (State-Space) Control

Lesson 3: State Variables and Internal Dynamics — Conceptual Overview

This lesson introduces the central notion of state variables and internal dynamics for control systems. Building on classical transfer-function concepts, we formalize what it means for a set of variables to describe the system's memory, explain the Markov property in continuous-time dynamics, and connect zero-input behavior to internal dynamics. We also give first examples of state-based simulation in Python, C++, Java, MATLAB/Simulink, and Wolfram Mathematica.

1. Motivation and Informal Definition of State

In classical (transfer-function) control, we describe a system by its input-output relationship, often via a rational transfer function \( G(s) \). This description is external: it hides the internal variables that actually evolve in time (positions, velocities, currents, charges, etc.). Modern control theory makes these internal variables explicit as a state vector.

Informally, the state at time \( t_0 \), denoted \( x(t_0) \), is any collection of quantities that summarizes the past in such a way that future behavior depends only on:

  • the current state \( x(t_0) \),
  • the future input signal \( u(t) \) for \( t \ge t_0 \).

A widely used informal definition is:

\[ \text{State at time } t_0 \text{ is a vector } x(t_0) \text{ such that for any } t \gt t_0, \]

\[ \big(x(t_0), \{u(\tau)\;|\;t_0 \le \tau \le t\}\big) \quad \text{uniquely determines} \quad y(t). \]

In other words, once we know the state at \( t_0 \), we do not need to remember the entire input and output history for \( t \lt t_0 \). This is the continuous-time analog of the Markov property.

2. Formal Markov Property and Equivalent State Descriptions

A deterministic control system is called Markovian in the state if there exists a function \( f \) such that its evolution satisfies

\[ \dot{x}(t) = f\big(x(t), u(t), t\big), \qquad y(t) = g\big(x(t), u(t), t\big) \]

for some output map \( g \). Then the future state and output for \( t \ge t_0 \) are fully determined by \( x(t_0) \) and the future input.

Two different state vectors \( x(t) \in \mathbb{R}^n \) and \( z(t) \in \mathbb{R}^n \) can describe the same input-output behavior if they are related by a one-to-one, onto transformation. In the linear (time-invariant) case, we often use an invertible matrix \( T \in \mathbb{R}^{n \times n} \) and set

\[ z(t) = T x(t), \qquad x(t) = T^{-1} z(t). \]

The particular numeric values stored in the state vector depend on modeling choices and coordinates, but they all encode the same internal physical reality when related by such invertible transformations.

flowchart TD
  U["Input u(t)"] --> F["State update: x_dot = f(x,u,t)"]
  X0["Initial state x(t0)"] --> F
  F --> X["State trajectory x(t)"]
  X --> G["Output map: y(t) = g(x,u,t)"]
  U --> G
  X --- Z["Alternative coordinates: z(t) = T x(t)"]
        

3. Linear Time-Invariant State Models and System Order

In this course we will mainly consider continuous-time, linear, time-invariant (LTI) systems. Their state description takes the form

\[ \dot{x}(t) = A x(t) + B u(t), \qquad y(t) = C x(t) + D u(t), \]

where \( x(t) \in \mathbb{R}^n \) is the state, \( u(t) \in \mathbb{R}^m \) is the input, and \( y(t) \in \mathbb{R}^p \) is the output. The matrices \( A, B, C, D \) are constant and of compatible dimensions.

The integer \( n \) is called the state dimension or system order. For minimal realizations (a concept that will be developed later), the order \( n \) coincides with the order of the denominator of the transfer function \( G(s) \) obtained from \( (A,B,C,D) \).

From a classical point of view, the order \( n \) is the smallest integer such that we can write the input-output relation as an \( n \)-th order linear differential equation with constant coefficients, e.g.,

\[ y^{(n)}(t) + a_{n-1} y^{(n-1)}(t) + \cdots + a_1 y^{(1)}(t) + a_0 y(t) = b_0 u(t) + b_1 u^{(1)}(t) + \cdots + b_r u^{(r)}(t). \]

4. Constructing a State Vector from an n-th Order ODE

To see concretely what a state is, consider a single-input, single-output (SISO) LTI system described by an \( n \)-th order differential equation

\[ y^{(n)}(t) + a_{n-1} y^{(n-1)}(t) + \cdots + a_1 y^{(1)}(t) + a_0 y(t) = b_0 u(t). \]

A standard state choice is

\[ x_1(t) = y(t), \quad x_2(t) = y^{(1)}(t), \quad \dots, \quad x_n(t) = y^{(n-1)}(t). \]

We then compute the derivatives:

\[ \dot{x}_1(t) = x_2(t), \quad \dot{x}_2(t) = x_3(t), \quad \dots, \quad \dot{x}_{n-1}(t) = x_n(t), \]

and for the last component we use the differential equation to express \( y^{(n)}(t) \):

\[ \dot{x}_n(t) = y^{(n)}(t) = - a_{n-1} y^{(n-1)}(t) - \cdots - a_1 y^{(1)}(t) - a_0 y(t) + b_0 u(t). \]

Substituting the definitions of \( x_i(t) \) gives

\[ \dot{x}_n(t) = - a_{n-1} x_n(t) - a_{n-2} x_{n-1}(t) - \cdots - a_1 x_2(t) - a_0 x_1(t) + b_0 u(t). \]

Collecting all components, we obtain a first-order vector equation \( \dot{x}(t) = A x(t) + B u(t) \) with \( x(t) = [x_1(t), \dots, x_n(t)]' \). The output is simply \( y(t) = x_1(t) \) for this particular choice.

This construction proves that any finite-dimensional SISO LTI system with a scalar ODE description admits a state-space representation, and that the dimension of the state equals the differential-equation order.

5. Internal Dynamics and Zero-Input Response

The internal dynamics of a state-space system are the trajectories generated by the state equation when the input is fixed (most often set to zero). For an LTI system

\[ \dot{x}(t) = A x(t) + B u(t), \qquad y(t) = C x(t) + D u(t), \]

the zero-input dynamics are defined by setting \( u(t) = 0 \) for all \( t \ge t_0 \). Then

\[ \dot{x}_{zi}(t) = A x_{zi}(t), \qquad y_{zi}(t) = C x_{zi}(t), \]

with initial condition \( x_{zi}(t_0) = x_0 \). These trajectories depend only on the initial state and the matrix \( A \), and they describe how the system's internal energy decays, oscillates, or grows in the absence of external forcing.

The complete solution can be decomposed into

\[ x(t) = x_{zi}(t) + x_{zs}(t), \qquad y(t) = y_{zi}(t) + y_{zs}(t), \]

where \( x_{zs}(t), y_{zs}(t) \) are the zero-state response (response due solely to input with zero initial state). Thus, internal dynamics encode the autonomous behavior of the system, while external forcing shapes the driven behavior.

6. Example: Mass–Spring–Damper as a State-Space System

Consider a standard mass–spring–damper system with mass \( m > 0 \), damping coefficient \( c \ge 0 \), spring stiffness \( k > 0 \), input force \( u(t) \), and output position \( y(t) \). The dynamics are

\[ m \, \ddot{y}(t) + c \, \dot{y}(t) + k \, y(t) = u(t). \]

Choose the state variables

\[ x_1(t) = y(t), \qquad x_2(t) = \dot{y}(t). \]

Then

\[ \dot{x}_1(t) = x_2(t), \qquad \dot{x}_2(t) = -\frac{k}{m} x_1(t) - \frac{c}{m} x_2(t) + \frac{1}{m} u(t), \]

and the output equation is \( y(t) = x_1(t) \). In matrix form,

\[ \dot{x}(t) = \begin{bmatrix} 0 & 1 \\ -\frac{k}{m} & -\frac{c}{m} \end{bmatrix} x(t) + \begin{bmatrix} 0 \\ \frac{1}{m} \end{bmatrix} u(t), \qquad y(t) = \begin{bmatrix} 1 & 0 \end{bmatrix} x(t). \]

The internal dynamics correspond to the free oscillations of the mass with damping, captured by the homogeneous system \( \dot{x}(t) = A x(t) \) when \( u(t) = 0 \). The eigenstructure of \( A \) (to be studied in later chapters) is directly related to the natural frequency and damping ratio known from classical second-order system analysis.

flowchart TD
  PHYS["Physical model: m y_ddot + c y_dot + k y = u"] --> STSEL["Choose state: x1 = y, x2 = y_dot"]
  STSEL --> SS["State equations: x_dot = A x + B u"]
  SS --> INTDYN["Internal dynamics: u(t)=0 -> x_dot = A x"]
  SS --> NUM["Numerical implementation in code"]
        

7. Computational Representations of State Dynamics

We now implement a simple numerical simulation of the mass–spring–damper state model using explicit Euler integration for a constant time step \( h \). We simulate the zero-input dynamics (\( u(t) = 0 \)) to visualize internal dynamics.

7.1 Python Implementation (NumPy)


import numpy as np

# Physical parameters
m = 1.0   # mass
c = 0.4   # damping
k = 4.0   # stiffness

# State-space matrices for x = [x1; x2] = [y; y_dot]
A = np.array([[0.0,        1.0],
              [-k / m, -c / m]])
B = np.array([[0.0],
              [1.0 / m]])

def f(x, u):
    """
    Continuous-time state equation:
    x_dot = A x + B u
    x: np.array shape (2,)
    u: scalar
    """
    return (A @ x.reshape(2, 1) + B * u).flatten()

# Simulation settings
t0 = 0.0
tf = 10.0
h = 0.001
N = int((tf - t0) / h)

# Initial conditions: y(0) = 1, y_dot(0) = 0
x = np.array([1.0, 0.0])
u = 0.0  # zero-input to study internal dynamics

ts = np.zeros(N + 1)
xs = np.zeros((N + 1, 2))
ts[0] = t0
xs[0, :] = x

for k_step in range(N):
    x_dot = f(x, u)
    x = x + h * x_dot  # explicit Euler
    ts[k_step + 1] = t0 + (k_step + 1) * h
    xs[k_step + 1, :] = x

# xs[:, 0] is position y(t); xs[:, 1] is velocity y_dot(t)
# Plotting (if matplotlib is available):
# import matplotlib.pyplot as plt
# plt.plot(ts, xs[:, 0])
# plt.xlabel("t")
# plt.ylabel("y(t)")
# plt.show()
      

7.2 C++ Implementation (Minimal, Using std::vector)


#include <iostream>
#include <vector>

int main() {
    // Physical parameters
    double m = 1.0;
    double c = 0.4;
    double k = 4.0;

    // Time settings
    double t0 = 0.0;
    double tf = 10.0;
    double h  = 0.001;
    int N = static_cast<int>((tf - t0) / h);

    // State vector x = [x1; x2] = [y; y_dot]
    double x1 = 1.0; // y(0)
    double x2 = 0.0; // y_dot(0)
    double u  = 0.0; // zero-input internal dynamics

    for (int k = 0; k <= N; ++k) {
        double t = t0 + k * h;

        // Print or store state
        if (k % 1000 == 0) {
            std::cout << t << " " << x1 << " " << x2 << std::endl;
        }

        // Compute x_dot = A x + B u for mass-spring-damper
        double x1_dot = x2;
        double x2_dot = -(k / m) * x1 - (c / m) * x2 + (1.0 / m) * u;

        // Euler step
        x1 += h * x1_dot;
        x2 += h * x2_dot;
    }

    return 0;
}
      

7.3 Java Implementation


public class MassSpringDamperStateSim {

    public static void main(String[] args) {
        // Physical parameters
        double m = 1.0;
        double c = 0.4;
        double k = 4.0;

        double t0 = 0.0;
        double tf = 10.0;
        double h  = 0.001;
        int N = (int) ((tf - t0) / h);

        // State x = [y; y_dot]
        double x1 = 1.0; // y(0)
        double x2 = 0.0; // y_dot(0)
        double u  = 0.0; // zero-input internal dynamics

        for (int k_step = 0; k_step <= N; ++k_step) {
            double t = t0 + k_step * h;

            if (k_step % 1000 == 0) {
                System.out.println(t + " " + x1 + " " + x2);
            }

            double x1_dot = x2;
            double x2_dot = -(k / m) * x1 - (c / m) * x2 + (1.0 / m) * u;

            x1 += h * x1_dot;
            x2 += h * x2_dot;
        }
    }
}
      

7.4 MATLAB / Simulink Representation

In MATLAB, we can define the continuous-time state-space model and simulate it using ode45 or Simulink. The following script defines the matrices and simulates the zero-input internal dynamics via ode45.


% Physical parameters
m = 1.0;
c = 0.4;
k = 4.0;

% State-space matrices
A = [0,      1;
    -k/m, -c/m];
B = [0;
     1/m];
C = [1, 0];
D = 0;

% Zero-input internal dynamics: u(t) = 0
u_fun = @(t) 0;

% State ODE for ode45: x_dot = A x + B u
f = @(t, x) A * x + B * u_fun(t);

tspan = [0, 10];
x0 = [1; 0];  % y(0) = 1, y_dot(0) = 0

[t_sol, x_sol] = ode45(f, tspan, x0);

y_sol = (C * x_sol.').';  % output y(t) = x1(t)

% Plot
% figure;
% plot(t_sol, y_sol);
% xlabel('t'); ylabel('y(t)');
% title('Mass-Spring-Damper Zero-Input Internal Dynamics');

% Simulink (conceptual):
% - Create a State-Space block with A, B, C, D as above.
% - Set the input to zero using a Constant block with value 0.
% - Scope the output to visualize y(t).
      

7.5 Wolfram Mathematica Implementation


(* Physical parameters *)
m = 1.0;
c = 0.4;
k = 4.0;

(* State variables: x1[t] = y[t], x2[t] = y'[t] *)
x1 = x1[t];
x2 = x2[t];

(* Differential equations for zero-input internal dynamics *)
eqs = {
  x1' == x2,
  x2' == -(k/m) x1 - (c/m) x2
};

(* Initial conditions *)
ics = {
  x1 /. t -> 0 == 1.0,
  x2 /. t -> 0 == 0.0
};

sol = NDSolve[
  Join[eqs, ics],
  {x1, x2},
  {t, 0, 10}
];

(* Extract y(t) = x1(t) *)
y[t_] := Evaluate[x1 /. sol[[1]]];

(* Plot y(t) *)
(* Plot[y[t], {t, 0, 10}, AxesLabel -> {"t", "y(t)"}] *)
      

8. Problems and Solutions

Problem 1 (State from ODE): Consider the LTI system

\[ y^{(3)}(t) + 5 y^{(2)}(t) + 6 y^{(1)}(t) + 2 y(t) = u(t). \]

(a) Construct a state vector using the output and its derivatives. (b) Write the corresponding state-space equations in the form \( \dot{x}(t) = A x(t) + B u(t), \; y(t) = C x(t) \). (c) What is the state dimension?

Solution:

(a) Define

\[ x_1(t) = y(t), \quad x_2(t) = y^{(1)}(t), \quad x_3(t) = y^{(2)}(t). \]

(b) Then

\[ \dot{x}_1(t) = x_2(t), \qquad \dot{x}_2(t) = x_3(t), \]

and using the ODE we express \( y^{(3)}(t) \) as

\[ y^{(3)}(t) = - 5 y^{(2)}(t) - 6 y^{(1)}(t) - 2 y(t) + u(t), \]

so

\[ \dot{x}_3(t) = - 5 x_3(t) - 6 x_2(t) - 2 x_1(t) + u(t). \]

In matrix form,

\[ \dot{x}(t) = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ -2 & -6 & -5 \end{bmatrix} x(t) + \begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix} u(t), \qquad y(t) = \begin{bmatrix} 1 & 0 & 0 \end{bmatrix} x(t). \]

(c) The state dimension is \( n = 3 \), equal to the order of the ODE.


Problem 2 (Markov Property Verification): Let an LTI system be given in state form

\[ \dot{x}(t) = A x(t) + B u(t), \qquad y(t) = C x(t) + D u(t), \]

with continuous input \( u(t) \). Show that if two initial states \( x^{(1)}(t_0) \), \( x^{(2)}(t_0) \) satisfy \( x^{(1)}(t_0) = x^{(2)}(t_0) \), then for any \( t \ge t_0 \) and any common input \( u(\cdot) \) on \( [t_0, t] \) we have \( x^{(1)}(t) = x^{(2)}(t) \) and \( y^{(1)}(t) = y^{(2)}(t) \).

Solution:

For fixed input \( u(\cdot) \), the state equation is a linear ODE with unique solutions for given initial condition. Define the difference

\[ e(t) = x^{(1)}(t) - x^{(2)}(t). \]

Subtracting the two state equations (with the same \( u(t) \)) gives

\[ \dot{e}(t) = A e(t), \qquad e(t_0) = x^{(1)}(t_0) - x^{(2)}(t_0) = 0. \]

The unique solution of this homogeneous system with zero initial condition is \( e(t) = 0 \) for all \( t \ge t_0 \). Thus \( x^{(1)}(t) = x^{(2)}(t) \), and consequently

\[ y^{(1)}(t) - y^{(2)}(t) = C(x^{(1)}(t) - x^{(2)}(t)) + D(u(t) - u(t)) = C e(t) = 0. \]

Hence \( y^{(1)}(t) = y^{(2)}(t) \). This explicitly verifies the Markov property with respect to the state.


Problem 3 (Zero-Input vs Zero-State Response): Consider the mass–spring–damper system

\[ m \ddot{y}(t) + c \dot{y}(t) + k y(t) = u(t), \]

with state choice \( x_1(t) = y(t), x_2(t) = \dot{y}(t) \). Suppose initial conditions are \( y(0) = y_0 \), \( \dot{y}(0) = v_0 \).

(a) Define the zero-input state and output. (b) Define the zero-state state and output. (c) Argue (without using explicit solutions) why \( y(t) = y_{zi}(t) + y_{zs}(t) \) for all \( t \ge 0 \).

Solution:

(a) Zero-input dynamics: set \( u(t) = 0 \) for all \( t \ge 0 \). Then

\[ \dot{x}_{zi}(t) = A x_{zi}(t), \qquad x_{zi}(0) = \begin{bmatrix} y_0 \\ v_0 \end{bmatrix}, \qquad y_{zi}(t) = C x_{zi}(t). \]

(b) Zero-state dynamics: set the initial state to zero and retain the actual input:

\[ \dot{x}_{zs}(t) = A x_{zs}(t) + B u(t), \qquad x_{zs}(0) = \begin{bmatrix} 0 \\ 0 \end{bmatrix}, \qquad y_{zs}(t) = C x_{zs}(t). \]

(c) Linearity of the state equation implies that the sum

\[ x(t) = x_{zi}(t) + x_{zs}(t) \]

satisfies

\[ \dot{x}(t) = A x(t) + B u(t), \qquad x(0) = x_{zi}(0) + x_{zs}(0) = \begin{bmatrix} y_0 \\ v_0 \end{bmatrix}. \]

By uniqueness of solutions, this \( x(t) \) is the true state trajectory, and the output is \( y(t) = C x(t) = y_{zi}(t) + y_{zs}(t) \).


Problem 4 (Equivalent State Coordinates): Consider the mass–spring–damper state choice \( x_1(t) = y(t), x_2(t) = \dot{y}(t) \) with state vector \( x(t) = [x_1(t), x_2(t)]' \). Define a new state vector

\[ z(t) = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} x(t). \]

(a) Show that this defines an equivalent state description. (b) Explain qualitatively what changes and what does not change when switching from \( x(t) \) to \( z(t) \).

Solution:

(a) The transformation matrix

\[ T = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} \]

has determinant \( \det(T) = 1 \cdot 1 - 0 \cdot 1 = 1 \neq 0 \), hence it is invertible. Therefore we can recover \( x(t) = T^{-1} z(t) \) uniquely from \( z(t) \). By substituting \( x(t) = T^{-1} z(t) \) into the original state equation \( \dot{x}(t) = A x(t) + B u(t) \), we obtain a new state equation of the same form \( \dot{z}(t) = A_z z(t) + B_z u(t) \). Thus \( z(t) \) is an equivalent state.

(b) The numerical coordinates change, and the matrices \( A, B, C \) are transformed to \( A_z, B_z, C_z \). However, the input-output behavior (transfer function, transient response, steady-state response) remains the same. Internal modes, stability, and system order do not change. Only the coordinate representation of the internal dynamics is altered.


Problem 5 (Physical Interpretation of Internal Dynamics): Suppose the mass–spring–damper system starts from rest with a nonzero initial displacement \( y(0) = y_0 \), \( \dot{y}(0) = 0 \), and \( u(t) = 0 \) for all \( t \ge 0 \). Describe qualitatively what internal dynamics you expect for the cases: (i) no damping (\( c = 0 \)), (ii) small damping, (iii) very large damping. Relate your answers to classical second-order system behavior.

Solution:

(i) \( c = 0 \): undamped case. Internal dynamics correspond to purely sinusoidal oscillations at the natural frequency \( \sqrt{k/m} \). The energy is conserved, so the state \( x(t) \) moves on closed orbits in the \( (x_1, x_2) \) plane.

(ii) Small damping: underdamped case. Internal dynamics exhibit decaying oscillations: the displacement oscillates around zero while gradually losing energy due to damping. In state space, trajectories spiral toward the origin.

(iii) Very large damping: overdamped case. Internal dynamics show a slow, non-oscillatory return to equilibrium. The system behaves like a heavily damped mechanical element, with the state moving monotonically toward the origin without overshoot, consistent with classical overdamped second-order response.

9. Summary

In this lesson we introduced the fundamental concept of state as a minimal collection of internal variables that render the system Markovian. We showed how higher-order input-output differential equations can be rewritten as first-order vector (state-space) models, identified the connection between state dimension and system order, and distinguished internal (zero-input) dynamics from externally forced behavior. A classical mass–spring–damper example illustrated how physical intuition translates into state variables and matrices, and we implemented the resulting model numerically in several programming environments. These foundations underlie all subsequent modern control topics, including controllability, observability, canonical forms, and state-feedback design.

10. References

  1. Kalman, R. E. (1960). Contributions to the theory of optimal control. Boletin de la Sociedad Matematica Mexicana, 5(2), 102–119.
  2. Kalman, R. E. (1963). Mathematical description of linear dynamical systems. SIAM Journal on Control, 1(2), 152–192.
  3. Rugh, W. J. (1972). Linear System Theory (early journal contributions and lecture notes on state variables and internal behavior).
  4. Wonham, W. M. (1967). On pole assignment in multi-input controllable linear systems. IEEE Transactions on Automatic Control, 12(6), 660–665.
  5. Sontag, E. D. (1979). Polynomial response maps. Springer Lecture Notes in Control and Information Sciences, Vol. 13.
  6. Luenberger, D. G. (1971). An introduction to observers. IEEE Transactions on Automatic Control, 16(6), 596–602.
  7. Willems, J. C. (1972). Dissipative dynamical systems. Part I: General theory. Archive for Rational Mechanics and Analysis, 45(5), 321–351.
  8. Desoer, C. A., & Vidyasagar, M. (1975). Feedback Systems: Input-Output Properties. Academic Press (foundational development of state and internal stability).