# Kalman filter using regressed model

I'm currently polishing flight control system for KSP, and I'm fightinng high-frequency noise in state vector measurements right now. I want to try to apply Kalman filter to provide more smooth values for controller inputs, but I have two major math concerns:

1). $x_i = F_i x_{i-1} + B_i u_i + w_i$ - standard Kalman filter state transition model. It is linear, and it's ok, I've linearized flight model (got linear time-variant system), but to the form of $x_{i+1} = A x_i + B u_i + C$, where C is bias vector, which comes from linear diffirential equations. For example, aerodynamics torque model: $torque = k_0 + k_1 * AoA + k_2 * u$, where $k_0$ is the source of bias. How do I accomodate $C$ in Kalman filter? Should I introduce fictional state, which is always 1, and if yes - what will change in predict-update sense? And why do most internet sources on time-domain control theory have standard system definition form as $x_i = A x_{i-1} + B u_i$, without a bias vector?

2). Model laws are linear and simple, but coefficient values are unknown until the fight itself. I use batched weighted least squares in real-time in the background to get estimated model koefficients, for example $k_0$, $k_1$ and $k_2$, batch is formed from recent measurements of state vector and some generalization buffers. How risky is to use regressed model with Kalman filter, will it converge? Can I put filter outputs instead of measurements states into regressor, or it will cause positive feedback of errors and divert filter from true state? Or should I simply use workflow: measurements to regressor and filter, model from regressor to filter, filtered state to filter on next step and to controllers?

Thank you.

• 1) It is assumed to be a deviation from the steady-state solution, that's why it has the standard form with no bias. If you have a steady-state $\bar x=A\bar x+B\bar u+C$ then just consider $x_i-\bar x$ and $u_i-\bar u$ as new variables. – A.Γ. Nov 6 '15 at 22:15
• Good point, thanks. – Boris-Barboris Nov 6 '15 at 22:23
• Normally, there is a desirable steady state $\bar x$ (maybe more often the output, not the state itself), where one wants to drive the system to, and then $\bar u$ is chosen accordingly as a part of the design. – A.Γ. Nov 6 '15 at 23:17

1) By definition, a system of the form $x_{k+1} = A x_k + B u_k + c$ is called "affine linear".
As said by A.G., one can find a steady state solution $\bar{x} = A \bar{x} + B \bar{u} + c$ and create a new system with dynamics $\tilde{x}_{k+1} = A \tilde{x}_k + B \tilde{u}_k$ where $\tilde{x}_k = x_k - \bar{x}$ and $\tilde{u}_k = u_k - \bar{u}$.
However, for the KF case, the derivation does not change (If you want the derivation I edit the question and give it to you). You just need to include the $c$ term into the state prediction equation. The covariance updates stay the same.