Chapter 28: Performance Measures and Quadratic Forms
Lesson 2: Energy-Like Measures and Norms of Signals (Conceptual)
This lesson explains how control engineers quantify the size of signals, output error, state motion, and actuator usage using energy-like measures. We connect finite-horizon integrals, signal norms, weighted quadratic integrals, and induced input-output gain estimates without yet designing an optimal feedback law.
1. Why Signal Measures Matter in Modern Control
In the previous lesson, we studied quadratic forms such as \( z' M z \) as static measures of vector size and direction-dependent penalty. A control system, however, produces signals: trajectories \( x(t) \), inputs \( u(t) \), outputs \( y(t) \), and tracking errors \( e(t)=r(t)-y(t) \). Therefore, a performance measure must combine two ideas:
\[ \text{instantaneous quadratic size} \quad + \quad \text{accumulation over time}. \]
The most common energy-like form over a finite horizon \( [0,T] \) is
\[ J_T = \int_0^T \left(x(t)'Qx(t)+u(t)'Ru(t)\right)\,dt, \quad Q=Q'\succeq 0,\; R=R'\succ 0. \]
In this lesson, \( Q \) and \( R \) are interpreted as descriptors of performance, not yet as matrices used to compute an optimal controller. The same structure also appears in tracking error penalties, output energy, actuator-energy estimation, and robustness-oriented input-output gain concepts.
flowchart TD
A["State-space simulation"] --> B["Signals: x(t), u(t), y(t), e(t)"]
B --> C["Pointwise size: vector norm"]
B --> D["Accumulated size: integral over time"]
C --> E["Energy-like measure"]
D --> E
E --> F["Performance interpretation"]
F --> G["Small error / moderate input / acceptable transient"]
2. Signal Spaces and Basic Norms
A vector signal \( v:[0,T]\to\mathbb{R}^m \) can be measured using a family of \( L_p \)-type norms. On a finite horizon with \( 1\leq p<\infty \), define
\[ \|v\|_p = \left(\int_0^T \|v(t)\|_p^p\,dt\right)^{1/p}. \]
The most important norm for quadratic control performance is the \( L_2 \) norm:
\[ \|v\|_2 = \left(\int_0^T v(t)'v(t)\,dt\right)^{1/2}, \quad \|v\|_2^2 = \int_0^T v(t)'v(t)\,dt. \]
The square \( \|v\|_2^2 \) is commonly called the signal energy. For a scalar electrical signal, this resembles the energy dissipated in a unit resistor. For a mechanical velocity signal, it can resemble kinetic-energy accumulation after multiplication by a mass-like weight. The \( L_\infty \) norm measures peak magnitude:
\[ \|v\|_\infty = \operatorname*{ess\,sup}_{t\in[0,T]}\|v(t)\|_2. \]
In transient response analysis, \( L_2 \) emphasizes total accumulated motion, while \( L_\infty \) emphasizes worst-case peak excursion. Both can be important: a response may have a small energy but a large unsafe peak, or a small peak but a long-lasting error tail.
3. Weighted Energy and Quadratic Signal Semi-Norms
Let \( W=W'\succeq 0 \). A weighted signal energy is
\[ \|v\|_W^2 = \int_0^T v(t)'Wv(t)\,dt. \]
If \( W\succ 0 \), then \( \|v\|_W \) is a genuine norm on the space of square-integrable vector signals. If \( W\succeq 0 \) but singular, it is only a semi-norm: nonzero directions in \( \ker(W) \) are not penalized. This is not necessarily wrong. For example, one may penalize position error heavily and velocity error lightly, or penalize one measured output but not another.
\[ W = S'S \quad \Longrightarrow \quad \|v\|_W^2 = \int_0^T \|Sv(t)\|_2^2\,dt. \]
Thus a weighted norm is equivalent to first scaling or mixing the signal by \( S \) and then measuring ordinary Euclidean energy. This factorization is especially useful for interpreting weights as unit conversions, engineering priorities, or safety margins.
4. RMS, Average Power, and Finite-Horizon Interpretation
Energy grows with the length of the observation interval. To compare responses over different finite horizons, the root-mean-square value is often more informative:
\[ \operatorname{RMS}_T(v) = \left(\frac{1}{T}\int_0^T v(t)'v(t)\,dt\right)^{1/2}. \]
For a weighted measure,
\[ \operatorname{RMS}_{T,W}(v) = \left(\frac{1}{T}\int_0^T v(t)'Wv(t)\,dt\right)^{1/2}. \]
Energy asks: how much total signal activity occurred? RMS asks: what constant signal level would have equivalent average quadratic effect? For stable systems, finite-horizon energy is often used to evaluate transient response. RMS is useful when comparing multiple tests of different durations.
5. State-Space Signals and Quadratic Performance
Consider a continuous-time LTI system
\[ \dot x(t)=Ax(t)+Bu(t),\quad y(t)=Cx(t)+Du(t). \]
A natural finite-horizon performance index is
\[ J_T(x,u)=\int_0^T \left(x(t)'Qx(t)+u(t)'Ru(t)+2x(t)'Nu(t)\right)dt. \]
The cross term \( N \) is included for mathematical completeness, but many introductory designs use \( N=0 \). The block matrix condition
\[ \begin{bmatrix} Q & N \\ N' & R \end{bmatrix} \succeq 0 \]
ensures that the instantaneous integrand is nonnegative. If \( R\succ 0 \), actuator use is strictly penalized. If \( Q\succeq 0 \), some state directions may be unpenalized, which can be appropriate when certain coordinates are physically less important or already constrained indirectly through the dynamics.
For output performance, one may write \( J_y = \int_0^T y(t)'W_y y(t)\,dt \). Substituting \( y=Cx+Du \) converts output weighting into an equivalent quadratic form in \( x \) and \( u \):
\[ y'W_y y = x'C'W_yCx + 2x'C'W_yDu + u'D'W_yDu. \]
6. Important Proofs
Proof 1: Weighted energy is nonnegative. If \( W=W'\succeq 0 \), then for every time \( t \),
\[ v(t)'Wv(t)\geq 0. \]
Integrating a nonnegative function over \( [0,T] \) gives
\[ \int_0^T v(t)'Wv(t)\,dt \geq 0. \]
If \( W\succ 0 \) and the integral is zero, then \( v(t)'Wv(t)=0 \) almost everywhere. Positive definiteness implies \( v(t)=0 \) almost everywhere.
Proof 2: Weighted norm is equivalent to ordinary norm after scaling. Since \( W\succeq 0 \), there exists a matrix \( S \) such that \( W=S'S \). Therefore,
\[ v(t)'Wv(t)=v(t)'S'Sv(t)=(Sv(t))'(Sv(t))=\|Sv(t)\|_2^2. \]
Integrating both sides proves \( \|v\|_W^2=\|Sv\|_2^2 \).
Proof 3: The triangle inequality for the finite-horizon \( L_2 \) norm. For square-integrable signals \( v \) and \( w \), the inner product is
\[ \langle v,w\rangle = \int_0^T v(t)'w(t)\,dt. \]
By Cauchy-Schwarz,
\[ |\langle v,w\rangle|\leq \|v\|_2\|w\|_2. \]
Hence
\[ \begin{aligned} \|v+w\|_2^2 &= \|v\|_2^2 + 2\langle v,w\rangle + \|w\|_2^2 \\ &\leq \|v\|_2^2 + 2\|v\|_2\|w\|_2 + \|w\|_2^2 \\ &= (\|v\|_2+\|w\|_2)^2. \end{aligned} \]
Taking square roots gives \( \|v+w\|_2\leq \|v\|_2+\|w\|_2 \).
7. Input-Output Gain as a Norm Ratio
A system maps an input signal to an output signal. Conceptually, one can compare output energy with input energy. For an operator \( G:u\mapsto y \), the induced finite-horizon \( L_2 \) gain is
\[ \|G\|_{2,T} = \sup_{u\neq 0} \frac{\|Gu\|_2}{\|u\|_2}. \]
This number answers: what is the largest possible output-energy amplification over this horizon? In this conceptual lesson, we only interpret the ratio. Later courses in robust and optimal control connect such gains to transfer-matrix norms and Riccati/LMI tests.
\[ \frac{\|y\|_2^2}{\|u\|_2^2} = \frac{\int_0^T y(t)'y(t)\,dt}{\int_0^T u(t)'u(t)\,dt}. \]
A single simulation gives only a lower-bound estimate of an induced gain because it tests only one input waveform. The true induced gain is the supremum over all admissible nonzero inputs.
8. Numerical Approximation of Signal Energies
In computational control, signals are sampled. Suppose \( t_0,t_1,\ldots,t_N \) are simulation times and \( v_k=v(t_k) \). The trapezoidal approximation is
\[ \int_0^T v(t)'Wv(t)\,dt \approx \sum_{k=0}^{N-1} \frac{t_{k+1}-t_k}{2} \left(v_k'Wv_k+v_{k+1}'Wv_{k+1}\right). \]
This is the numerical principle used in the implementations below. The computational pipeline is simple: simulate the state equation, construct sampled state/output/input arrays, evaluate the quadratic integrand, and integrate it numerically.
flowchart TD
A["Choose A, B, C, D and initial state"] --> B["Define input signal u(t)"]
B --> C["Simulate xdot = A x + B u"]
C --> D["Compute y(t) and e(t)"]
D --> E["Evaluate quadratic integrands"]
E --> F["Integrate: trapezoidal or ODE quadrature"]
F --> G["Report L2, RMS, Linf, and J"]
9. Python Implementation — Chapter28_Lesson2.py
Python control workflows commonly use numpy,
scipy, matplotlib,
python-control, and slycot. The following file
uses NumPy/SciPy and computes all norms directly from sampled
trajectories.
# Chapter28_Lesson2.py
"""
Energy-like signal measures for a simple continuous-time state-space model.
Libraries used in modern control workflows:
- numpy: arrays and numerical linear algebra
- scipy.integrate: ODE simulation
- scipy.linalg: Lyapunov equations, matrix functions, eigen-analysis
- python-control (optional): state-space objects and system norms
This script intentionally computes most quantities from sampled data so that the
connection between signal norms and numerical simulation is visible.
"""
from __future__ import annotations
import numpy as np
from scipy.integrate import solve_ivp
def trapz_energy(t: np.ndarray, y: np.ndarray, W: np.ndarray | None = None) -> float:
"""Approximate integral y(t)^T W y(t) dt using the trapezoidal rule."""
if W is None:
W = np.eye(y.shape[1])
values = np.einsum("ij,jk,ik->i", y, W, y)
return float(np.trapz(values, t))
def l2_norm(t: np.ndarray, y: np.ndarray, W: np.ndarray | None = None) -> float:
"""Weighted L2 norm: sqrt(integral y^T W y dt)."""
return float(np.sqrt(max(trapz_energy(t, y, W), 0.0)))
def rms_value(t: np.ndarray, y: np.ndarray, W: np.ndarray | None = None) -> float:
"""Weighted RMS value over a finite horizon [t0, tf]."""
horizon = float(t[-1] - t[0])
if horizon <= 0.0:
raise ValueError("The time vector must span a positive interval.")
return float(np.sqrt(max(trapz_energy(t, y, W) / horizon, 0.0)))
def linf_norm(y: np.ndarray) -> float:
"""Vector-valued L-infinity norm: sup_t ||y(t)||_2."""
return float(np.max(np.linalg.norm(y, axis=1)))
def simulate_mass_spring_damper() -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
"""Simulate x_dot = A x + B u, y = C x with a decaying sinusoidal input."""
A = np.array([[0.0, 1.0], [-4.0, -0.8]])
B = np.array([[0.0], [1.0]])
C = np.array([[1.0, 0.0], [0.0, 1.0]])
x0 = np.array([1.0, 0.0])
def u(t: float) -> float:
return 0.5 * np.sin(3.0 * t) * np.exp(-0.2 * t)
def rhs(t: float, x: np.ndarray) -> np.ndarray:
return A @ x + B[:, 0] * u(t)
t_eval = np.linspace(0.0, 12.0, 1201)
sol = solve_ivp(rhs, (t_eval[0], t_eval[-1]), x0, t_eval=t_eval, rtol=1e-9, atol=1e-11)
if not sol.success:
raise RuntimeError(sol.message)
x = sol.y.T
y = x @ C.T
u_samples = np.array([[u(t)] for t in t_eval])
return t_eval, x, y, u_samples
def main() -> None:
t, x, y, u = simulate_mass_spring_damper()
Qx = np.diag([10.0, 1.0]) # position is penalized more than velocity
Ru = np.array([[0.2]]) # modest input penalty
Wy = np.diag([1.0, 0.1]) # output energy metric
state_energy = trapz_energy(t, x, Qx)
input_energy = trapz_energy(t, u, Ru)
performance_index = state_energy + input_energy
print("Weighted state energy =", state_energy)
print("Weighted input energy =", input_energy)
print("Quadratic performance J =", performance_index)
print("Weighted output L2 norm =", l2_norm(t, y, Wy))
print("Weighted output RMS =", rms_value(t, y, Wy))
print("Output L-infinity norm =", linf_norm(y))
print("Unweighted input L2 norm =", l2_norm(t, u))
# Optional: show how a sampled induced-gain estimate is formed for this one input.
gain_estimate = l2_norm(t, y) / max(l2_norm(t, u), 1e-12)
print("Sampled input-output L2 gain estimate for this input =", gain_estimate)
if __name__ == "__main__":
main()
10. C++ Implementation — Chapter28_Lesson2.cpp
C++ control software often uses Eigen,
Armadillo, Blaze, or SLICOT bindings. The code
below is dependency-free C++17 and uses RK4 plus trapezoidal
integration.
// Chapter28_Lesson2.cpp
// From-scratch computation of energy-like measures for a second-order state-space model.
// Typical C++ control/numerics libraries to know: Eigen, Armadillo, Blaze, SLICOT bindings.
// This file avoids external dependencies so it can be compiled with a standard C++17 compiler.
#include <array>
#include <cmath>
#include <iostream>
#include <vector>
using Vec2 = std::array<double, 2>;
struct Sample {
double t;
Vec2 x;
double u;
};
double input(double t) {
return 0.5 * std::sin(3.0 * t) * std::exp(-0.2 * t);
}
Vec2 dynamics(double t, const Vec2& x) {
double u = input(t);
// x_dot = A x + B u, A = [[0, 1], [-4, -0.8]], B = [0, 1]^T
return {x[1], -4.0 * x[0] - 0.8 * x[1] + u};
}
Vec2 add_scaled(const Vec2& x, const Vec2& k, double h) {
return {x[0] + h * k[0], x[1] + h * k[1]};
}
Vec2 rk4_step(double t, const Vec2& x, double h) {
Vec2 k1 = dynamics(t, x);
Vec2 k2 = dynamics(t + 0.5 * h, add_scaled(x, k1, 0.5 * h));
Vec2 k3 = dynamics(t + 0.5 * h, add_scaled(x, k2, 0.5 * h));
Vec2 k4 = dynamics(t + h, add_scaled(x, k3, h));
return {x[0] + h * (k1[0] + 2.0 * k2[0] + 2.0 * k3[0] + k4[0]) / 6.0,
x[1] + h * (k1[1] + 2.0 * k2[1] + 2.0 * k3[1] + k4[1]) / 6.0};
}
double state_quadratic(const Vec2& x) {
// x^T Q x with Q = diag(10, 1)
return 10.0 * x[0] * x[0] + x[1] * x[1];
}
double output_weighted_quadratic(const Vec2& y) {
// y^T W y with W = diag(1, 0.1)
return y[0] * y[0] + 0.1 * y[1] * y[1];
}
double norm2(const Vec2& y) {
return std::sqrt(y[0] * y[0] + y[1] * y[1]);
}
int main() {
const double t0 = 0.0;
const double tf = 12.0;
const double h = 0.01;
const int n = static_cast<int>((tf - t0) / h);
std::vector<Sample> samples;
samples.reserve(n + 1);
Vec2 x = {1.0, 0.0};
double t = t0;
for (int i = 0; i <= n; ++i) {
samples.push_back({t, x, input(t)});
x = rk4_step(t, x, h);
t += h;
}
double stateEnergy = 0.0;
double inputEnergy = 0.0;
double outputEnergy = 0.0;
double linf = 0.0;
for (std::size_t i = 0; i + 1 < samples.size(); ++i) {
const auto& a = samples[i];
const auto& b = samples[i + 1];
double dt = b.t - a.t;
stateEnergy += 0.5 * dt * (state_quadratic(a.x) + state_quadratic(b.x));
inputEnergy += 0.5 * dt * (0.2 * a.u * a.u + 0.2 * b.u * b.u);
outputEnergy += 0.5 * dt * (output_weighted_quadratic(a.x) + output_weighted_quadratic(b.x));
linf = std::max(linf, norm2(a.x));
}
double outputL2 = std::sqrt(outputEnergy);
double outputRms = std::sqrt(outputEnergy / (tf - t0));
std::cout << "Weighted state energy = " << stateEnergy << "\n";
std::cout << "Weighted input energy = " << inputEnergy << "\n";
std::cout << "Performance J = " << stateEnergy + inputEnergy << "\n";
std::cout << "Weighted output L2 norm = " << outputL2 << "\n";
std::cout << "Weighted output RMS = " << outputRms << "\n";
std::cout << "Output L-infinity norm = " << linf << "\n";
return 0;
}
11. Java Implementation — Chapter28_Lesson2.java
Java numerical-control projects commonly use EJML,
Apache Commons Math, ojAlgo, or
ND4J. This implementation is written from scratch with the
standard library.
// Chapter28_Lesson2.java
// Energy-like measures for state-space signals using only the Java standard library.
// Java libraries useful for modern control/numerics include EJML, Apache Commons Math, ojAlgo, and ND4J.
public class Chapter28_Lesson2 {
static double input(double t) {
return 0.5 * Math.sin(3.0 * t) * Math.exp(-0.2 * t);
}
static double[] dynamics(double t, double[] x) {
double u = input(t);
return new double[] {x[1], -4.0 * x[0] - 0.8 * x[1] + u};
}
static double[] addScaled(double[] x, double[] k, double h) {
return new double[] {x[0] + h * k[0], x[1] + h * k[1]};
}
static double[] rk4Step(double t, double[] x, double h) {
double[] k1 = dynamics(t, x);
double[] k2 = dynamics(t + 0.5 * h, addScaled(x, k1, 0.5 * h));
double[] k3 = dynamics(t + 0.5 * h, addScaled(x, k2, 0.5 * h));
double[] k4 = dynamics(t + h, addScaled(x, k3, h));
return new double[] {
x[0] + h * (k1[0] + 2.0 * k2[0] + 2.0 * k3[0] + k4[0]) / 6.0,
x[1] + h * (k1[1] + 2.0 * k2[1] + 2.0 * k3[1] + k4[1]) / 6.0
};
}
static double stateQuadratic(double[] x) {
return 10.0 * x[0] * x[0] + x[1] * x[1];
}
static double outputWeightedQuadratic(double[] y) {
return y[0] * y[0] + 0.1 * y[1] * y[1];
}
static double norm2(double[] y) {
return Math.sqrt(y[0] * y[0] + y[1] * y[1]);
}
public static void main(String[] args) {
double t0 = 0.0;
double tf = 12.0;
double h = 0.01;
int n = (int) Math.round((tf - t0) / h);
double[] t = new double[n + 1];
double[][] x = new double[n + 1][2];
double[] u = new double[n + 1];
x[0][0] = 1.0;
x[0][1] = 0.0;
t[0] = t0;
u[0] = input(t0);
for (int i = 0; i < n; i++) {
t[i + 1] = t[i] + h;
x[i + 1] = rk4Step(t[i], x[i], h);
u[i + 1] = input(t[i + 1]);
}
double stateEnergy = 0.0;
double inputEnergy = 0.0;
double outputEnergy = 0.0;
double linf = 0.0;
for (int i = 0; i < n; i++) {
double dt = t[i + 1] - t[i];
stateEnergy += 0.5 * dt * (stateQuadratic(x[i]) + stateQuadratic(x[i + 1]));
inputEnergy += 0.5 * dt * (0.2 * u[i] * u[i] + 0.2 * u[i + 1] * u[i + 1]);
outputEnergy += 0.5 * dt * (outputWeightedQuadratic(x[i]) + outputWeightedQuadratic(x[i + 1]));
linf = Math.max(linf, norm2(x[i]));
}
System.out.println("Weighted state energy = " + stateEnergy);
System.out.println("Weighted input energy = " + inputEnergy);
System.out.println("Performance J = " + (stateEnergy + inputEnergy));
System.out.println("Weighted output L2 norm = " + Math.sqrt(outputEnergy));
System.out.println("Weighted output RMS = " + Math.sqrt(outputEnergy / (tf - t0)));
System.out.println("Output L-infinity norm = " + linf);
}
}
12. MATLAB/Simulink Implementation — Chapter28_Lesson2.m
MATLAB control workflows use the Control System Toolbox, Robust Control Toolbox, Optimization Toolbox, and Simulink. The script below evaluates signal energies and optionally creates a simple Simulink model when Simulink is installed.
% Chapter28_Lesson2.m
% Energy-like measures and norms of signals for a state-space model.
% MATLAB libraries/toolboxes: Control System Toolbox, Robust Control Toolbox,
% Optimization Toolbox, and Simulink for block-diagram simulation.
clear; clc;
A = [0 1; -4 -0.8];
B = [0; 1];
C = eye(2);
D = [0; 0];
x0 = [1; 0];
Qx = diag([10 1]);
Ru = 0.2;
Wy = diag([1 0.1]);
u = @(t) 0.5*sin(3*t).*exp(-0.2*t);
f = @(t,x) A*x + B*u(t);
[t, x] = ode45(f, linspace(0, 12, 1201), x0);
y = (C*x.').';
uSamples = u(t);
stateIntegrand = sum((x*Qx).*x, 2);
inputIntegrand = Ru * (uSamples.^2);
outputIntegrand = sum((y*Wy).*y, 2);
stateEnergy = trapz(t, stateIntegrand);
inputEnergy = trapz(t, inputIntegrand);
J = stateEnergy + inputEnergy;
outputL2 = sqrt(trapz(t, outputIntegrand));
outputRMS = sqrt(trapz(t, outputIntegrand)/(t(end)-t(1)));
outputLinf = max(vecnorm(y, 2, 2));
fprintf('Weighted state energy = %.8f\n', stateEnergy);
fprintf('Weighted input energy = %.8f\n', inputEnergy);
fprintf('Performance J = %.8f\n', J);
fprintf('Weighted output L2 norm = %.8f\n', outputL2);
fprintf('Weighted output RMS = %.8f\n', outputRMS);
fprintf('Output L-infinity norm = %.8f\n', outputLinf);
% Control System Toolbox object. This is useful for later lessons involving
% impulse/step response energies, Gramian-based measures, and optimal feedback.
sys = ss(A, B, C, D);
disp('State-space model:');
disp(sys);
% Optional Simulink creation: a minimal block diagram for xdot = A*x + B*u.
% Run this section only when Simulink is installed.
if license('test', 'Simulink')
model = 'Chapter28_Lesson2_Simulink';
if bdIsLoaded(model)
close_system(model, 0);
end
new_system(model);
open_system(model);
add_block('simulink/Sources/Sine Wave', [model '/SineInput']);
add_block('simulink/Continuous/State-Space', [model '/StateSpacePlant']);
add_block('simulink/Sinks/Scope', [model '/Scope']);
set_param([model '/StateSpacePlant'], 'A', mat2str(A), 'B', mat2str(B), ...
'C', mat2str(C), 'D', mat2str(D), 'X0', mat2str(x0));
set_param([model '/SineInput'], 'Amplitude', '0.5', 'Frequency', '3');
add_line(model, 'SineInput/1', 'StateSpacePlant/1');
add_line(model, 'StateSpacePlant/1', 'Scope/1');
save_system(model, [model '.slx']);
disp(['Created Simulink model: ' model '.slx']);
end
13. Wolfram Mathematica Implementation — Chapter28_Lesson2.nb
Mathematica provides symbolic and numerical tools such as
StateSpaceModel, NDSolveValue,
NIntegrate, LyapunovSolve, and
Norm.
Notebook[{Cell["Chapter28_Lesson2.nb", "Title"], Cell["Energy-like measures and norms of signals for a second-order state-space system. Wolfram Language functions useful in modern control include StateSpaceModel, OutputResponse, NDSolveValue, LyapunovSolve, and Norm.", "Text"], Cell[BoxData[ToBoxes[ClearAll["Global`*"]; A = { {0, 1}, {-4, -0.8} }; B = { {0}, {1} }; Cmat = IdentityMatrix[2]; x0 = {1, 0}; Qx = DiagonalMatrix[{10, 1}]; Ru = { {0.2} }; Wy = DiagonalMatrix[{1, 0.1}]; u[t_] := 0.5 Sin[3 t] Exp[-0.2 t]; sol = NDSolveValue[{x1'[t] == x2[t], x2'[t] == -4 x1[t] - 0.8 x2[t] + u[t], x1[0] == 1, x2[0] == 0}, {x1, x2}, {t, 0, 12}]; x[t_] := {sol[[1]][t], sol[[2]][t]}; stateEnergy = NIntegrate[x[t].Qx.x[t], {t, 0, 12}]; inputEnergy = NIntegrate[{ {u[t]} }.Ru.{ {u[t]} } // First // First, {t, 0, 12}]; outputEnergy = NIntegrate[x[t].Wy.x[t], {t, 0, 12}]; outputL2 = Sqrt[outputEnergy]; outputRMS = Sqrt[outputEnergy/12]; outputLinf = MaxValue[{Norm[x[t], 2], 0 <= t <= 12}, t]; {"Weighted state energy" -> stateEnergy, "Weighted input energy" -> inputEnergy, "Performance J" -> stateEnergy + inputEnergy, "Weighted output L2 norm" -> outputL2, "Weighted output RMS" -> outputRMS, "Output L-infinity norm" -> outputLinf}]]], "Input"], Cell[BoxData[ToBoxes[ss = StateSpaceModel[{A, B, Cmat, { {0}, {0} } }]; ss]]], "Input"]}]
14. Problems and Solutions
Problem 1 (Energy of an Exponential Signal): Let \( v(t)=e^{-at} \) for \( t\geq 0 \) and \( a>0 \). Compute the infinite-horizon \( L_2 \) energy and norm.
Solution:
\[ \|v\|_2^2 = \int_0^\infty e^{-2at}\,dt = \left[-\frac{1}{2a}e^{-2at}\right]_0^\infty = \frac{1}{2a}. \]
\[ \|v\|_2 = \frac{1}{\sqrt{2a} }. \]
Faster decay, meaning larger \( a \), reduces total signal energy.
Problem 2 (Weighted State Energy): Let \( x(t)=\begin{bmatrix}e^{-t} & 2e^{-2t}\end{bmatrix}' \) and \( Q=\operatorname{diag}(4,1) \). Compute \( \int_0^\infty x(t)'Qx(t)dt \).
Solution:
\[ x'Qx = 4e^{-2t}+4e^{-4t}. \]
\[ \int_0^\infty (4e^{-2t}+4e^{-4t})dt = 4\cdot\frac{1}{2}+4\cdot\frac{1}{4} = 3. \]
Problem 3 (Semi-Norm Interpretation): Let \( W=\operatorname{diag}(1,0) \) and \( v(t)=\begin{bmatrix}0 & \sin t\end{bmatrix}' \) on \( [0,2\pi] \). Is \( \|v\|_W \) a norm?
Solution:
\[ v(t)'Wv(t)=0. \]
Therefore \( \|v\|_W=0 \) although the signal is not the zero signal. Thus the weighted measure is a semi-norm, not a norm.
Problem 4 (Output Weighting Converted to State Weighting): Suppose \( y=Cx \), \( C=\begin{bmatrix}1 & 2\end{bmatrix} \), and \( W_y=3 \). Find the equivalent state weighting matrix \( Q_y \) such that \( y'W_y y=x'Q_yx \).
Solution:
\[ Q_y=C'W_yC=3\begin{bmatrix}1\\2\end{bmatrix} \begin{bmatrix}1 & 2\end{bmatrix} =\begin{bmatrix}3 & 6\\6 & 12\end{bmatrix}. \]
This matrix has rank one, meaning only the output direction \( x_1+2x_2 \) is penalized.
Problem 5 (Discrete Trapezoidal Energy): A scalar signal is sampled at \( t=[0,1,2] \) with \( v=[1,2,0] \). Approximate \( \int_0^2 v(t)^2dt \) using the trapezoidal rule.
Solution:
\[ \int_0^2 v(t)^2dt \approx \frac{1}{2}(1^2+2^2)+\frac{1}{2}(2^2+0^2)=\frac{5}{2}+2=\frac{9}{2}. \]
Hence \( \|v\|_2\approx\sqrt{9/2} \).
15. Summary
Energy-like measures convert time-domain state, input, output, and error signals into scalar performance descriptors. The \( L_2 \) norm measures accumulated energy, \( L_\infty \) measures peak magnitude, RMS normalizes energy by time, and weighted quadratic integrals encode engineering priorities. These tools prepare the ground for Lesson 3, where \( Q \) and \( R \) will be interpreted more deeply as state and control weighting matrices.
16. References
- Kalman, R.E. (1960). Contributions to the theory of optimal control. Boletin de la Sociedad Matematica Mexicana, 5, 102–119.
- Kalman, R.E. (1963). Lyapunov functions for the problem of Lur'e in automatic control. Proceedings of the National Academy of Sciences, 49(2), 201–205.
- Willems, J.C. (1971). Least squares stationary optimal control and the algebraic Riccati equation. IEEE Transactions on Automatic Control, 16(6), 621–634.
- Zames, G. (1966). On the input-output stability of time-varying nonlinear feedback systems. IEEE Transactions on Automatic Control, 11(2), 228–238.
- Yakubovich, V.A. (1962). The solution of certain matrix inequalities in automatic control theory. Doklady Akademii Nauk SSSR, 143, 1304–1307.
- Anderson, B.D.O., & Moore, J.B. (1968). Linear system optimization with prescribed degree of stability. Proceedings of the IEEE, 116(12), 2083–2087.
- Krein, M.G., & Nudelman, A.A. (1977). A Markov moment problem and extremal problems. Translations of Mathematical Monographs, 50.
- Vidyasagar, M. (1972). Input-output stability of a broad class of linear time-varying multivariable systems. SIAM Journal on Control, 10(1), 203–209.