## UKF:

Path: Common/Estimation

```% Implement an Unscented Kalman Filter.
The filter uses numerical integration to propagate the state.
The filter propagates sigma points, points computed from the
state plus a function of the covariance matrix. For each state
there are two sigma states.

The default integrator is RK4, or you cab specify an integrator
with the field

d.integrator = @myIntegratorName

To initialize UKF call

d = UKF( 'initialize', d );

To update

d = UKF( 'update', d, y );

The filter appends internal data to the data structure.
d.x gives the current estimated state and d.pXX the state covariance.

The measurement function is of the form

meas = MeasFun( x, dMeasFun );

The state function is of the form

xDot = StateFun( x, t, dStateFun );

You can use either the Cholesky transform or matrix square root to
form the sigma points.

--------------------------------------------------------------------------
Form:
d = UKF( action, d, y )
d = UKF( 'datastructure', nStates, nMeas )
--------------------------------------------------------------------------

------
Inputs
------
action    (1,:)  'initialize' or 'update' or 'datastructure'
d          (.)  UKF data structure
.rHSFun        (1,:) Name or handle of RHS function
.integrator    (1,:) Handle of integrator function
.rHSFunData	  (.)   RHS function data structure
.measFun       (1,:) Handle of measurement function
.measFunData	  (.)   Measurement function data
.x             (n,1) Initial state vector
.p             (n,n) Covariance matrix for x
.pXX           (n,n) Covariance after state update
.dY            (1,1) Number of measurements
.dX            (1,1) Number of states
.rP            (n,n) Process noise covariance
.rM            (n,n) Measurement noise covariance
.alpha         (1,1) Scaling 1e-4 <= alpha <= 1
.kappa         (1,1) Secondary scaling usually 0
.beta          (1,1) Prior knowledge of distribution = 2
for Gaussian distributed noise
.dT            (1,1) Time step
.t             (1,1) Time
.sigmaPtAlg    (1,1) 1 = sqrtm, 2 = chol
y         (m,1)  Measurement vector
verbose   (1,1)  Flag for verbose output. 1 = warn, 2 = error.

-------
Outputs
-------
d          (.)   UKF data structure with the following appended
.dX          (1,1) Number of states
.n           (1,1) Number of sigma points
.y           (m,1) Measurements based on the states
.xA          {n}   Sigma points
.pP          (n,n) Covariance matrix prior to
measurement
.xP          (n,1) State vector prior to measurement
incorporation
.res         (:,1) Residuals

--------------------------------------------------------------------------
References: Voss, H. U., Timmer, J., Kurths, J., "Nonlinear Dynamical
System Identification from Uncertain and Indirect
Measurements,"  International Journal of Bifurcation
and Chaos, Vol. 14, No. 6, 2005, pp. 1905-1933.
Van der Merwe, R. and Wan, E., "Sigma-Point Kalman Filters
for Probabilistic Inference in Dynamic State-Space Models",
--------------------------------------------------------------------------
```

## Children:

```Common: DemoFuns/GXUKF
Common: DemoFuns/RHSUKF
Common: Estimation/SigmaPointsChol
Math: Integration/RK4
```

Back to the Common Module page