## Unscented Filters

Unscented filters behavior similarly to extended filters, but they do not rely on linearizations for the propagated covariance or innovation covariance. They:

1. Create a series of sigma points near to the previous estimate based on the covariance;
2. Propagate each;
3. Predict the measurement for each;
4. Form the error covariance (or information matrix) of the predicted measurement (the innovation covariance);
5. Correct the mean state propagation with information from the measurement;
6. And correct the estimate covariance as well.

Unscented filters are great when the process/observation functions are significantly nonlinear or when the Jacobians can't be determined analytically. They assume that the uncertainty can be adequately described by a covariance matrix (so, the error probability is Gaussian or at least unimodal).

## Propagation

### Discrete Dynamics Function, f

In order to propagate the sigma points, the filter will call a user-provided function of the times, state, input, process noise, and any additional user-provided arguments.

x_k = f(t_km1, t_k, x_km1, u_km1, q_km1, ...);

Here, q_km1 is the process noise associated with this sigma point; its effect on the state is assumed to be nonlinear (if it is actually simply additive, see the input described below).

The actual interface will depend on other options selected. See the Interfaces box to see what the filter expects for your chosen options.

### Process Noise, Q_km1

Unscented filters generally assume that the true state varies nonlinearly with process noise. Therefore, unlike linear and extended filters, the process noise need not have the same dimension as the state vector. The noise can refer to just about anything, as long as the dynamics function can use this for the propagation. This allows more realistic modeling of the effect of process noise and can simplify the process, since one need not tediously map the “real” noise terms to their linear effect on the state (one can use the “real” noise terms directly).

The process noise covariance can be a constant, and input, or a function:

Q_km1 = Q_fcn(t_km1, t_k, x_km1, u_km1, ...);

The process noise is assumed to be discrete over the time step.

### Noise is Additive?

When the process noise is simply additive, such as:

x_k = f(t_km1, t_k, x_km1, u_km1, ...) + q_km1;

checking this box will reduce the number of sigma points the filter must run, and therefore will reduce run-time.

### Include Input in Propagation Functions?

When this is selected, the input vector, u_km1, will be an input to the filter and will be passed to all of the functions in the propagation section, including the nonlinear propagation function and the function for Q_km1.

### Observation Function, h

The filter will call some user-provided function to form the measurement for each propagated sigma point. The interface will be something like:

z_hat_kkm1 = h(t_k, x_kkm1, r_k);

where z_hat_kkm1 is the predicted measurement at sample k based on information from k-1, x_kkm1 is likewise the predicted state at k given information from k-1, and r_k is the measurement noise for this sigma point.

The actual interface will depend on other options. See the Interfaces box to see what the filter expects for your chosen options.

### Returns Innovation Direction?

In some cases, it's useful for the observation function to return the innovation vector, y_k (the difference between the measurement and the predicted measurement, z_k - z_hat_kkm1), instead of returning the predicted measurement. This is used when the two quantities can't be simply subtracted. When this is the case, select this box, make sure h returns y_k, and note that the actual measurement, z_k will now be an input to all of the observation-type functions.

y_k = h(t_k, x_kkm1, z_k, r_k);


### Measurement Noise, R_k

Unscented filters generally assume that the measurement is a nonlinear function of the state and the measurement noise, r_k. This is a discrete-time random number with zero mean and covariance R_k.

The measurement noise covariance can be a constant, and input, or a function:

R_k = R_fcn(t_k, x_kkkm1);

The actual interface will depend on other options. See the Interfaces box to see what the filter expects for your chosen options.

### Noise is Additive?

Just as for process noise, when measurement noise is additive, such as:

z_k = f(t_k, x_kkm1) + r_k;

then fewer sigma points can be used, reducing run-time. When this is applicable, check the box.

### Include Input in Observation Functions?

When this is selected, the input vector, u_km1, will be an input to the filter and will be passed to all of the functions in the observation section, including the observation function and the function for R_k.

## Correction

### Covariance Type

The unscented filter architecture can represent the uncertainty in the estimate as the covariance matrix or as the square-root of the covariance matrix (the Cholesky factorization). The latter is more numerically stable and has only a small effect on run-time.

When the Cholesky factor is used, the input and output for the uncertainty will be sqP_km1 and sqP_k respectively.

### Input Updates Vector?

When this option is selected, the filter will have an additional input called updates. This should be a vector with the same dimension as the measurement and full of booleans specifying which indices of the measurement have been updated since the last step of the filter.

For example, if z_k is of length 5, and if its first two indices and last index have been updated with new measurements, updates would be:

[true true false false true]


### Use Consider Parameters

Consider parameters represent additional uncertainty in the system. Unlike process and measurement noise, however, consider parameters may be correlated with the state. They help prevent a filter from being optimistic or inconsistent without adding significanty to the runtime.

#### P_cc

This is the covariance of the consider parameters. It can be a constant or an input to the filter. It is commonly constant.

#### P_xc_0

This is the initial covariance between the state estimate and the consider parameters. For nx states and nc consider parameters, this is nx by nc.

When no initial covariance is known, this is often all zeros.

## Options

### Output Innovation

Check this box if the innovation vector, y_k (the difference between the measurement and the predicted measurement), should be an output from the filter. This is useful in understanding filter performance over time. For instance, the innovation vector should be reasonably close to white for a proper filter.

When this is output, the Monte-Carlo test (if generated) will use this output for statistics on filter performance.

### Output Innovation Covariance

Check this box if the innovation covariance, P_zz_k, should be an output from the filter. This is useful in understanding filter performance over time.

When this is output, the Monte-Carlo test (if generated) will use this output for statistics on filter performance.

### α

This tuning parameter controls the spacing of the sigma points about the mean, with 0.001 being a common default.

### β

This tuning parameter describes the distribution of the covariance; a value of 2 is optimal for Gaussian distributions.

### κ

This tuning parameter is most often set to 3 - nx, where nx is the number of states