Chapter 4: State-Space Representation
State-Space Form
Where:
- x = state vector
- u = input vector
- y = output vector
- A, B, C, D = system matrices
Example: Mass-Spring-Damper
import numpy as np
from scipy import signal
# Mass-spring-damper system
m, c, k = 1.0, 0.5, 2.0
A = np.array([[0, 1],
[-k/m, -c/m]])
B = np.array([[0],
[1/m]])
C = np.array([[1, 0]])
D = np.array([[0]])
sys = signal.StateSpace(A, B, C, D)
Controllability
System is controllable if:
def is_controllable(A, B):
n = A.shape[0]
C = B
for i in range(1, n):
C = np.hstack([C, np.linalg.matrix_power(A, i) @ B])
return np.linalg.matrix_rank(C) == n
Observability
System is observable if:
Next: Chapter 5 - Full State Feedback Control!