Scroll back to top
These notes were originally written by T. Bretl and were transcribed by S. Bout.
Here is the deterministic, finite-horizon, continuous-time Kalman Filter (KF) problem — i.e., the optimal control problem that one would solve to produce an optimal observer:
The interpretation of this problem is
as follows. The current time is 
The matrices 
Just as
with the LQR problem, this notation means that 
By plugging in the expression for 
It is an optimal control problem, just like LQR — if you define
then you see that this problem has the general form
There are four differences between this form and the one we saw when solving the LQR problem:
The “input” in this problem is 
The “current time” is 
The final state — i.e., the state at the current time — is not
given. Indeed, the point here is to choose a final state
The functions 
Because of these four differences, the HJB equation for a problem of this form is
Note the change in sign of both the first term outside the minimum and
the first term inside the minimum — this is because we are effectively
solving an optimal control problem in which time flows backward (from
the current time 
As usual, our first step is to find a function 
Expand the boundary condition:
This function has the form
for some symmetric matrix 
Let’s “guess” that this form of
Here again — just as for LQR — we are applying matrix calculus. Plug these partial derivatives into HJB and we have
To evaluate the minimum, we apply the first-derivative test (more matrix calculus!):
This equation is easily solved:
Plugging this back into (1), we have
where the last step is because
In order
for this equation to be true for any 
In summary, we have found that
solves the HJB equation,
where 
The optimal choice of state
estimate at time 
We can find the solution to this problem by application of the first derivative test, with some matrix calculus:
implying that
Let’s call this solution 
Suppose we take the time derivative of
this expression, plugging in what we found earlier for 
For this equation to hold for any 
Behold! This is our expression for an optimal observer, if we define
Finally, suppose we take the limit as
It is customary to write
these last two equations in a slightly different way. In particular,
suppose we pre- and post-multiply both sides of this last equation by
Then, we have
and
An optimal observer — a deterministic, infinite-horizon, continuous-time Kalman Filter — is given by
where
and 
An optimal controller is given by
where
and 
An optimal observer is given by
where
and 
Take the transpose of (5) and — remembering that 
Take the transpose of (6)
and — remembering that 
Compare (3) and (4) with (7) and (8). They are exactly the same if we make the following replacements:
replace 
replace 
replace 
replace 
replace 
This is the reason why
Text successfully copied to clipboard!
L = lqr(A.T, C.T, linalg.inv(Ro), linalg.inv(Qo)).T
  produces an optimal observer, just like
Text successfully copied to clipboard!
K = lqr(A, B, Qc, Rc)
  produces an optimal controller. WWWWWOOOOOWWWWW!!!!!!! (See the code used to find the solution to an LQR problem with Python.)