# Non-linear external effect in Kalman filter

Let's say I have a Kalman filter with this simple state model:

$$\begin{pmatrix} x^0_{k+1}\\ x^1_{k+1}\\ \end{pmatrix} = \begin{pmatrix} 1 & \Delta t\\ 0 & 1\\ \end{pmatrix} \begin{pmatrix} x^0_{k}\\ x^1_{k}\\ \end{pmatrix} + \mathbf{w_k} \tag 1$$

where $$x^1$$ is the time derivative of $$x^0$$, and $$\mathbf{w_k}$$ is process noise. This model describes properly the system as long as there is no significant external perturbation like temperature variation, because $$x^1$$ is an unknown function of temperature. Assuming as a first approximation that this function of temperature is linear I add the temperature derivative of $$x^1$$ to the model which become for a small temperature step $$\Delta T = T_{k+1}-T_k$$:

$$\begin{pmatrix} x^0_{k+1}\\ x^1_{k+1}\\ x^2_{k+1}\end{pmatrix} = \begin{pmatrix} 1 & \Delta t & \Delta t \Delta T\\ 0 & 1 & \Delta T\\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} x^0_{k}\\ x^1_{k}\\ x^2_{k} \end{pmatrix} + \mathbf{w_k} \tag 2$$

This linear approximation works well in estimating $$x^2$$ as long as a small temperature range is covered but is not consistent when the full temperature range is taken into account because the non-linearity of $$x^1(T)$$ comes in. How can I include a non-linear temperature behavior in the model ?

An idea I have is to decompose the non-linear temperature behavior in piecewise linear temperature segments, adding as much variables to the state vector as there are linear behavior segments, with something like

$$\begin{pmatrix} x^0_{k+1}\\ x^1_{k+1}\\ x^2_{k+1} \\ ... \\ x^n_{k+1}\end{pmatrix} = \begin{pmatrix} 1 & \Delta t & \Delta t \Delta T_{x^2} & ... & \Delta t \Delta T_{x^n}\\ 0 & 1 & \Delta T_{x^2} & ... & \Delta T_{x^n}\\ 0 & 0 & 1 &... & 1 \\ ... & ...& ... &...&... \\ 0 &0 &0&... &1 \end{pmatrix} \begin{pmatrix} x^0_{k}\\ x^1_{k}\\ x^2_{k} \\ ... \\ x^n_k \end{pmatrix} + \mathbf{w_k} \tag 3$$

where $$\Delta T_{x^i} = \Delta T$$ if $$T_i < T , or else 0.

Is this approach OK ? is there a more standard way to do this ?

I've read about extended Kalman filters (EKF) but it seems to me that EKF is appropriate for non-linear system dynamics, but here I consider my system still has linear time-dynamics but the non-linearity comes from an "external" effect so I don't know how I would apply the EKF approach to this particular case.

• I'm having trouble believing that your model in (2) is representative. It says that $x^1$ has a temperature-dependent drift that goes on forever, depending on some unknown state $x^2$. Is this really what you believe is going on? Can you edit your question to give a narrative in plain language what you believe the temperature effect is? I.e., "$x^1$ drifts with temperature in some nonlinear fashion" -- then rather than trying to give your guess at the way it should be modeled, give your best guess in math at what is actually going on. Feb 27 at 16:17
• Well $\Delta T = T_{k+1} - T_k$ in (2) is the temperature variation since the last filter call, and $x^1(T)$ is a non-linear function of temperature. The linear approximation in (2) actually works well in estimating $x^2$ as long as small temperature changes are concerned. When the full temperature range is covered however this does not work because the non-linearity of $x^1(T)$ comes in. I hope this is clearer Feb 27 at 17:02
• This is Stackexchange, which is different from other fora. Stackexchange wants the question itself to be complete, without essential bits buried in the comments. Could you please edit your question so that it is complete, rather than leaving essential bits in the comments? Feb 27 at 17:07
• Added some minor edits. The more general question (independently of this specific model given as an example) could have been "how do you handle external non-linear perturbations on top of a linear model?" The path I'm trying to follow here is to add state variables for piecewise linear estimation but I actually don't know if this is good approach. Feb 27 at 17:31