# Nonlinear State Estimators | Understanding Kalman Filters, Part 5

From the series: Understanding Kalman Filters

*Melda Ulusoy, MathWorks*

This video explains the basic concepts behind nonlinear state estimators, including extended Kalman filters, unscented Kalman filters, and particle filters.

A Kalman filter is only defined for linear systems. If you have a nonlinear system and want to estimate system states, you need to use a nonlinear state estimator. This video explores different nonlinear filters to help you choose the one that will work for your nonlinear system. Extended Kalman filters linearize the distribution around the mean of the current estimate and then use this linearization in the predict and update states of the Kalman filter algorithm. An unscented Kalman filter selects a minimal set of sample points (also referred to as sigma points) from the Gaussian distribution, and it propagates them through the nonlinear system. It then computes the mean and covariance of the new set of transformed sample points and uses these to find the new state estimate. The working principles behind particle filters are similar to unscented Kalman filters, but particle filters can approximate any arbitrary distribution. For this, particle filters require a larger set of points (referred to as particles).

Download this virtual lab to study linear and extended Kalman filter design with interactive exercises.

In general, we want our lives to be linear, as shown on this graph. This might be in terms of success, income, or happiness. But in reality, life is not linear. It is full of up and downs, and sometimes it gets even more complicated. If you’re an engineer, you will often need to deal with nonlinear systems. To help you, we’re going to discuss nonlinear state estimators.

Previously, we used a simplified linear car model to discuss state estimation through Kalman filters. However, if this system is modeled such that it takes into account nonlinearities due to road friction, then the state transition function becomes nonlinear. Here, the noise enters the system linearly but there may be systems where the noise is not additive. In a general system, either the state transition function, or the measurement function or both may be nonlinear. For all these cases, we need to use a nonlinear state estimator instead of a Kalman filter, as Kalman filters are only defined for linear systems. Here’s an example that shows the problem with using a Kalman filter for state estimation of a nonlinear system. The Kalman filter assumes a Gaussian distribution. If the state transition function is linear, then after undergoing the linear transformation, the distribution maintains its Gaussian property. Although it’s not shown here, the same is true for the measurement function g(x). However, if f(x) is nonlinear, then the resulting state distribution may not be Gaussian. And therefore, the Kalman filter algorithm may not converge. In this case, you can implement an extended Kalman filter (EKF), which linearizes the nonlinear function around the mean of the current state estimate. At each time step, the linearization is performed locally and the resulting Jacobian matrices are then used in the prediction and update states of the Kalman filter algorithm.

When the system is nonlinear and can be well approximated by linearization, then extended Kalman filter is a good option for state estimation. However, it has the following drawbacks: 1. It maybe be difficult to calculate the Jacobians analytically due to complicated derivatives; 2. There might be a high computational cost to calculating them numerically; 3. You cannot apply an extended Kalman filter to systems with a discontinuous model, since the system is not differentiable and the Jacobians wouldn’t exist; and 4. Linearization doesn’t provide a good approximation for highly nonlinear systems. In the last case, linearization becomes invalid since the nonlinear function cannot be approximated well enough by a linear function and doesn’t describe system dynamics.

To address the issues with extended Kalman filters, you can instead use another estimation technique called the unscented Kalman filter (UKF). Did you know that the creator of the filter came up with this name after noticing the deodorant on his co-worker’s desk? Now back to the filter: instead of approximating a nonlinear function as an extended Kalman filters does, unscented Kalman filters approximate the probability distribution. What we mean by that is the following: This is the probability distribution. An unscented Kalman filter selects a minimal set of sample points such that their mean and covariance is the same as this distribution. These are referred as sigma points, and are symmetrically distributed around the mean. Each sigma point is then propagated through the nonlinear system model. The mean and covariance of the nonlinearly transformed points are calculated and an empirical Gaussian distribution is computed, which is then used to calculate the new state estimate. Note that in the linear the Kalman filter algorithm, the error covariance P is calculated using the state transition function in the prediction step, and then it is updated using the measurement. However, in the unscented Kalman filter, we don’t calculate it in the same way, because we get it empirically instead.

Another nonlinear state estimator based on a very similar principle is the particle filter (PF). It also uses sample points referred as particles. The significant difference from an unscented Kalman filter is that a particle filter approximates any arbitrary distribution, so it’s not limited to a Gaussian assumption. And to represent an arbitrary distribution that is not known explicitly, the number of particles that a particle filter needs is much larger than you’d need for an unscented Kalman filter.

For comparison, here are the properties of the filters that we’ve discussed so far. A Kalman filter only works on linear systems. For state estimation of nonlinear systems, you can use an EKF, UKF, or PF. Note that for an EKF to precisely estimate states, it needs good linearization of the nonlinear system model. Otherwise, the filter provides poor estimation. A particle filter is the only one that works for any arbitrary distribution. And we see that the computational cost grows as we move down the column. Particle filter is computationally the most expensive filter, since it requires a large number of particles to approximate an arbitrary distribution.

In this video, we discussed the basic concepts behind different nonlinear state estimators. Now, if you need to deal with any nonlinearities such as the road friction in the car example, you know how to estimate states of interest of your nonlinear system. For more information on EKFs, UKFs, and PFs, explore the resources in the descriptions of this video.

#### Download Code and Files

#### Related Products

#### Learn More

Seleziona un sito web

Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .

Puoi anche selezionare un sito web dal seguente elenco:

Come ottenere le migliori prestazioni del sito

Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.

Americhe

- América Latina (Español)
- Canada (English)
- United States (English)

Europa

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)

Asia-Pacifico

- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)