Developing Models for Kalman Filters

Linear equations

In this installment, we will consider the subtle consequences of the assumptions of linearity for a system model intended for Kalman Filtering. You already know what linearity means of course. It is hard to imagine how anything so simple could derail your efforts — until it does.


Linear system: an example

Let's start with a simple and familiar system, to show how easy it is to get into trouble. This system consists of a simple "Hooke's Law" spring, which opposes an applied force. As the force increases, the spring length reduces in proportion. So the "input" is considered to be the compression force, and the "output" is the length of the spring.

Table 1 shows value pairs of spring length and compression force, for a typical spring of this sort.

0 10"
10 9"
20 8"

It is not hard to deduce that the characteristic behavior of this system is given by the equation
   y = -0.1 · F + 10.
Clearly the relationship is linear — isn't it?

Strictly speaking, this is an affine relationship, not linear. To be linear in a strict mathematical sense[1], a relationship f must satisfy two properties.

  1. Separability: f(x + y) = f(x) + f(y)
  2. Homogeneity: f( a x ) = a f(x)

If we let f represent the spring characteristic that yields the spring lengths given two arbitrary levels of applied force x and y, we can plug in the [force, length] data pairs from the tabulation into the two properties for linearity, and find that the conditions are not satisfied. One of the consequences of the linearity conditions is that a linear function f will produce a zero output given a zero input.

That is somewhat along the lines of common sense: "put nothing in, get nothing out." But on the other hand, it clashes with our ordinary sense that "if the data lie along a straight line, then the system is linear."

The dynamic equations for Kalman filters will have a kind of strict linearity property. A strictly stable linear model, given a zero input for a sufficient time, will eventually stabilize to produce a zero output.


Equivalent Strictly Linear System

Suppose that we have a system that is intuitively linear, but not strictly so. It is possible to modify its variables to produce an equivalent system that is linear in the strict mathematical sense — by "canceling the offset." The process is completely reversible, so that any results you obtain using the modified variables can be mapped back to the original variables without losing anything.

In fact, there is more than one way. Here are some approaches for doing this, using the "linear spring" as an example.

  1. Instead of modeling the complete position of the spring system, establish an initial equilibrium position, and declare this to be the "zero state" for your model. For the spring example, define a new position variable that is the displacement from the equilibrium position. Similarly, define a new force variable that is the displacement from the equilibrium force value.

    You will find that at the equilibrium position, the new force and position variables are both zero, and it is easy to verify that the strict linearity conditions are satisfied.

  2. Use a statistical approach. If you have lots of input and output data, you can easily calculate average values, to obtain a good approximation of statistical mean values.

    E v = lim N 1 N i = 1 i = N x i

    Now construct modified data sets that are "shifted" by the corresponding mean values of the input and output data sets.

    Let's verify that the relationship between the adjusted input and output variables is strictly linear. Start with the original affine relationship y = a x + b, and substitute the new adjusted values.

    [ y = y - E y E y = 0 x = x - E x E x = 0 ] y + E y = a · x + E x + b y = a · x + a · E x + b - E y = a · x
  3. It is possible to construct new variables directly from the known model parameters a and b, as follows, and verify that it satisfies the strict linearity properties.

    [ y = y - a · b - b x = x - b ] y + a · b + b = a · x + b + b y = a · x


Is there a point to this?

Unfortunately, yes.

Kalman filtering implicitly assumes models that satisfy the strict mathematical linearity conditions.

For example, it is typical that when the inputs of a temperature control system are set to zero, the temperature stabilizes at the ambient temperature, not absolute zero. For such systems, you need to define appropriate "shifted" variables that do settle to zero.

We will later see that important special cases of the Least Squared Error (Least Squares) parameter estimation problem produce equations that are strictly linear in the parameters. But it is possible to determine models that are not strictly linear using these methods.



[1] See the Wikipedia page on Linearity for a more complete discussion of the topic.


Contents of the "Developing Models for Kalman Filters" section of the website, including this page, are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License unless otherwise specifically noted. For complete information about the terms of this license, see The license allows usage and derivative works for individual or commercial purposes under certain restrictions. For permissions beyond the scope of this license, see the contact information page for this site.