Kalman filter: request for explanation

[From Bill Powers (960711.0630 MDT)]

Hans Blom, 960710d --

Rick gave an example of a controlled variable that is the relationship
between the positions of two chairs. This example might have made the
point better if it had been set up so that the person could influence
the position of only one of the chairs, while someone else, or something
else, could move the other chair.


I've gone back to your "challenge" model, trying to understand what your
computations were. It would help me a lot if you could explain them to

Here is the program segment.

  {control; compute u}
  if k = 0.0 then
    u := 0.0 {cannot control, so don't}
    u := (r [i] - d) / k;

  {prediction; at this moment, u is known}
  x := k * u + d;
  pxx := pkk * sqr (u) + 2.0 * pdk * u + pdd;
  pxk := pkk * u + pdk;
  pxd := pdk * u + pdd;
  pkk := pkk + pmm;
  pdd := pdd + pnn;

  {get response of the "world"}
  kk := 3.0 + 2.0*d2[i]/1000.0;
  y := kk*u + d1 [i];

  {correction; at this moment, y is the response to u}
  k := k + (y - x) * pxk / pxx;
  d := d + (y - x) * pxd / pxx;
  pkk := pkk - sqr (pxk) / pxx;
  pdd := pdd - sqr (pxd) / pxx;
  pdk := pdk - pxd * pxk / pxx;

  {estimate of m and n noise variances}
  pmm := pmm + (sqr (k - kold) - pmm) / 100.0; kold := k;
  pnn := pnn + (sqr (d - dold) - pnn) / 100.0; dold := d;

Could you (or someone) tell me exactly how you arrived at the formulas
for pxx, pxk, pxd, and so forth, in the prediction and correction
segments? I know this is elementary, but that's where I am. I don't even
understand the mnemonics "pxx" and so on -- what does that mean? I think
that if you explained carefully and in detail (even though that would be
boring for you), I might understand what's going on here.

Bill P.