Question: ```
<body onload="onload();">
      <input type="text" class="input-field" id="test"  title="TEST" />
</body>

```

This is the javascript to generate a value for the text field.

```
<script language="javascript" type="text/javascript"> 
function onload() 
{ 
 var a=0;
 a++:
 document.getElementById("test").value=a;
} 
</script>

```

Answer: 
This is a good observation. Given the constraints (F, H, Q, and R constant) then you can compute the evolution of P independently of the data. To answer your specific questions:

1) Yes, you could. If you were going to do that, though, you should just precompute a series of K\_n, since you'd have no need of P. Sometimes it is appropriate to just use the steady-state K all the time (with the caveat that startup might need a special case). Whenever you make a simple moving average filter you are basically making a fixed-gain KF, you just didn't choose K using the machinery of the KF.

2) This is a key point about the KF. The most important part of KF design is the noise modelling. You are *telling* the filter what the performance of the system is by setting the noise terms. People often talk of "tuning" a KF, but the covariance terms have specific meanings (and even units) and directly lead to the performance of the filter as you have described. You can check that you have done a good job by measuring the covariance of your innovation sequence z\_n (y\_n - H\*x\_n) to see that your S term ( HPH' + R ) describes it correctly.

To challenge your assumption about F, H, Q, and R being constant, let me point out some reasons why they may not be (and may authors will scrupulously write them as F\_n, H\_n, etc to indicate that):

* F and Q almost always have terms that scale by time. If your timestep is not constant, or you can skip a step, you will need to update F and Q each time.
* In an EKF, where F is not linear, F will change on every timestep when you compute the Jacobian of f(). Similarly for H if h() is not linear.
* Your co-varying Q terms may be dependent on the state. For example, if your state includes angular velocity and an orientation expressed as a quaternion, the way that the noise in angular velocity will affect the quaternion is dependent on the current value of the quaternion.
* Your R term may be influenced by the state or the measurements. E.g. part of the measurement might be rotated, requiring you to rotate the noise. Or the noise might be dependent on temperature.
* You may put in different measurements (or subsets of measurements) on every update, adding and deleting from H and R as needed.
* You may have outside knowledge of your process that lets you vary your estimate of Q (e.g. you know your robot has entered a sandy area so it is more prone to slipping).
So, it seems like the case I described here is the time time invariant case, so F, H, Q, R are constant and the Kalman gain is hence also constant and can be computed directly using the Riccati equation. 

Therefor:
1) Yes
2) It doesn't (?). 

PS: In Matlab this can be done with the 'kalman' function <http://ch.mathworks.com/help/control/ref/kalman.html>