Troubleshoot Online State Estimation
After you perform state estimation of a nonlinear system using linear, extended, or unscented Kalman filter or particle filter algorithms, you validate the estimation before deploying the code in your application. If the validation indicates low confidence in the estimation, check the following filter properties that you specified:
Initial state and state covariance values — If you find that the measured and estimated outputs of your system are diverging at the beginning of state estimation, check the initial values that you specified.
State transition and measurement functions — Verify that the functions you specify are a good representation of the nonlinear system. If the true system is continuous-time, to implement the algorithms, you discretize the state transition and measurement equations and use the discretized versions. If the state estimation results are not satisfactory, consider decreasing the sample time used for discretization. Alternatively, try a different discretization method. For an example of how to discretize a continuous-time state transition function, type
edit vdpStateFcn.m
at the command line. Also see, Nonlinear State Estimation Using Unscented Kalman Filter and Particle Filter.Process and measurement noise covariance values — If the difference between estimated and measured outputs of your system is large, try specifying different values for the process and measurement noise covariance values.
Choice of algorithm — If you are using the extended Kalman filter algorithm, you can try the unscented Kalman filter, or the particle filter algorithm instead. The unscented Kalman filter and particle filter may capture the nonlinearities in the system better.
To troubleshoot state estimation, you can create multiple versions of the filter with different properties, perform state estimation, and choose the filter that gives the best validation results.
At the command line, if you want to copy an existing filter
object and then modify properties of the copied object, use the clone
command. Do not create additional
objects using syntax obj2 = obj
. Any changes
made to the properties of the new object created in this way (obj2
)
also change the properties of the original object (obj
).