# The Extended Kalman Filter: An Interactive Tutorial for Non-Experts – Part 15

## The Extended Kalman Filter: An Interactive Tutorial for Non-Experts

### Part 15: Nonlinearity

By now it should be obvious that linear algebra is pretty awesome, letting us express a sophisticated algorithm like the Kalman Filter in a very compact form. Linear algebra is however not the whole story. As its name suggests, linear algebra is limited to representing relationships that are linear, i.e., characterized by a straight line. To see this, consider again our simple example of matrix * vector multiplication:

$\begin{bmatrix} a & b \\ c & d \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} ax + by \\ cx + dy \end{bmatrix}$

The demo below allows you to adjust the values of the constants $a$, $b$, $c$, and $d$ to see how the resulting vector changes, for an arbitrary line segment containing points $(x,y$). As you can see, all settings result in another straight line segment:

 a = 0 b = 0 c = 0 d = 0

$(x,y)$        $(ax + by, cx + dy)$

On the other hand, go outside and take a walk, and you’ll appreciate that very little in nature is linear. The things you’ll see with straight lines – buildings, roads, telephone poles, and the like – are mostly man-made, and most of everything else (trees, birds, clouds) is curved or fractal. And because sensors and motors and other artifacts are made from physical materials, their behavior likewise tends toward nonlinearity, outside some limited range.

Pretty much all the functions you learned about in high-school math, like $f(x) = ax^2 + bx+c$, $f(x) = sin(x)$, $log(x)$, etc., are nonlinear, so there’s a wide variety to choose from. The demo below allows you to pass the line segment from the previous demo through a few different nonlinear functions that I chose for their interesting appearance:

 $f(\begin{bmatrix} x \\ y \end{bmatrix}) = \begin{bmatrix} sin(2\pi x + \pi y)\\ cos(\pi x + \pi y) \end{bmatrix}$ $f(\begin{bmatrix} x \\ y \end{bmatrix}) = \begin{bmatrix}xy^2 \\ x + y^2\end{bmatrix}$
 $f(\begin{bmatrix} x \\ y \end{bmatrix}) = \begin{bmatrix} (1 + e^{-4y})^{-1} \\ x \end{bmatrix}$ $f(\begin{bmatrix} x \\ y \end{bmatrix}) = \begin{bmatrix}y \\ abs(x+y)\end{bmatrix}$

$(x,y)$        $f(x, y)$

Previous:
Next: