# Should the kalmanfilter have disturbance as input?

This is a kalmanfilter

As you can see, the process noise(disturbance) is not going to the kalmanfilter. But the state space model for the state feedback system is written as this: https://youtu.be/H4_hFazBGxU?t=5m43s

So what is right and what is wrong? Should a kalmanfilter have disturbance as input too?

Like this. With disturbance as input:

$$\ \begin{bmatrix} \dot{x} \\ \\\dot{\tilde{x}} \end{bmatrix} =\begin{bmatrix} A - BL& BL \\ 0 & A-KC \end{bmatrix} \begin{bmatrix} x\\ \tilde{x} \end{bmatrix}+\begin{bmatrix} I & 0\\ I & K \end{bmatrix}\begin{bmatrix} d\\ n \end{bmatrix}\$$

Or this. Without disturbance as input:

$$\ \begin{bmatrix} \dot{x} \\ \\\dot{\tilde{x}} \end{bmatrix} =\begin{bmatrix} A - BL& BL \\ 0 & A-KC \end{bmatrix} \begin{bmatrix} x\\ \tilde{x} \end{bmatrix}+\begin{bmatrix} I & 0\\ 0 & K \end{bmatrix}\begin{bmatrix} d\\ n \end{bmatrix}\$$

I don't like the format you're using, with $\tilde{x}$, because it masks the fact that it is actually $x-\hat{x}$. In generally, you don't actually care about the state error; what you really should care about are the states themselves. The state error drives your state estimates to be equal to the actual states (eventually), but beyond that they shouldn't really be providing any useful information.

I say this because, as written, it looks like the actual system states $x$ aren't a part of your state error calculations because there's a big fat zero in the bottom-left of the system matrix. In reality though, again, you've masked the fact that you're actually using the system states twice - once directly as $x$ and then again as $x - \hat{x}$. There's a zero in the bottom-left of the system matrix because it's redundant.

All this is a preface to two points:

1. Your input disturbances $d$ will propagate to the Kalman filter naturally because they affect the system states, which in turn are measured and used as part of the input to the Kalman filter, AND
2. You can't include input disturbances in a Kalman filter in real life because you can't measure them, in the same way you can't "know" what the measurement noise is.

Use the first form.

• Yes! I can measure noise and disturbances in a system. Why should I can't do that? So...your answer is: No I cannot have disturbance to the input of the kalmanfilter? Then why does everybody have that kind of matrix system I show? – Daniel Mårtensson Jun 26 '17 at 17:38
• @DanielMårtensson - If you can measure the noise and disturbance, then why not just remove them? If you can measure input disturbances, then you can use that measured disturbance as a feedforward control input and eliminate it. If you can measure the noise, then why do you need a Kalman filter at all? – Chuck Jun 26 '17 at 17:41
• I thought I need the noise and disturbances to compute the Kalman gain matrix? To measure the noise from, e.g a sensor, I just measure steady state and look how the sensor goes a little bit crazy. Perhaps the sensor is stable = no noise from the sensor. – Daniel Mårtensson Jun 26 '17 at 18:09
• @DanielMårtensson, if you can measure noise, then you don't need Kalman filter at the first place :). – CroCo Jul 12 '17 at 15:52
• So It's not possible to measure noise? The mean and std, I mean. – Daniel Mårtensson Jul 12 '17 at 17:49