I’m learning Continuous Time Stochastic Modeling (CTSM) for a research project. This relies on the Extended Kalman Filter (EKF) to work. I’m in the process of writing notes to solidify my intuition of control theory fundamentals. This also serves as a reference for my future self.
A function is a mapping from an input to an output.
If we want to describe an object, we often need more than one variable. These can all be stored in , making it a vector. This is known as the state. The state of a pendulum for example is:
What if we want a function that describes the state of an object over time? This would take the form . However, functions like these are often incredibly difficult to derive. It’s often much easier to write a function that describes what’s happening to a state at any point in time.
This is known as the dynamics of an object. An object with dynamics is known as a system. The dynamics of the pendulum, for example, is just one function:
This means that the velocity of the pendulum changes as a function of the position. To define the state of the pendulum, we only include variables we care about. Looking at the dynamics, we need the angle . However, we also need the , since this controls how position evolves. You can see this if you try to integrate : the constant appears.
Why not include angular acceleration? A state can include any number of variables like acceleration, jerk, snap, the earth’s velocity, magnetic flux, etc. However, we typically only include the variables that govern how the object evolves. In the case of a pendulum, we don’t need to know angular acceleration in order to determine what happens next.
A state space is the collection of all possible states a system might have. In the case of the pendulum, the state space is:
Earlier, we said that it’s helpful to describe our system with one or more differential equations:
However, these equations are unwieldy when you have a lot of state vectors. When your system is linear (every variable evolves as a scalar times a combination of other variables), you can describe your dynamics with a matrix, A:
A is known as the state matrix. It must be an matrix because it’s transforming of size into the change in , also of size .
Up until now, we’ve been describing an autonomous system. If the system has an external influence, it’s known as a controlled system. The ways a system is influenced can be described in an input (or control) vector . The input vector usually contains different variables than the state vector. It also changes over time, making it a function of , just like . Unlike the state vector, it’s described without a differential equation, since it’s not determined by the system. The input vector on a controlled pendulum might be the torque on the pivot:
Our equation now needs to account for this input vector.
If our system is linear we can write this as:
B is known as the input matrix, how the state changes as a result of the input. It must be an matrix because it’s transforming of size into of size .
So what does controllability mean? It turns out there’s a very precise definition: A system is controllable if you can get to any state, from any state, given a finite time. An uncontrollable system means there are some states you can’t get to no matter how long you have. For example, in a system of two pendulums with one torque driving both identically, you can never reach a state where the two pendulums have different angles or different angular velocities.
How do you prove a system is controllable? Consider the input matrix . By choosing your input carefully, you can get to the direction . Since is any input, we can consider the set of achievable directions to just be the span of ‘s columns. However, in most cases, this isn’t enough to get to every state in your state space. In our earlier example, you need to arrive at any target angle and any target angular velocity given a single torque input. This means you want to control two state variables using one input. This is only possible due to the way the system evolves over time.
If you consider how the dynamics act on over time, you get , the first order term of how the input’s reach develops.
If you consider how the dynamics act on this new matrix, you get , the second order term of how the input’s reach develops.
This process can be continued for any number of s.
Multiplying by A either adds a new direction or the direction is contained in the current span.
As soon as the direction is contained in the current span, the span is closed under , so further multiplying can’t increase the dimension.
Since the state space is -dimensional, the closure happens within blocks, so is the last block that can increase the rank.
Therefore, once you reach , this can be written as a combination of lower order terms.
This is an application of the Cayley-Hamilton theorem, which states that is a combination of lower order powers.
As a result, any matrix from and beyond doesn’t tell you anything about whether your system is controllable.
, … are all matrices and all tell us something. We care about whether the span of all these possible directions let us reach our full state space. To do this, we can put them into a single matrix, known as the controllability matrix. This is .
The columns of are possible directions achievable by the system. The total space of achievable directions is simply any combination of these directions, with a dimension of This space only covers the full state space when In other words: If our is full rank, the system is controllable.
How do you know what your system is actually doing? One way to answer this question is to take readings of your system using sensors like encoders. These readings can be stored in an output vector . usually has different variables than or . The output is a function of the state , which means as the state changes, the output also changes.
can also be expressed as a linear function:
C is known as the output matrix. It must be a matrix because it’s transforming the of size into of size .
So what does observability mean? A system is observable if you can construct the full state based on the output over a finite time. A system is unobservable if you can’t construct a full state, no matter how long you have. An unobservable system might be two identical pendulums with a sensor that measures the sum of their angles. In this case, if the pendulums are decoupled, it’s impossible to determine what their individual angles are.
How to prove a system is observable? There’s an interesting duality between observability and controllability. Consider the output matrix . To provide you with the output for a given , the state is multiplied by to produce the direction . In many cases, this vector isn’t enough information to determine your original state. Like , often has fewer variables than , making underdetermined. To continue our pendulum example, the hinge might have a single gyroscope providing you with angular velocity. As a result, you need to construct both angle and angular velocity from a single angular velocity variable.
If you consider how acts on the dynamics, you get , the map from to . If you consider how this new map acts on the dynamics you get , the map from to . Just like when determining controllability, this process can be continued for any number of s. Similarly, once you reach , this can be written as a combination of the maps. In another application of Cayley-Hamilton, any matrix from and beyond doesn’t tell you anything about whether your system is observable.
, … are all matrices and all tell us something. We care about whether the span of the rows can jointly distinguish every state. To do this, we can put them into a single matrix, known as the observability matrix . This is . stacks rows rather than columns.
Like , the rows of are directions in state-space measurable by the system. The span of these rows is simply any combination of these directions, with a dimension of This space only covers the full state space when . In other words: If our is full rank, the system is observable. The symmetry between and is undeniable!